3

With the following code:

\documentclass[a4paper]{report}
\usepackage{multicol}

\begin{document}
\begin{multicols}{2}
\noindent Vediamo un po' di testo a due colonne. Proviamo a cambiar colonna: \columnbreak
\texttt{\textbackslash columnbreak} serve a passare alla colonna successiva, ossia ad inserire un \emph{Column Break}, un'interruzione di colonna, come direbbe Word.
\end{multicols}
\end{document}

I should get a two-column bit of text with one column containing the text up till colonna: and the other one contanining the rest. Trouble is, I'm pretty far from that:

enter image description here

Adding \\ before \columnbreak or substituting \columnbreak with a negative \penalty simply doesn't work either. So what do I do to get from \texttt{\textbackslash columnbreak} on onto column 2? And why is \columnbreak being thus totally ignored?

  • you need to add blank line or and explicit paragraph break (\par) before \columnbreak for it to work – Nico Vecchio Sep 28 '14 at 13:14
  • @dcmst yep, that works. But why do I need that blank line or explicit paragraph break? – MickG Sep 28 '14 at 13:17
  • I was just going to suggest to wait for the appropriate, in-depth, explanation :D – Nico Vecchio Sep 28 '14 at 13:26
  • @dcmst egreg's is longer than mine but it did take him a hole minute longer to write:-) – David Carlisle Sep 28 '14 at 13:27
  • @DavidCarlisle Speaking of slowness, it took me more than both of you to type just a single line comment :D – Nico Vecchio Sep 28 '14 at 13:33
6

This example shows that \columnbreak is obeyed:

\documentclass[a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{multicol}

\begin{document}
\begin{multicols}{2}
\noindent Vediamo un po' di testo a due colonne. Proviamo a cambiar colonna: \columnbreak
\texttt{\textbackslash columnbreak} serve a passare alla colonna successiva, ossia a
inserire un \emph{Column Break}, un'interruzione di colonna, come in altri programmi
di scrittura. Chissà che succede ora qui avendo aggiunto testo.
\end{multicols}
\end{document}

enter image description here

Let's try without the italian option and fontenc, so that the output should be similar to yours

\documentclass[a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{multicol}

\begin{document}
\begin{multicols}{2}
\noindent Vediamo un po' di testo a due colonne. Proviamo a cambiar colonna: \columnbreak
\texttt{\textbackslash columnbreak} serve a passare alla colonna successiva, ossia a
inserire un \emph{Column Break}, un'interruzione di colonna, come in altri programmi
di scrittura. Chissà che succede ora qui avendo aggiunto testo.
\end{multicols}
\end{document}

enter image description here

When \columnbreak appears inside a paragraph, the corresponding penalty is inserted after the line where \columnbreak happens to fall. In both cases it falls in the line containing \texttt{\textbackslash columnbreak}. Changing the input to be

\noindent Vediamo un po' di testo a due colonne. Proviamo a cambiar colonna:\columnbreak
\ \texttt{\textbackslash columnbreak} serve a passare alla colonna successiva, ossia a
inserire un \emph{Column Break}, un'interruzione di colonna, come in altri programmi
di scrittura. Chissà che succede ora qui avendo aggiunto testo.

the penalty is attached to the colon, instead of the backslash and indeed the output is

enter image description here

If you want to add a column break exactly after the colon, though, you should do

\documentclass[a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{multicol}

\begin{document}
\begin{multicols}{2}
\noindent Vediamo un po' di testo a due colonne. Proviamo a 
cambiar colonna:\columnbreak\linebreak
\verb|\columnbreak| serve a passare alla colonna successiva, ossia a
inserire un \emph{Column Break}, un'interruzione di colonna, come in altri programmi
di scrittura. Chissà che succede ora qui avendo aggiunto testo.
\end{multicols}
\end{document}

enter image description here

  • Is there any difference between \` and \linebreak`? – MickG Sep 28 '14 at 13:35
  • @MickG Of course there is! \ just inserts a normal space, \linebreak forces a new line. – egreg Sep 28 '14 at 13:40
  • Sorry, damn markup :). I meant \\ , not \ . I know \ is a space, but \\ is a linebreak, isn't it @egreg? – MickG Sep 28 '14 at 13:42
  • @MickG With \\ you abruptly end a line, with \linebreak it's filled up. – egreg Sep 28 '14 at 13:43
  • "filled up" in what sense? – MickG Sep 28 '14 at 13:47
7

\columnbreak like \vspace and \pagebreak etc if used in horizontal mode inserts itself into a \vadjust node that TeX's paragraph breaker will insert after the current line of text is broken into lines. Only once the \vadjust node contents are interpreted in vertical mode will the underlying penalty affect the column breaking.

In this case the node (just) gets put into the line with your \columnbreak text so has an effect after that line, it is easier to see with more text that id does force a break:

enter image description here

\documentclass[a4paper]{report}
\usepackage{multicol}

\begin{document}
\begin{multicols}{2}
\noindent Vediamo un po' di testo a due colonne. Proviamo a cambiar colonna: \columnbreak
\texttt{\textbackslash columnbreak} serve a passare alla colonna successiva, ossia ad inserire un \emph{Column Break}, un'interruzione di colonna, come direbbe Word.

zzz

zzz

\end{multicols}
\end{document}

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.