4

Wanted output

enter image description here

Data

What is your name?  Ka jus sauc?
How old are you? Cik jums ir gadu? 
When were you born?  Kad jus esat dzimi? 
What do you work with? Ar ko jus stradajat? 

I could use Pandoc/markdown logical tables but I would like to do this directly in LaTeX. I can add a separator between the English and Latvian version.

Bigger data

\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 mg/day. 
\end{paracol}

which gives the following output. This input also gives the following input without extra empty lines, which is strange:

\begin{paracol}{2}
-- same as above --
\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 mg/day. 
\end{paracol}

Output:

enter image description here

where I would like that the left-column adjusts with the right one such that the materials are on the corresponding lines.

How can you get the double-column wanted output?

4
  • 2
    Shouldn't it read When where you born?
    – user31729
    Sep 24, 2015 at 8:54
  • 1
    @ChristianHupfer »When where«? :p
    – cgnieder
    Sep 24, 2015 at 10:09
  • \newcommand\question[1]{\makebox[.5\textwidth][l]{#1}} \noindent\question{What is your name?} \question{Ka jus sauc?} \question{How old are you?} \question{Cik jums ir gadu?}
    – touhami
    Sep 24, 2015 at 10:16
  • 1
    @clemens: Ok, I corrected only one error :D
    – user31729
    Sep 24, 2015 at 11:59

3 Answers 3

6

Here's a paracol and parallel version of parallel typesetting.

\documentclass{article}

\usepackage{parallel}
\usepackage{paracol}

\begin{document}

\begin{paracol}{2}
What is your name?     

How old are you?       

When where you borned? 

What do you work with? 
\switchcolumn
 Ka jus sauc?

 Cik jums ir gadu? 

 Kad jus esat dzimi? 

 Ar ko jus stradajat? 
\end{paracol}

\fbox{Now with parallel package:}

\begin{Parallel}{0.4\textwidth}{0.4\textwidth}
\ParallelLText{%
What is your name?     

How old are you?       

When where you borned? 

What do you work with? 
}

\ParallelRText{%
 Ka jus sauc?

 Cik jums ir gadu? 

 Kad jus esat dzimi? 

 Ar ko jus stradajat? 
}

\end{Parallel}

\end{document}

enter image description here

4
  • I added a challenge with bigger data. I noticed that the left-column is not adjusting with the right column. Sep 24, 2015 at 17:07
  • @Masi: You're changed the question too!
    – user31729
    Sep 24, 2015 at 17:36
  • I also made a variant of input without those empty lines but still there is the unalignmnent of columns, just because of too much content in the cells. I would be get both sides aligned. Sep 25, 2015 at 3:20
  • I extended this thread to consider the dynamics of paracol application here tex.stackexchange.com/q/270704/13173 Oct 2, 2015 at 11:55
8

You can use tabular environnement:

\begin{tabular}{ll}
What is your name? &  Ka jus sauc? \\
How old are you? & Cik jums ir gadu? \\
When where you borned? &  Kad jus esat dzimi? \\ 
What do you work with? & Ar ko jus stradajat? \\
\end{tabular}

MWE:

\documentclass{article}

\usepackage[latvian]{babel}
\begin{document}
\begin{tabular}{ll}
What is your name? &  Ka jus sauc? \\
How old are you? & Cik jums ir gadu? \\
When where you borned? &  Kad jus esat dzimi? \\ 
What do you work with? & Ar ko jus stradajat? \\
\end{tabular}
\end{document}

output: enter image description here

4

Here is a macro version for the job:

\documentclass{article}
\usepackage{paracol}

\newcommand{\qa}[2]{%
  \begin{paracol}{2}
  \noindent
  #1
  \switchcolumn
  \noindent
  #2
  \end{paracol}
  }
\begin{document}

\qa{What is your name? How old are you? How old are you? How old are you?}{Ka jus sauc?}

\qa{How old are you?}{Cik jums ir gadu?}

\qa{When where you borned?}{Kad jus esat dzimi?}

\qa{What do you work with?}{Ar ko jus stradajat?}


\end{document}

enter image description here

2
  • This could be expanded such a way that you have all your Latvian questions inside the first brackets with some separator between sentences, and then English sentences inside the other brackets. Sep 24, 2015 at 11:01
  • 1
    @Masi: That will not align the question with its answer if either question or answer is spanning more than two lines. See Christian's answer and use a long question/answer there.
    – user11232
    Sep 24, 2015 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .