I am trying to get my columns to line up on a grid, a task which is sometimes tricky in LaTeX. (See this article for some tips I'm using.)
Everything is working great except this one situation: at the end of my tabularx
environment, TeX is skipping slightly less space than it ought to. Notice how the lines are perfectly aligned until the end of the tabular environment in number 9006, and then a couple of points too high for the remainder of the page:
From my reading of the code, it ought to be inserting a \par
for the empty line, which skips 0pt, then skipping 1\baselineskip
of vertical space at the start of the \itemheading
, resulting in an integral multiple of \baselineskip
vertical space. That's what's happening for the paragraphs that aren't adjacent to tabular environments.
I'm sure that there is some length (\aftertabularxskip
?) that I have failed to set, but I cannot for the life of me find any information on how vertical spacing works before and after a tabular environment, except that tables are treated as boxes, which doesn't help much because it still doesn't explain how the box is sized.
Code for example above (my actual document has a much cleaner set of macros, but I inlined almost all of them for this example to rule out issues with the macros):
% I'm using memoir for this document, but the same issue occurs if
% using the book class and the tabularx package
\documentclass[openany, letter]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{mathpazo}
% the following three lines don't change the problem, it's just easier to see the issue when the page is formatted
\usepackage[inner=1.3in, outer=1.2in, top=54pt, bottom=71pt, columnsep=12pt, headsep=10pt, headheight=12pt, marginparwidth=0.6in, marginparsep=0.2in, heightrounded=true]{geometry}
\usepackage[colaction]{multicol}
\setlength\columnseprule{0.5pt}
\renewcommand\bigskip{\vspace{1\baselineskip}}
\lineskip=0pt
\lineskiplimit=-10pt
\topskip=1\baselineskip
\setlength{\parskip}{0.0pt}
\setlength{\parindent}{15pt}
\newcommand\itemheading[1]{\vspace*{1\baselineskip}\noindent\textbf{#1}\enspace}
\usepackage{lipsum}
\begin{document}
\begin{multicols}{2}
\itemheading{9000}%
\lipsum[1]
\itemheading{9001}%
\lipsum[2]
\itemheading{9002}%
\lipsum[3]
\itemheading{9003}%
\lipsum[4]
\itemheading{9006}\bigskip
\noindent \begin{tabularx}{\linewidth}{r >{\raggedright\arraybackslash}X}
%\setlength{\extrarowheight}{0pt}
%\setlength{\extratabsurround}{0pt}
%\setlength{\aboverulesep}{0pt}
%\setlength{\belowrulesep}{0pt}
\emph{X}: & ``This is some test text.''\\
\emph{Y}: & ``This is some more test text.''\\
\emph{Z}: & ``This is even more test text.''\\
\end{tabularx}
\itemheading{9007}%
\lipsum[5]
\end{multicols}
\end{document}
Edit: If it's helpful, I made an interesting discovery: the problem does not occur if only one or two lines are present in the tabularx
environment. It occurs with three or more, and the error is different depending on how many lines there are. And with four or more, an incorrect amount of space is inserted at the top, too.
\showoutput
you will see that you are getting\lineskip
rather than\baselineskip
spacing which always loses grid allignment.\lineskip
spacing” – there are\lineskip
's in the output, but they are all 0 (because I set it to 0 in the preamble).\lineskip
to 0pt but the fact that they are used means that tex can not maintain baselineskip spacing (as that is the only time lineskip is used) note a tabular is vertically centered so has large height and depth