2

Problem: I'm getting unwanted blank lines at seemingly random locations in my document for no obvious reason.

Background: I'm creating a collection of short stories translated from various languages using the book document class. I need to use xelatex so I can directly enter foreign language characters. I want facing translations, so I'm using the paracol environment with polyglossia to ensure proper hyphenation of the foreign languages.

I use the \switchcolumn command to synchronize all my paragraph breaks and this occasionally leads to blank lines in one column or the other (normal behavior!) when one paragraph is longer or shorter than its translation. However, I occasionally observe unwanted blank lines that run across both columns at a synchronized paragraph break.

This is actually a seldom occurrence (maybe 15 examples in a 90 page document) but is completely unacceptable for a professional looking document. It appears to happen at random locations; making small changes that affect the flow of the text (e.g., inter-column separation, margins, adding a footnote, etc.) will mysteriously remove most of the unwanted blank lines, but create new ones somewhere else in the text!

I'm not sure the culprit is really paracol (although maybe it is?) or perhaps some interaction with between polyglossia and paracol (I have to enclose the foreign language text in tags to ensure correct hyphenation). However, this seems unlikely because the whole point of paracol is for typesetting facing translations, so I would assume many people are using paracol and polyglossia together successfully. I feel like there must be some default glue or some badness flag that I need to adjust to prevent this from happening, but I'm not expert enough to know what it is... Are there any paracol users out there who have seen this and know how to fix it?

I have attached an (annotated) image below as well as an attempt at a minimal code example. I couldn't remove the custom font or other details like margins because that changes the flow of the text and removes the artifact that I'm trying to demonstrate (changing font size, etc. will do the same). However, mucking with little details like this isn't a real solution because it simply produces other blank lines somewhere else in my (currently) 90 page document.

% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
% this allows us to use real characters like æ instead of macros like \ae

%% PREAMBLE
\documentclass[letterpaper,titlepage,twoside,openany,12pt]{book}

%provide standard TeX shortcuts
\usepackage{xunicode}
%extra customizations for XeLateX
\usepackage{xltxtra}

%easier methods for loading fonts and specifying font features
\usepackage{fontspec}
%Use Junicode for access to runes and other nice medieval features
\setmainfont[Language=Icelandic, Fractions=On]{Junicode}

%replaces babel - extra language support 
%I use this primarily to get proper hyphenation in the other languages
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\setotherlanguages{icelandic,danish,norsk}

%Customize some margions and other lengths
\usepackage{geometry}
%Although shifted even/odd margins look nice for two sided
%printing, it's distracting when viewing the PDF.
\geometry{outer=1.1in,inner=1.1in}
\geometry{bindingoffset=0cm,hratio=1:1}
%the default bottom margin is huge, make it a bit smaller
\addtolength{\textheight}{0.75in}

%setup the parallel columns
\usepackage{paracol} %this seems a little easier to use?
\footnotelayout{p} %full page footnotes
\setlength{\columnsep}{30 pt} %larger space between the columns

%try to prevent overfull hbox from sticking words out into the margin
%pretolerance relates to avoiding hyphenation and is used first 
%Note, -1 = ignore first step and use hyphenation
\pretolerance=100        %default=100
%after hyphenating, tolerance is used
%hbadness sets the threshold for seeing underfull errors
\tolerance=400        %default=200
\hbadness=399        %best set at tolerance-1
%if that still fails, emergency stretch is used
\setlength{\emergencystretch}{0.5em}    %default=0
%if all of this fails, we get words sticking out into the margin (overfull hbox)

\begin{document}
    \mainmatter

    \chapter[A Sleigh Ride]{A Sleigh Ride --- En Slædefart}
    \begin{paracol}{2}

    \switchcolumn[0]*
    \noindent
        Once upon a time, in a kingdom far far away (so far away that no one knows
        its name) there was a king who had an only child, a daughter.  She was so
        sullen and gloomy that no one had ever seen her laugh.  She was a grown
        woman, very pretty and kind, but always sad and never happy --- either she
        cried or she sulked.  It was impossible to make her smile.

    \switchcolumn
    \begin{danish}
    \noindent
        Der var engang en Konge i et Land langt langt borte, som der er ingen, der
        ved Navn paa; han havde kun en eneste Datter.  Hun var saa sum og saa sur,
        at der var aldrig nogen, der havde set hende le.  Hun var nu en voksen Pige
        og en køn Pige og en rar Pige, men altid var hun sorrigfuld og aldrig glad;
        enten græd hun eller ogsaa surmulede hun.  Det var ikke til at slaa et Smil
        af hende med en Vognkæp.
    \end{danish}

    \switchcolumn*
        The king was generally a cheerful man and very capable, but this problem
        with his daughter weighed on his heart until he became cross and
        ill-content.  She was his only child and she was supposed to inherit the
        kingdom after him.  But all she did was cry and sulk until he was afraid
        that she would die before him.

    \switchcolumn
    \begin{danish}
        Kongen var ellers en glad Mand og en meget dygtig Konge; men dette med
        Datteren gik ham svært til Hjærte, saa han blev helt gnaven og ilde
        tilfreds.  Han havde jo kun det samme Barn, og hun skulde arve Riget efter
        ham; men nu gik hun der og græd og mulede, saa han var bange for, hun
        skulde gaa hen og dø før ham.
    \end{danish}

    \switchcolumn*
        So the king sent out a proclamation, that whoever could make his daughter 
        laugh would receive her hand in marriage and become the king after he died.
        There were many who came and made the attempt, but not a single one of them
        could get so much as a smile out of her.  They simply made fools of
        themselves twice: first, when they tried to make the princess laugh, and
        then, when they rode home again in failure.

    \switchcolumn
    \begin{danish}
        Saa lod Kongen udgaa den Befaling, at hvem der kunde faa hans Datter til at
        le, han skulde faa hende til Kone og være Konge i Landet efter ham.  Og der
        var mange, som kom og prøvede paa det; men der var aldrig nogen, der kunde
        lokke saa meget som et Smil af hende.  De gjorde sig saa til Nar to Gange:
        først for at faa hende til at le, og siden, naar de maatte rejse hjem igen
        med en lang Næse.
    \end{danish}

    \end{paracol}
\end{document}

Unwanted blank line below both second paragraphs

1

The first space is due to the fact that the English paragraph is shorter than the corresponding Danish one. The second space is due to the fact that, to TeX's eyes, the Danish paragraph ending with “før ham.” is one line longer, because the space between før ham. and \end{danish} is not removed.

The first blank line can be removed by adding \looseness=1 to the first English paragraph (but this is not guaranteed to work).

Instead of danish, use danishpar with the definition I suggest.

Note that you should load neither xunicode (it's already loaded by fontspec at the right time) nor xltxtra that adds nothing useful. I'm not sure of the value of \tolerance, nor about the setting of \textwidth: use geometry for everything related to the pagination.

% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
% this allows us to use real characters like æ instead of macros like \ae

%% PREAMBLE
\documentclass[letterpaper,titlepage,twoside,openany,12pt]{book}

%easier methods for loading fonts and specifying font features
\usepackage{fontspec}
%Use Junicode for access to runes and other nice medieval features
\setmainfont[Language=Icelandic, Fractions=On]{Junicode}

%replaces babel - extra language support 
%I use this primarily to get proper hyphenation in the other languages
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\setotherlanguages{icelandic,danish,norsk}

%Customize some margions and other lengths
\usepackage{geometry}
%Although shifted even/odd margins look nice for two sided
%printing, it's distracting when viewing the PDF.
\geometry{outer=1.1in,inner=1.1in}
\geometry{bindingoffset=0cm,hratio=1:1}
%the default bottom margin is huge, make it a bit smaller
\addtolength{\textheight}{0.75in}

%setup the parallel columns
\usepackage{paracol} %this seems a little easier to use?
\footnotelayout{p} %full page footnotes
\setlength{\columnsep}{30 pt} %larger space between the columns

%try to prevent overfull hbox from sticking words out into the margin
%pretolerance relates to avoiding hyphenation and is used first 
%Note, -1 = ignore first step and use hyphenation
\pretolerance=100        %default=100
%after hyphenating, tolerance is used
%hbadness sets the threshold for seeing underfull errors
\tolerance=400        %default=200
\hbadness=399        %best set at tolerance-1
%if that still fails, emergency stretch is used
\setlength{\emergencystretch}{0.5em}    %default=0
%if all of this fails, we get words sticking out into the margin (overfull hbox)

\newenvironment{danishpar}
 {\par\danish}
 {\par\enddanish}


\begin{document}

    \mainmatter

    \chapter[A Sleigh Ride]{A Sleigh Ride --- En Slædefart}
    \begin{paracol}{2}

    \switchcolumn[0]*
    \noindent\looseness=1
        Once upon a time, in a kingdom far far away (so far away that no one knows
        its name) there was a king who had an only child, a daughter.  She was so
        sullen and gloomy that no one had ever seen her laugh.  She was a grown
        woman, very pretty and kind, but always sad and never happy --- either she
        cried or she sulked.  It was impossible to make her smile.

    \switchcolumn
    \begin{danishpar}
    \noindent
        Der var engang en Konge i et Land langt langt borte, som der er ingen, der
        ved Navn paa; han havde kun en eneste Datter.  Hun var saa sum og saa sur,
        at der var aldrig nogen, der havde set hende le.  Hun var nu en voksen Pige
        og en køn Pige og en rar Pige, men altid var hun sorrigfuld og aldrig glad;
        enten græd hun eller ogsaa surmulede hun.  Det var ikke til at slaa et Smil
        af hende med en Vognkæp.
    \end{danishpar}

    \switchcolumn*
        The king was generally a cheerful man and very capable, but this problem
        with his daughter weighed on his heart until he became cross and
        ill-content.  She was his only child and she was supposed to inherit the
        kingdom after him.  But all she did was cry and sulk until he was afraid
        that she would die before him.

    \switchcolumn
    \begin{danishpar}
        Kongen var ellers en glad Mand og en meget dygtig Konge; men dette med
        Datteren gik ham svært til Hjærte, saa han blev helt gnaven og ilde
        tilfreds.  Han havde jo kun det samme Barn, og hun skulde arve Riget efter
        ham; men nu gik hun der og græd og mulede, saa han var bange for, hun
        skulde gaa hen og dø før ham.
    \end{danishpar}

    \switchcolumn*
        So the king sent out a proclamation, that whoever could make his daughter 
        laugh would receive her hand in marriage and become the king after he died.
        There were many who came and made the attempt, but not a single one of them
        could get so much as a smile out of her.  They simply made fools of
        themselves twice: first, when they tried to make the princess laugh, and
        then, when they rode home again in failure.

    \switchcolumn
    \begin{danishpar}
        Saa lod Kongen udgaa den Befaling, at hvem der kunde faa hans Datter til at
        le, han skulde faa hende til Kone og være Konge i Landet efter ham.  Og der
        var mange, som kom og prøvede paa det; men der var aldrig nogen, der kunde
        lokke saa meget som et Smil af hende.  De gjorde sig saa til Nar to Gange:
        først for at faa hende til at le, og siden, naar de maatte rejse hjem igen
        med en lang Næse.
    \end{danishpar}

    \end{paracol}
\end{document}

enter image description here

You can see that the last Danish paragraph is shorter than the corresponding English one, you may want to add \looseness=1 also for it. However, in both cases an underfull line results (badness 463).

  • Defining the new language environments worked! I currently have three languages in my real document and I tested this on the whole 90 page document and all the double-column blank lines are now gone. (A note on the looseness suggestion: depending on how compact certain idioms are, it's impossible to have paragraph lengths match perfectly, so I prefer to avoid looseness=1 as it can produce bad per-line badness.) – S. Burt Aug 23 '15 at 17:06
  • Apparently you can't have multi-paragraph replies to comments (?? I'm still new to stack exchange and markdown...) Anyhow, I was wondering if there were other ways to eliminate the hidden space between the end of the last word and the \end command for the language environment. This solution works great, but it seems kind of heavy-handed. Is there some simpler way to eat or prevent that final space before the \end{language}? – S. Burt Aug 23 '15 at 17:10
  • 1
    @S.Burt \def\enddanish{\unskip} – egreg Aug 23 '15 at 17:14

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.