1

I am creating a cv using multirow. I fix the width of the column so that multirow automatically splits the text into different rows. I want to control the distance between the last row and the next block of the table while multirow only allows me to set the distance between the first line of the multirow environment.

Here is my MWE.

\documentclass[letterpaper,8pt,oneside]{article}
\usepackage{longtable}
\usepackage{multirow}
\usepackage[centering,includeheadfoot,margin=2cm]{geometry}
\newcommand\x{8cm}  % width 
\newcommand\dist{2cm}  % distance

\begin{document}

    \begin{longtable}{ll}
        %
        %
        % EDUCATION
        %
        %
        \hline \noalign{\vskip 0.2cm}
        \Large{\textbf{Education}}
        &
        \\ 
        \small{2017 - 2021 (expected)}
        & 
        \textbf{Ph.D. in Economic Analysis}\\
        &
        \multirow{1}{\x}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.}\\[\dist]   
        &
        \textbf{Ph.D. in Economic Analysis}\\
        &
        \multirow{1}{\x}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes,.}\\[\dist]                                                        
    \end{longtable}
\end{document}

In this example, I choose the "variable" \dist = 2 on purpose, so that the two parts of the text overlap. I know I could set a bigger \dist specific to each block, but I would like Latex to do automatically.

EDIT

I implemented the solution proposed y @Zarco in the comments. However, I have the same problem. I want to control the distance between the line of text while the usual command \\[some distance] allows me to control the distance between the cells. The problem arises when there is one cell with more than one line of text. In the example below I would like to have the distance between [here] and M.Res. to be the same as the distance between [here2] and Bachelor.

\documentclass[letterpaper,8pt,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{setspace}

\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}

\usepackage{longtable}

\usepackage{marvosym}

\usepackage[centering, left=2cm, bottom=2cm, top=2cm]{geometry}
%\usepackage[centering,includeheadfoot,margin=2cm]{geometry}

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

%% Distances

% distance line header
\newcommand\dista{0.2cm}

% distance bold-text
\newcommand\distb{0cm}

% distance bold-text academic exp
\newcommand\distba{0.2cm}

% distance text-bold/line
\newcommand\distc{0.8cm}

\begin{document}



    \begin{longtable}{L{8cm} p{8cm}}
    %
    %
    % EDUCATION
    %
    %
    \hline \noalign{\vskip 0.2cm}
    \Large{\textbf{Education}}
    &
    \\ 
    \small{2017 - 2021 (expected)}
    & 
    \textbf{Ph.D. in Economic Analysis}\\[\distb]
    &
    Universitat Example1, Universitat Autonoma, Universitat [Here].\\[\distc]
    \small{Fall 2015 - Spring 2017}
    &
    \textbf{M.Res. in Economics Analysis }\\[\distb]
    &
    Universitat [here2].\\[\distc]
    \small{Fall 2011 - Fall 2014}
    &
    \textbf{Bachelor Degree in Mechanical Engineering}\\[\distb]
    &
    Univeristy X.\\[\distc]
    \hline
\end{longtable}

\end{document}

7
  • 2
    I not see any reason why to use multirow cells. In fact your approach is wrong. Eventualy in its place you should use multicolumn cells. However, far more simple is to defie table with \begin{longtable}{l >{\raggedright\arraybackslash}p{\x}} and not use \multirow at all.
    – Zarko
    Mar 3, 2020 at 15:33
  • 2
    Probably even going for xltabular and its X type column might be an idea to also automatically calculated the width of the second column.
    – leandriis
    Mar 3, 2020 at 15:34
  • Thanks to both. @Zarco, can you please elaborate or share a link where I can find more information on that approach?
    – Tecon
    Mar 3, 2020 at 15:47
  • In the solution proposed by @Zarko, it does not seem possible to fix the text in the left column at the top of the table, in line with the first line of the text in the right column.
    – Tecon
    Mar 3, 2020 at 16:16
  • In the solution proposed by @leandriis, the problem I find is that is not possible to split the table between pages with xltabular.
    – Tecon
    Mar 3, 2020 at 16:19

1 Answer 1

1
  • I doubt that use of tables for your intention is right decision
  • Their main drawback is that table can be broken between pages only between rows
  • Examples of use of the xltabular and longtable
\documentclass[letterpaper,8pt,oneside]{article}
\usepackage[centering,includeheadfoot,margin=2cm]{geometry}
\usepackage{microtype}
\usepackage{booktabs, multirow, xltabular}

\newcommand\x{8cm}  % width
\newcommand\dist{2cm}  % distance
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\section{Example with \texttt{xltabular}}
    \begin{xltabular}{\linewidth}{@{} >{\large\bfseries}l X @{}}
    \toprule
Education
    &                                       \\
    \addlinespace
\small\multirow[t]{2}{6em}{2017 - 2021 (expected)}
    &   \textbf{Bachelor ...}               \\*
    &   \lipsum [11]                        \\
    \addlinespace
\small 2017 - 2021 
    &   \textbf{Master of math science}     \\*
    &   \lipsum [12]                        \\
    \addlinespace
\small 2017 - 2021 
    &   \textbf{Master of business science} \\*
    &   \lipsum [13]                        \\
    \addlinespace
\small 2017 - 2021 
    &   \textbf{Ph.D. in Economic Analysis} \\*
    &   \lipsum [14]                        \\
    \addlinespace
Experiences
    &                                       \\*
\small 2017 - 2021 
    &   \textbf{Company A}                  \\*
    &   \lipsum [15]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Company B}                  \\*
    &   \lipsum [16]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Company C}                  \\*
    &   \lipsum [17]                        \\
    \addlinespace
\small 2017 - 2021 
    &   \textbf{Company D}                  \\*
    &   \lipsum [18]                        
    \end{xltabular}

\section{Example with \texttt{longtable}}
    \begin{longtable}{@{} >{\large\bfseries}l p{\x} @{}}
    \toprule
Education
    &                                       \\*
    \addlinespace
\small\multirow[t]{2}{6em}{2017 - 2021 (expected)}
    &   \textbf{Bachelor ...}               \\*
    &   \lipsum [11]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Master of math science}     \\*
    &   \lipsum [12]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Master of business science} \\*
    &   \lipsum [13]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Ph.D. in Economic Analysis} \\*
    &   \lipsum [14]                        \\
    \addlinespace
Experiences
    &                                       \\*
\small 2017 - 2021
    &   \textbf{Company A}                  \\*
    &   \lipsum [15]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Company B}                  \\*
    &   \lipsum [16]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Company C}                  \\*
    &   \lipsum [17]                        \\
    \addlinespace
\small 2017 - 2021
    &   \textbf{Company D}                  \\*
    &   \lipsum [18]
    \end{longtable}
\end{document}

Test of above example will show that:

  • both tables can be split between pages,
  • text is not be split middle of rows, consequently on bottom of pages can happen undesired white space
  • width of the first column is adopted to cells contents (hence for text 2017 - 2021 (expected) in insert to multirow cell with prescribed width, which enable that text appear in two lines
  • using xltabular you not need to guess which width of the second column will exploit \textwidth

enter image description here

enter image description here

You may consider, that instead of tables for your data use some list, for example description, which can be by help of the package enumitem be easy customized to your needs.

You must log in to answer this question.

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