3

I have a command that works similar to this simplified command:

\newcommand{\revEntry}{#1}{
    #1

    \smallskip
}

In my document I have lots of such entries in a multicolumn environment, and now I see that when such an entry is at a column bottom - and is followed by a \columnbreak, the \smallskip is 'printed' at the end of the page.

How can I make the \smallskip conditional so it is only printed when not at the page/column bottom?


MWE:

\documentclass{article}
\usepackage{multicol}
\newcommand{\test}{
    Test command.

    \bigskip
}

\begin{document}

\begin{multicols}{3}
\test
\test

%\unskip
%\vskip-\lastskip
\columnbreak
\test
\test

Test paragraph.

Test paragraph.

Test paragraph.

Test paragraph.

Test paragraph.

\end{multicols}
\end{document}

enter image description here

As you can see at the end of the first column where I have the manual column break the \bigskip is 'printed'.

Using \unskip as suggested results in 'You can't use \unskip in vertical mode', the other solution with negative \lastskip doesn't have any effect. Maybe because the skip is 'hidden' inside the macro?

2

The problem with \vskip-\lastskip is that there are two vertical skips here, one from the paragraph break and one from the \smallskip.

You can avoid this by using those two commands:

\newcommand\mybigskip{\addvspace\bigskipamount}
\newcommand\mycolumnbreak{\vskip-\lastskip\columnbreak}

\addvspace is an internal LaTeX command which will make sure a previous vertical space is "undone".

enter image description here

  • Unfortunately this doesn't work. But I've added a MWE. – uli_1973 Nov 24 '13 at 19:05
  • I will look into it. I managed to achieve what I want with the first version of this answer. I'm going to see if I first did something wrong or if something is wrong with one of my LaTeX's – uli_1973 Nov 25 '13 at 12:56
  • Your original solution with \newcommand{\mycolumnbreak}{\unskip\unskip} did work too. But only when there is no empty line (paragraph) between \test and \mycolumnbreak. Otherwise I get an error about \unskip not allowed in vertical mode.. So this solution is cleaner and more robust. Thanks. – uli_1973 Nov 26 '13 at 12:02
  • @uli_1973 Sorry for creating confusion with my first solution attempt. I was under the (false) impression that typesetting in multicols does not happen on the main vertical list. And my own test file went through, so I did not suspect. I asked in the chat for explanation and was pointed to a deeper discussion of the subject (which btw. contains a link to a question similar to yours :-) – Stephan Lehmke Nov 26 '13 at 12:23
  • OK. I'll try to remember the second solution. But I got my document to work with the first version, and I won't fiddle around with it anymore, now that I've uploaded it to the printer ;-) (Actually this issue popped out at the very last moment before publication. Of course I wanted to manually fix column breaking in my list only after any proof-reading itself was finished so I never noticed the issue before ... – uli_1973 Nov 26 '13 at 15: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.