0

This code

\documentclass[12pt]{article}
\usepackage[parfill]{parskip}
\usepackage{multicol}

\widowpenalties 2 9999 9999

\begin{document}
\setlength\baselineskip{4ex plus 2ex minus 2ex}

\begin{multicols}{2}
    A\hrulefill1\newline
    A\hrulefill2\newline
    A\hrulefill3\newline
    A\hrulefill4\newline\par
    B\hrulefill1\newline
    B\hrulefill2\newline
    B\hrulefill3\newline
    B\hrulefill4\newline
    B\hrulefill5\newline\par
\end{multicols}

\end{document}

generates this

enter image description here

The automatic choice for the base line skip values looks odd, because the two columns have almost the same vertical size, but not quite.

Is there a way to achieve vertical justification, so that the last line of the first column in the same vertical position as the last line of the second column?

2

1 Answer 1

1

\newline\par you should never have \\ or \newline at the end of a paragraph. You are forcing a line whch has no text (and underfull box warnings) the two columns do have the same vertical size:

enter image description here

Do not ignore the warnings

Underfull \hbox (badness 10000) in paragraph at lines 11--14


Underfull \hbox (badness 10000) in paragraph at lines 15--19

which was warning about all white lines in each paragraph, and also forcing you to use \widowpenalties 2 as the visible last line was not the last.

It is easier to see what is happening if you have text on the last line of the paragraph, which also removes the warning

\documentclass[12pt]{article}
\usepackage[parfill]{parskip}
\usepackage{multicol}

\widowpenalties 2 9999 9999

\begin{document}
\setlength\baselineskip{4ex plus 2ex minus 2ex}

\begin{multicols}{2}
    A\hrulefill1\newline
    A\hrulefill2\newline
    A\hrulefill3\newline
    A\hrulefill4\newline  xxx\par
    B\hrulefill1\newline
    B\hrulefill2\newline
    B\hrulefill3\newline
    B\hrulefill4\newline
    B\hrulefill5\newline xxx\par
\end{multicols}

\end{document}
2
  • Great! I should probably ask another question, but the source problem is that my text is coming from a command which already ends them with a new line, and I need to eventually split them in paragraphs. Thinking if I should create a new command just for the special case where text comes before a paragraph break. There isn't a way to delete a previously inserted new line, is there?
    – Raphael
    Mar 5 at 17:35
  • 1
    @Raphael in general no, actually in multicols as it is (orignally) in a box register not the main vertical list you could \unskip \and \setbox\lastbox to discard the last line (well unless you are unlucky and multicols moves everything to the main vertical list before you get a chance) but basically the code inserting a final newline is in error and you should fix there Mar 5 at 17:51

You must log in to answer this question.

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