0

I am trying to create a 6.5in longtable with 3 columns (Name, Major/University, Date). I would like the first and second cells to be left-aligned, while the third cell is right-aligned. I want to use \dotfill between the cells.

I am still new to customizing the parameters in tables, but this is what I have now. As can be seen, there is a space between the dots in the 2nd and 3rd cell for each row. I would like it if I could close this gap, and I'm not sure how. I tried putting @{} after the >{\dotfill\raggedleft\arraybackslash} but that raised an error.

Here is a MWE and picture of output.

\documentclass{minimal}

\usepackage{longtable}
\usepackage{array}

\begin{document}

\begin{center}
    \begin{longtable}{@{}p{1.625in}<{\dotfill}@{}p{3.875in}<{\dotfill}@{}@{}>{\dotfill\raggedleft\arraybackslash}p{1in}@{}}

        First Last & Some Thing and Some Thing, Some Where and Some Where & 2019 \\
        FirstFirst LastLast & Some Thing and Some Other Thing, Some Where, Somewhere & 2019 \\
        FirstFirst Last & Something, Somewhere & 2018 - 2019 \\
        First LastLast & Something Something, Somewhere Somewhere & Fall 2019 \\
        First Middle Last & Thing, Where & Summer 2019 \\
        First Middle Middle Last & Something, Where & Spring 2019 \\
        First Last & Something Some Other Thing, Somewhere and Somewhere & Winter 2019 \\

    \end{longtable}
\end{center}

\end{document}

Output of MWE code. There is a gap between the dotfills of the 2nd and 3rd cell for each row.

1 Answer 1

1

enter image description here

simpler to use two columns:

\documentclass{minimal}

\usepackage{longtable}
\usepackage{array}

\begin{document}

% not around longtable \begin{center}
    \begin{longtable}{@{}p{1.625in}<{\dotfill}@{}p{4.875in}@{}}

        First Last & Some Thing and Some Thing, Some Where and Some Where \dotfill 2019 \\
        FirstFirst LastLast & Some Thing and Some Other Thing, Some Where, Somewhere \dotfill 2019 \\
        FirstFirst Last & Something, Somewhere \dotfill 2018 - 2019 \\
        First LastLast & Something Something, Somewhere Somewhere \dotfill Fall 2019 \\
        First Middle Last & Thing, Where \dotfill Summer 2019 \\
        First Middle Middle Last & Something, Where \dotfill Spring 2019 \\
        First Last & Something Some Other Thing, Somewhere and Somewhere \dotfill Winter 2019 \\

    \end{longtable}
% \end{center}

\end{document}
4
  • While this is a good workaround, I have to manually put the \dotfills in the table content, which I don't want to do. How can I solve this without using \dotfill in the table content?
    – Abraham
    Jun 27, 2019 at 1:45
  • @Abraham, In your question title you require to have \dotfill. If you not liked, than just remove them from table specification in your MWE.
    – Zarko
    Jun 27, 2019 at 5:48
  • 2
    @Abraham I don't see it as any different really, in your suggested markup you manually separate by & and here I separate by \dotfill it's just a single tex token in either case. In practice I would use \newcommand\myrow[3]{#1&#2\dotfill#3\\} and then \myrow{foo}{bar}{2019} which you could do whatever underlying syntax is used. Jun 27, 2019 at 6:54
  • Ah, I see. Good idea to use a \newcommand for this purpose, that helps! Thanks, I'll mark this as the accepted answer :)
    – Abraham
    Jun 27, 2019 at 18:37

You must log in to answer this question.

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