2

In Beamer I want a frame with text in two columns, with parallel content, like the following:

1 This is the first item in english        1 Este el primer item en español
2 Second english item                      2  Segundo item en español, pero 
                                              este es mas largo
3 Third very long item in                  3 Tercer item en español 
   English spanning
    spanning spanning
    many lines
4  ...                                      4 ...

like this, corresponding parts in the two text columns should be aligned on the same line. The best would be a solution which is not specific to beamer, as this should be a general problem.

  • 1
    Do you try to use tabularx environment? – Zarko Sep 23 '15 at 20:58
  • 1
    Or perhaps pdcolfparcolums (a slight extension of the original parcolumns package). – jon Sep 23 '15 at 21:17
1

I will extend my comment with illustration, if this is what you like to have: enter image description here

This is obtained by:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}

\begin{document}
\begin{frame}[t]
    \begin{tabularx}{\hsize}{rXrX}
1   &   This is the first item in english        
        &   1   &   Este el primer item en español                    \\
2   &   Second english item                      
        &   2   &    Segundo item en español, pero este es mas largo  \\
3   &   Third very long item in English spanning spanning spanning many lines
        &   3   &   Tercer item en español                        \\
4   &   \dots
        &   4   &   \dots \end{tabularx}
\end{frame}
\end{document}

If you not like to have numbers in the first in third row, just erase this columns. Also you can change the cell aligmnet with defining new column type R:

\newcolumntype{R}{>{\RaggedRight\arraybackslash}X}

which will smart align cell content to the left. For \RaggedRight you need to ad package ragged2e in preamble of your document. Some more place in table you can obtain, if to begin and end of parameters you add @{} like this:

{@{}rRrR@{}}

Upgrade: The think over numbering of cells: since the cells in the same row have the same number, it would be enough to numbering rows only one time, for example only in the first column. This numbering can be automatized, and with this spare one care in typing this table.

Also use of package booktabs gives possibility to increase space between rows with adding addlinespace after each row (increasing of this space can be obtain also with for example \\[1ex]).

With this "improvements" the list of English/Español expression looks like:

enter image description here

As can you see, automatic numbering alloves also referencing of rows. Maybe this become handy. The code with described changes is below:

\documentclass{beamer}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{ragged2e}
    \usepackage{booktabs}% <-- new
    \usepackage{tabularx}
\newcolumntype{R}{>{\RaggedRight\arraybackslash}X}
%%% new    
\setlength{\tabcolsep}{3pt}
\newcounter{tabrowref}
\renewcommand\thetabrowref{\arabic{tabrowref}}
\newcommand{\getTabRowRef}{%
        \refstepcounter{tabrowref}
        \thetabrowref}

\begin{document}
\begin{frame}[t]
\begin{tabularx}{\hsize}{@{}>{%
    \color{black}%<-- for correct aligning of text in cells
    \getTabRowRef%<-- for automatic numbering of rows
    \setlength\hsize{0.05\hsize}}R%<-- for correct aligning of text in cells
    >{\color{blue}}R  %<-- colored text blue for English
    >{\color{orange}}R% and orange for English
                                >{\color{blue}}R  %<-- colored text blue for English
                                >{\color{orange}}R% and orange for English
                            @{}}
    &   This is the first item in English
        &       Este el primer item en Español                      
        \\  \addlinespace%<-- for increasing space between rows
    &   Second english item
        &        Segundo item en Español, pero este es mas largo    
        \\  \addlinespace
\label{row:3}   
    &   Third very long item in English spanning spanning spanning many lines
        &       Tercer item en Español \dots                        
        \\    \addlinespace
    &   \dots
        &       \dots 
    \end{tabularx}

\vskip 4em   
\textcolor{blue}{Automatic numbering of rows also enable to referencing a particular row. For example, considering row \ref{row:3} \dots}
\end{frame}
\end{document}
  • @kjetibhalvorsen, see my upgraded answer. I slightly change the layout of text appearance (now is colored). Actually, I'm curious, if any of given answers is what you looking for? – Zarko Sep 24 '15 at 7:55
1

This should be automatic:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx,lmodern}

\newcounter{mycounter}
\setcounter{mycounter}{0}
\newcommand{\mycounter}{\stepcounter{mycounter}\arabic{mycounter}}

\newcommand{\LRenums}[2]{%
\begin{enumerate}
    \item[\mycounter] #1
\end{enumerate}
&
\addtocounter{mycounter}{-1}
\begin{enumerate}
    \item[\mycounter] #2
\end{enumerate}
}
\begin{document}

\begin{frame}[t]
\begin{tabularx}{\hsize}{@{}XX@{}}
\LRenums{This is the first item in english}{Este el primer item en español} \\ 
\LRenums{Second english item}{Segundo item en español, pero este es mas largo} \\ 
\LRenums{Third very long item in English spanning spanning spanning many lines}{Tercer item en español} \\ 
\LRenums{\dots}{\dots} \\ 
\end{tabularx}
\end{frame}

\end{document}

enter image description here

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.