3

I'm attempting my first Latex document. I'm working on a header for some documents at work. Being slightly overwhelmed by the complexity in general of tables, this vertical alignment issue is making things worse.

    \documentclass[11pt]{article}
    \usepackage{geometry,multirow,array}
    \geometry{
    letterpaper,
    total={170mm,257mm},
    left=20mm,
    top=15mm,
    }

    \begin{document}

    \begin{center}
    \begin{tabular}{|m{3cm}|m{6.25cm}|m{6.25cm}|} 
    \hline
    \multirow{6}{3cm}{logo here} & \multicolumn{2}{c|}{ABCDEFGHIJKLMNOPQRSTUVWXYZ} \\ \cline{2-3} 
                                 & & \\ \cline{2-3}
                                 & & \\ \cline{2-3}
                                 & & \\ \cline{2-3}
                                 & & \\ \cline{2-3}
                                 & & \\ 
    \hline
    \end{tabular}
    \end{center}

    \end{document}

The cell with the alphabet in it appears to align text to the top of the cell. My header was much more complex than this, but I broke it down to this. What am I doing wrong?

  • Well with c| as the column specifier (in your \multicolumn) it will align at the top. To align in the middle, you'll probably wanna use m again – Au101 Sep 22 '16 at 18:20
  • '\multicolumn{2}{m{12cm}|}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}' Produces a left/top aligned result. – atomicdad Sep 22 '16 at 18:39
  • I don't really see any difference in the vertical alignment with your minimal example, in fact I'm not sure how there could be, it might be necessary to expand your example to show all the relevant parts. For horizontal centering, for sure, you will need a \centering declaration. You will also need to specify a wide enough cell (12.92 cm in order to account for both 6.25 cm cells you are spanning and the 12 pt gap (6 pt either side) between columns). \multicolumn{2}{m{12.92cm}|}{\centering ABCDEFGHIJKLMNOPQRSTUVWXYZ} Thinking about it, there probably is a better way to do this – Au101 Sep 22 '16 at 18:49
  • \multicolumn{2}{c|}{\multirow{1}{*}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}} strikes me as a good place to start, but it's hard to know without actually seeing what you're trying to build here. But, the c specifier was the reason, since it is top aligned – Au101 Sep 22 '16 at 18:51
2

I'm not sure you are doing anything wrong. tabular has some odd asymmetries with its line spacing (some people migrate to booktabs package as a result). But, one can make manual adjustments. Here I do two things:

  1. I use \addstackgap to pad more vertical space above (and below) the text;

  2. I use \\[-3pt] to negatively adjust the space below the entry.

Here is the MWE.

\documentclass[11pt]{article}
\usepackage{geometry,multirow,array,stackengine}
\geometry{
letterpaper,
total={170mm,257mm},
left=20mm,
top=15mm,
}

\begin{document}

\begin{center}
\begin{tabular}{|m{3cm}|m{6.25cm}|m{6.25cm}|} 
\hline
\multirow{6}{3cm}{logo here} & \multicolumn{2}{c|}{\addstackgap[4pt]{%
  ABCDEFGHIJKLMNOPQRSTUVWXYZ}} \\[-3pt] \cline{2-3} 
                             & & \\ \cline{2-3}
                             & & \\ \cline{2-3}
                             & & \\ \cline{2-3}
                             & & \\ \cline{2-3}
                             & & \\ 
\hline
\end{tabular}
\end{center}

\end{document}

enter image description here

  • I ended up using this solution. I was looking for something simple. This seems to be the path of least resistance. Thank you! – atomicdad Sep 23 '16 at 16:54

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.