1

I'm trying to put together a three column table (in tabularx) that have the following layout (in full line width):

Section  Description           Page
    1-5  text text text ......    7
   5-12  text text text text
         text ................  121

Note:

  • Left column is to be top right align
  • Middle column spans one/multiple lines and ends with a \dotfill
  • Right column is to be bottom-right align

PS: This worked for the middle + right columns, but when I added the left most column, I can't get the text to aligned at the top.

Any suggestions on how to make this work?

(Compiling wit LuaTex in document class memoir)

3 Answers 3

1

Building upon the solution in Tabular - 3 columns with top-align and bottom-align I came up with the following:

enter image description here

\documentclass[]{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}


\begin{document}


\noindent
    \begin{tabularx}{\textwidth}{rXr}
Section & Description & Page\\ \addlinespace
        1-5 & 
        test text text  text  text  text  text  text  text  text  text
  text  text  text  text  text  text  text  text\dotfill
        &\\[-\normalbaselineskip]&
        &7\\ \addlinespace
        5-12 & 
        test text text  text  text  text  text  text   \dotfill 
        &\\[-\normalbaselineskip]&
        &121\\
    \end{tabularx}

\end{document}
1
  • Yes, awesome, thanks
    – imdk4242
    Jul 15, 2019 at 6:46
1

like this?

enter image description here

With use of the multirow package, where you need manually set the number of lines in the second column:

\documentclass{memoir}
\usepackage{multirow, tabularx}

\begin{document}
\noindent
\begin{tabularx}{\linewidth}{ r X r }
1-5     &   test text text text text text text text text text text text text text text text text text text\dotfill
            &   \multirow[b]{2}{*}{1-2}  \\
5-12    &   test text text text text text text text text text text test text text text text text text text text text text text text text text text text text text\dotfill
            &   \multirow[b]{3}{*}{34-143}
\end{tabularx}
\end{document}
1
  • Correct. However, I need to change the index manually each time (in above MWE: 2 for first row and 3 for second row) as I go along? This can show to be problematic if the paper size is changed etc. Is there a way of getting the same result with the right most column aligning bottom without manually inputing for each row?
    – imdk4242
    Jul 14, 2019 at 23:16
0

Here is a solution with {NiceTabular} of nicematrix.

\documentclass[]{article}
\usepackage{nicematrix}
\usepackage{collcell}

\begin{document}

\newcolumntype{B}{>{\collectcell{\Block[B]{}}}r<{\endcollectcell}}

\noindent
\begin{NiceTabular}{rXB}
Section & Description & Page\\[1mm]
        1-5 & 
        test text text  text  text  text  text  text  text  text  text
  text  text  text  text  text  text  text  text\dotfill
        & 7 \\[1mm]
        5-12 & 
        test text text  text  text  text  text  text   \dotfill 
        & 121 \\
\end{NiceTabular}

\end{document}

You need several compilations (because nicematrix uses PGF/TikZ nodes under the hood).

Output of the above code

You must log in to answer this question.

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