4

I would like to have a forced line break without having a break in a column, similar to how the //* gives a line break while preventing the page from breaking. Specifically, I would like to be able to do this within the multicol environment. Does anyone know how to do this? Here is a MWE.

\documentclass{article}
\usepackage{multicol}
\usepackage[top=5in,bottom=5in,right=.5in,left=.5in]{geometry}

\begin{document}
\begin{multicols}{2}
\noindent
Line 1\\
Line 2\\
I would like to have this line 3 in the same col as line 2\\
Line 4
\end{multicols}
\end{document}

EDIT: This would be used for a "living" document. Basically, I would want to be able to put this "line break" command anywhere that I would want a line break, and have TeX "know" not to break a column where this command falls, but instead, to extend the length of the column further, perhaps even into the margin at the end. Does anyone know how to do this?

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149

3 Answers3

7

I'm a bit surprised by the question as well as by the answers given so far, because the simple answer is: use \\* it will break break the line while preventing a page break at the same point. This works in the same way inside multicol and outside (or rather in the case where it fails in a normal column it will fail in multicol too).

So in the particular example, using \\* will does exactly what is wanted: line 2 and 3 will stay together and this is not broken by the balancing of multicol either.

Marco Daniel
  • 95,681
5

Use \vfill\columnbreak when you want to break.

MWE

\documentclass{article}
\usepackage{multicol}
\usepackage[top=5in,bottom=5in,right=.5in,left=.5in]{geometry}

\begin{document}
\begin{multicols}{2}
\noindent
Line 1\\
Line 2\\
I would like to have this line 3 in the same col as line 2
\vfill\columnbreak
Line 4
\end{multicols}
\end{document} 

Output

enter image description here


Edit

I'm not sure to understand the request in your edited question, but you probably want to have a look at the paracol package.

Here's an example

\documentclass{article}
\usepackage{paracol}
\usepackage[top=5in,bottom=5in,right=.5in,left=.5in]{geometry}

\begin{document}
\begin{paracol}{2}
\noindent
Line 1\\
Line 2\\
Line 3\\
Line 4\\
Line 5\\
Line 6\\
Line 7\\
Line 8
\switchcolumn
Line 9
\end{paracol}
\end{document} 

Until you issue the command \switchcolumn your lines will be indefinitely in the first column.

karlkoeller
  • 124,410
  • I would like to have it so that there is a line break no matter what, but does not have a column break if such a break would occur. Because I would be using this code for a "living" document, I'm looking for something a little more flexible than this :/ – Abe Schulte Oct 07 '13 at 02:35
  • @AbeSchulte See if the edit can help you. – karlkoeller Oct 07 '13 at 05:53
2

use the star version:

\begin{multicols*}{2}
\noindent
Line 1\\
Line 2\\
I would like to have this line 3 in the same col as line 2\\
Line 4
\end{multicols*}
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
  • I see what you're going for, but I would like to have line 4 in the new column, whereas this code puts everything into the first column :/ – Abe Schulte Oct 07 '13 at 02:33