1

This thread is a continua of this Double-column for Question/Answer Format? but with focus on the dynamics between the two columns.

Code:

\documentclass{article}
\usepackage{paracol}
\begin{document}
\begin{paracol}{2}
Penicillin

Amoksilav

Cephasporin 1st gen

Cephalosporin 2nd gen
\switchcolumn
Benzylpenicillin 600 mg/2/day,
Oxacillin 1 g/2/day.

Amoxilav 500 mg/2/day.

cefacetrile 500 mg/2/day,
cefradine 500 mg/2/day.

cefaclor 250 mg/3/day,
cefonicid 500
\end{paracol}
\end{document}

Output:

enter image description here

But I want:

  • Penicillin on the same line as Benzyl...
  • Amoksilav on the same line as Amoxilav ...
  • Cephalosporin 1st on the same line as cefacetrile ...
  • Cephalosporin 2nd gen on the same line as cefaclor ...

touhami's output

enter image description here

but code includes many switchcolumns:

\begin{paracol}{2} Penicillin \switchcolumn Benzylpenicillin 600 mg/2/day, Oxacillin 1 g/2/day. \switchcolumn* Amoksilav \switchcolumn Amoxilav 500 mg/2/day. \switchcolumn* Cephasporin 1st gen \switchcolumn cefacetrile 500 mg/2/day, cefradine 500 mg/2/day. \switchcolumn* Cephalosporin 2nd gen \switchcolumn cefaclor 250 mg/3/day, cefonicid 500 \end{paracol}

How can you keep the corresponding lines of two columns matching each other? I do not like to use table format. I like a lot the syntax of this paracol.

  • 1
    try \begin{paracol}{2} Penicillin \switchcolumn Benzylpenicillin 600 mg/2/day, Oxacillin 1 g/2/day. \switchcolumn* Amoksilav \switchcolumn Amoxilav 500 mg/2/day. \switchcolumn* Cephasporin 1st gen \switchcolumn cefacetrile 500 mg/2/day, cefradine 500 mg/2/day. \switchcolumn* Cephalosporin 2nd gen \switchcolumn cefaclor 250 mg/3/day, cefonicid 500 \end{paracol} – touhami Oct 2 '15 at 12:11
  • Nice output! However, I am interested in if you could do this without some many semantic commands. – Léo Léopold Hertz 준영 Oct 2 '15 at 12:16
  • Isn't a tabular much better suited here? – Johannes_B Oct 3 '15 at 8:10
  • Maybe. I am still thinking paracol because I like its initial syntax and I think it should be possible to have the 2nd output with some minimum semantics. – Léo Léopold Hertz 준영 Oct 3 '15 at 9:08
  • 1
    You need to set anchors for the package to know what sticks together. paracol is intended for paragraphs of text, not for lists. – Johannes_B Oct 3 '15 at 11:52
2

The question title mentions Question-Answer stuff, the picture shows a regular list. A list is ususally done using a list environment, this time using labeling provided by KOMA-script.

Sometimes, a tabular environment can be used to do list-like stuff as well.

masiQA

\documentclass{article}
\usepackage{scrextend}
\usepackage{tabularx}
\begin{document}
\begin{labeling}{Cephalosporin 2nd gen}
\item [Penicillin]
Benzylpenicillin 600 mg/2/day,\\
Oxacillin 1 g/2/day.
\item [Amoksilav]
Amoxilav 500 mg/2/day.
\item [Cephasporin 1st gen]
cefacetrile 500 mg/2/day,\\
cefradine 500 mg/2/day.
\item [Cephalosporin 2nd gen]
cefaclor 250 mg/3/day,\\
cefonicid 500
\end{labeling}
\bigbreak\noindent\rule{.5\textwidth}{.4pt}\bigbreak
\noindent
\begin{tabularx}{\textwidth}{lX}
Penicillin &
Benzylpenicillin 600 mg/2/day,
\newline Oxacillin 1 g/2/day.  \\
Amoksilav & Amoxilav 500 mg/2/day.  \\
Cephasporin 1st gen &
cefacetrile 500 mg/2/day,
\newline cefradine 500 mg/2/day.  \\
Cephalosporin 2nd gen & cefaclor 250 mg/3/day,
\newline cefonicid 500
\end{tabularx}
\end{document}
| improve this answer | |
  • I actually like the labelling environment. Little better. It is easy to read such semantics. So things keep together. Thank you! – Léo Léopold Hertz 준영 Oct 3 '15 at 14:31
  • @Masi I am not really sure if you mean the same with semantics as the rest of us. – Johannes_B Oct 3 '15 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.