15

I was just messing around in LaTeX with the libertine and libertinus packages, and noticed that switching from LaTeX to XeLaTex to LuaLaTeX all produced PDFs that were mostly the same length, except spacing in paragraphs slightly changed.

What is causing this? Is there any “correct” output?

At first I thought it had to do with the fact that libertinus switches from Type 1 encoding with pdfLaTeX and OpenType with XeLaTeX/LuaLaTeX (not sure if libertine works in the same way), but even the outputs from XeLaTeX and LuaLaTeX are different.

\documentclass{turabian-researchpaper}
\usepackage{biblatex-chicago}
\usepackage{turabian-formatting}
\usepackage[pass,letterpaper]{geometry}
\usepackage{libertine} % or libertinus %

\begin{document}

Afraid of intimacy, we use technology to remove ourselves from the real world because we
believe more will listen to us when we are online. The internet and our phones become an
addiction that is hard to break. Although our technological habits change our personal
relationships for the worst, we continue the cycle of needing to text or post to social
media to feel validated. We have been blinded by our own emotions into thinking we need to
be online so we don't have to self-reflect, even though the situation is the opposite. This
is extremely harmful to our social skills, and we form habits that, before technology, most
would have called awkward or antisocial. We sit with our friends without interacting. We go
to cafés alone to do nothing but text. We spew hateful comments online through the barrier
of anonymity. However, the habit of checking your phone, posting to social media, and
commenting on content is extremely hard to break and needs patience and the willingness to
take breaks often. Technology does not need to always be wasting resources in the back of
your mind.
\footnote{Before you start an unrelated argument, I'm not actually anti-technology like
this might suggest. This was an essay written to appease an English teacher.}

\end{document}

Sorry if this isn't minimal enough. I couldn't find a way reproduce the issue without these words and packages.

This GIF demonstrates the differences between pdfLaTeX, XeLaTeX, and LuaLaTeX. The different spacing produced by the different TeX engines.


(Added by David Carlisle) test file just using article class but the same width and font settings as in the original example, it shows the same three output variants for pdf/xe/lua latex as the original but has less dependencies so a bit easier to trace (perhaps)

\documentclass[12pt]{article}


\usepackage{libertine} % or libertinus %

\setlength\textwidth{469.755pt}
\setlength\parindent{36.135pt}
\addtolength\oddsidemargin{-1cm}

\begin{document}

\typeout{\the\font}
\typeout{\the\fontdimen2\font} % space
\typeout{\the\fontdimen3\font} % stretch
\typeout{\the\fontdimen4\font} % shrink
\typeout{\the\fontdimen7\font} % punct

Afraid of intimacy, we use technology to remove ourselves from the real world because we
believe more will listen to us when we are online. The internet and our phones become an
addiction that is hard to break. Although our technological habits change our personal
relationships for the worst, we continue the cycle of needing to text or post to social
media to feel validated. We have been blinded by our own emotions into thinking we need to
be online so we don't have to self-reflect, even though the situation is the opposite. This
is extremely harmful to our social skills, and we form habits that, before technology, most
would have called awkward or antisocial. We sit with our friends without interacting. We go
to cafés alone to do nothing but text. We spew hateful comments online through the barrier
of anonymity. However, the habit of checking your phone, posting to social media, and
commenting on content is extremely hard to break and needs patience and the willingness to
take breaks often. Technology does not need to always be wasting resources in the back of
your mind.


\end{document}
  • 4
    unrelated but you shouldn't have that linebreak before the footnote or you could get a linebreak before the footnote marker – David Carlisle Sep 7 '18 at 8:14
  • @DavidCarlisle Yeah, I made a lot of changes while hastily writing that code to make it easier to read. Originially the footnote was right at the end of the last sentence. Thanks, though. Didn't realize that could happen. – RCCN Sep 7 '18 at 18:26
  • 1
    Another unrelated note on your initial example using the turabian-formatting package: you don't need to (nor should you) specify \usepackage{turabian-formatting}. Simply loading the turabian-researchpaper document class will create a turabian-formatted research paper. – Omar Sep 10 '18 at 1:06
15

If you add

\typeout{\the\font}
\typeout{\the\fontdimen2\font} %space
\typeout{\the\fontdimen3\font} %stretch
\typeout{\the\fontdimen4\font} % shrink
\typeout{\the\fontdimen7\font} % punct

after \begin{document} then you will find

pdftex

\OT1/LinuxLibertineT-TLF/m/n/12 
3.0pt
1.5pt
0.99959pt
0.5004pt

xetex

\TU/LinLibertine(0)/m/n/12 
3.0pt
1.5pt
1.0pt
1.0pt

luatex

\TU/LinLibertine(0)/m/n/12 
3.0pt
1.5pt
1.0pt
1.0pt

Note that fontdimen7 (extra space after punctuation) ends up twice as large in the OpenType font as in the tfm metrics used by pdftex. I note the libertinus font suport had an update yesterday in texlive this is with the latest version of that package (and a development build of luatex 1.09) running over texlive 2018.

So the big difference between pdftex and the others is not surprising, it's harder to see an obvious reason for a difference between luatex and xetex other than luatex explicitly documents that it uses a variant hyphenation algorithm that doesn't always choose the same points even using the same patterns.

  • hmm actually hyphenation points chosen for luatex and xetex are same but line breaks are still different, I may look again later and add to this answer. – David Carlisle Sep 7 '18 at 8:26
  • Something to do with microtypography? XeTeX is more limited there ... – Joseph Wright Sep 7 '18 at 8:26
  • Without the extra packages in OP's example, XeLaTeX/LuaLaTeX with linertinus give same output (to the eye) which is almost same as PDFLaTeX except for the footnote marker going to next line with XeLaTeX/LuaLaTeX. – user4686 Sep 7 '18 at 8:46
  • 2
    @jfbu I added an article class example to the question – David Carlisle Sep 7 '18 at 15:54
  • 2
    @MarkBoltz it's quite possible that the difference isn't intended to be that big, if I can work out why lualatex has changed the line breaking from xetex (using the same fonts) I may ask the font maintainers if the type1 and OTF metrics are supposed to be more similar.... – David Carlisle Sep 7 '18 at 18:55

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.