Search code examples
latextabular

Table filling width with 2 columns each as multi-row


I am trying to setup a table with 2 columns. It should fill the whole width of a A4 page.

Each column should contain a \multirow (different number of rows for each column).

The left column should be aligned on the left, the right column should be aligned on the right.

I am struggling with the details of the space filled between the columns. So far I've tried with the usual tabular package, but also with longtable, but I see all sorts of indentation problems. It seems like these packages don't honor the geometry details of the page.

See here:

% \begin{longtable}{@{\extracolsep{\fill}\hspace{\tabcolsep}} l r}
\begin{tabular}{>{\raggedright}p{0.5\linewidth}>{\raggedleft}p{0.5\linewidth}}
  \multirow{2}{*}{\begin{tabular}{l}xx \\ zz \\ \end{tabular}} & 
  \multirow{2}{*}{\begin{tabular}{r}xx \\ zz \\ \end{tabular}} \\
\end{tabular}
% \end{longtable}

I would like to have 2 columns:

  • one on the far left, aligned on the left
  • the other on the far right, aligned on the right
  • no frames, or lines, just the text/words

Solution

  • If you don't need frames and the columns have different number of rows anyway, why not place two minipages besides each other instead of using a table?

    \documentclass{article}
    
    \begin{document}
    
    \noindent%
    \begin{minipage}{.5\textwidth}
    \raggedright
    xx
    
    zz
    \end{minipage}%
    \begin{minipage}{.5\textwidth}
    \raggedleft
    xx
    
    zz
    \end{minipage}%
    
    \end{document}