I have a LaTeX document in which I am using custom environment and commands to make everything a bit easier. However, when I use the multirow command in one of my custom environments, the alignment of the left and right table columns is muddled (see below).

Example of table column misalignment

A minimum working example follows. Note that, in the case shown above, a multirow isn't required. However, there are other situations where the text in the left column is longer than a single table cell from the left column, and hence the multirow is required to prevent the contents of the right column from being spaced further apart.


\ProvidesPackage{cvtools}[2012/07/16 v1.0.0]

\RequirePackage{etoolbox}           % for \ifstrempty, \ifdef
\RequirePackage{ifthen}             % for \ifthenelse
\RequirePackage{longtable}          % for tables that span more than one page
\RequirePackage{multirow}           % for table columns that span more than one row
\RequirePackage{tabularx}           % for simple column stretching
\RequirePackage{xcolor}             % for colours

% Declare options

\DeclareOption*{\PackageWarning{cvtools}{Unknown option `\CurrentOption'}}


% For table styling
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}%

% \begin{education}
% \educationItem{beginYear}{endYear}{name}{institution}{\educationGrade{subject}{grade} ...}
% \end{education}
\newcommand\educationGrade[2]{##1 & ##2\\}%
% Check if we should display tools
        {% showGrades is true, but this \educationItem has no grades to display.
        {% showGrades is true and this \educationItem has grades to display.
    % showGrades is false.
% Education period
\multirow{\@numRows}{\lwidth}{##1 -- ##2}%
% Name and institution
& \textbf{##3 (##4)}%
% Grades
        & \begin{tabularx}{\rwidth}{Xr}%

\usepackage[margin=3cm]{geometry}   % extend page margins

    {Education 1}
    {University 1}

    {Education 2}
    {University 2}
    \educationGrade{Subject 1}{90/100}
    \educationGrade{Subject 2}{88/100}
    \educationGrade{Subject 3}{97/100}
    \educationGrade{Subject 4}{94/100}
    \educationGrade{Subject 5}{95/100}

    \educationItem{January 2002}{December 2007}
    {Education 3}
    {University 3}
    \educationGrade{Subject 1}{90/100}
    \educationGrade{Subject 2}{88/100}
    \educationGrade{Subject 3}{97/100}
    \educationGrade{Subject 4}{94/100}
    \educationGrade{Subject 5}{95/100}

The third \educationItem demonstrates a longer entry which (I believe) justifies the use of multirow... without multirow I get something like this (note the undesired whitespace between "Education 3" and "Subject 1":

Example of a wide left column.

Any assistance would be greatly appreciated.

  • I'm not sure what the effect you're trying to achieve is. Could you explain a little more what you mean about the column being "muddled" – Seamus Jul 18 '12 at 9:04
  • Why not showing one of those longer entries that would make necessary multirow? In my experience almost every usage of \multirow is unnecessary (there are other solutions, usually). – egreg Jul 18 '12 at 9:30
  • @Seamus Look at the image that I posted. The "2002-2007" on the left is not vertically aligned with the contents of the right column. – Joshua Spence Jul 18 '12 at 12:21
  • @egreg I added an example of why I believe I need multirow – Joshua Spence Jul 18 '12 at 12:28
  • @JoshuaSpence It's aligned with Education 3… What do you want it to align to? Subject 1? – Seamus Jul 18 '12 at 12:51

Just replace

\multirow{\@numRows}{\lwidth}{##1 -- ##2}%


\smash{\parbox[t]{\lwidth}{\raggedright ##1 -- ##2}}%

so that this entry won't contribute to the row height. It may be a problem when the right part is shorter than the left part, but I don't think it can really happen. In that case add dummy \educationGrade{}{} items.

Note. It's quite hard to understand why you're putting the definitions of \educationItemand \educationGrade in the body of the definition of education.

| improve this answer | |
  • Thanks, great... I agree that the \educationGrade definition shouldn't be where it currently is. I suppose I really want it to be nested within the \educationItem command, but could not get this to work. – Joshua Spence Jul 18 '12 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.