1

I am working on a research paper where I have a long glossary of variables. The document is a single column so I have split the table into two columns using the multicol package.

\documentclass[11pt]{report}
\usepackage{multicol}

\begin{document}
\begin{table}
    \vspace*{0.5cm}
    \centering
    \begin{multicols}{2}
        \begin{tabular}{p{2cm} p{3cm}}

            \hline \hline
            ABC & 123 \\
            ABC & 123 \\

            \hline \hline
            Subtitle 0 & \\ \hline
            C & 1234 \\
            D & 1243 \\
            E & 1234 \\
            F & 1234 \\
            G & 1234 \\
            H & 1234 \\
            \hline
        \end{tabular}

        \begin{tabular}{p{2cm} p{3cm}}
            \hline \hline
            Subtitle 1 & \\ \hline
            A & 1234 \\

            \vspace*{1cm}
            \rule{\linewidth}{0.4pt}
            Subtitle 2 & \\ \hline
            B & 1234 \\
            C & 1234 \\
            D & 1234 \\
            \hline
        \end{tabular}
    \end{multicols}

\end{table}
\end{document}

That has worked so far, but I want the two bottom rules to align perfectly. My current output

I have tried using \vfill but this produces an error message.

The best solution so far is to use \vspace*{} and set a manual space but I would prefer one that guarantees alignment without guessing and checking.

This solution \vfill to make even space in double column tabular is close, but I want a whitespace gap between the two columns.

1 Answer 1

2

You could use nested tables:

\documentclass[11pt]{report}

\begin{document}
\begin{table}
    \vspace*{0.5cm}
    \centering
    \begin{tabular}{
        @{}c@{}
        p{16pt}% horizontal space between the tables
        @{}c@{}
      }
        \begin{tabular}[t]{p{2cm}p{3cm}}% <- option t added
            \hline\hline
            ABC & 123 \\
            ABC & 123 \\

            \hline \hline
            Subtitle 0 & \\ \hline
            C & 1234 \\
            D & 1243 \\
            E & 1234 \\
            F & 1234 \\
            G & 1234 \\
            H & 1234 \\
        \end{tabular}
        &&
        \begin{tabular}[t]{p{2cm} p{3cm}}% <- option t added
            \hline \hline
            Subtitle 1 & \\ \hline
            A & 1234 \\

            %\vspace*{1cm}
            \rule{\linewidth}{0.4pt}
            Subtitle 2 & \\ \hline
            B & 1234 \\
            C & 1234 \\
            D & 1234 \\
        \end{tabular}\\
        \cline{1-1}\cline{3-3}
    \end{tabular}
\end{table}
\end{document}

enter image description here


Regarding a comment below:

The optional argument of the tabular environment declares the vertical position of the table. By default the vertical center of the table is positioned on the baseline of the surrounding text. So value c is the default for this optional argument. Value t aligns the top row of the table with the surrounding text and b aligns the bottom row.

Because both inner tables in the example have the t in the optional argument, the top rules of the tables are aligned to each other.

3
  • Thanks @esdd. That worked perfectly. Out of curiosity, can you explain why the 't' placement specifier makes it all work? (I tried it with and without it and things go crazy without it!)
    – wgb22
    Commented Oct 9, 2019 at 23:30
  • 1
    @wgb22 See my updated answer.
    – esdd
    Commented Oct 10, 2019 at 6:47
  • Thanks for the clarification
    – wgb22
    Commented Oct 10, 2019 at 8:48

You must log in to answer this question.

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