PhelypeOleinik / lipsum

150 paragraphs of Lorem ipsum dummy text for LaTeX
12 stars 7 forks source link

Text misaligned with \twocolumn iin single-col document #4

Closed urrameu closed 3 years ago

urrameu commented 3 years ago

Hi,

Using \twocolumn in a single-column document completely messes up the text alignment of subsequent lipsum text. A MWE:

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\twocolumn
\lipsum
\end{document}

I tried (1) adding some manual text before \lipsum, (2) \twocolumn[blah], (3) the nopar option, (4) \unpacklipsum + \lipsumexp, and (5) messing with \SetLipsumParListItemStart & friends; the problem always persists. Very weird!

lipsum-twocolumn-bug.pdf

PhelypeOleinik commented 3 years ago

Misalignment? Are you talking about the bad line breaks, like these:

path867

If so, then this is a duplicate of #2, which for mortal men means “Add an option to use Latin hyphenation patterns”. Something like \usepackage[latin]{babel} or, if you don't want your entire document in Latin:

\documentclass{article}
\usepackage{babel} % load babel with other languages here
\usepackage{lipsum}
\begin{document}
\twocolumn
\begin{otherlanguage}{latin}
\lipsum
\end{otherlanguage}
\end{document}
urrameu commented 3 years ago

Yes, the problem is the bad linebreaks, but they are not caused by the lack of hyphenation patterns: this problem does not occur if you use the twocolumn class option.

A slightly modified MWE:

\documentclass
%[twocolumn]
{article}
\usepackage[left=160pt,right=160pt]{geometry}
\usepackage{lipsum}

\begin{document}
\twocolumn
\lipsum[1-3]
\end{document}

If you disable the \twocolumn and enable the [twocolumn] line, you should get the same document, but that is not the case. With the class option, there is some bad spacing, but the text is perfectly justified and nothing from the left column overlaps the right.

The attached pdf includes both versions. lipsum-twocolumn-bug-bad-and-good.pdf

u-fischer commented 3 years ago

the twocolumn class options activates beside \twocolumn also \sloppy, and this changes the line breaking. That's not related to the lipsum package.

PhelypeOleinik commented 3 years ago

@urrameu The twocolumn option is not exactly equivalent to the \twocolumn command. Your example makes them look much more alike because you force the margins by using geometry, but the option twocolumn does a lot more than just split the text area into two columns (which is more or less what the command \twocolumn does). As Ulrike said, the option twocolumn does also \sloppy, so adding \sloppy to the \twocolumn version or adding \fussy to the twocolumn (option) version makes both have the same output.

Regardless, this is unrelated to lipsum because you can get the same line breaks by writing the Lorem Ipsum text directly into the document (or with any other text).