# Inconsistent letterspacing (interword space) in pdflatex vs lualatex

In my documents I prefer text in small- and all-caps to be letter spaced. To that end I am using the letterspacing capabilities of the microtype package. Until now (with version 2.5 of microtype) I used to get the exact same result when the text was typeset in the same font via the pdflatex and lualatex engine, but after the update to latest version of microtype (2.6) I noticed that while the tracking between characters is the same in both engines, the interword space is not adjusted when the document is run with lualatex, giving a less readable and pleasing result, especially in all-caps text. I have tested many fonts that I have available in both opentype and type1 format and the behaviour is consistent. The problem is illustrated in the following images (using the freely available libertine font):

An MWE is provided as well:

\documentclass[12pt,crop]{standalone}
\usepackage{ifluatex}
\ifluatex
\usepackage{luatex85}
\else
\usepackage[utf8]{inputenc}
\fi
\usepackage{libertine}
\usepackage{letterspace}
%\usepackage{microtype}
\usepackage{textcase}
\def\allcapsspacing{}
\def\smallcapsspacing{}
\renewcommand{\allcapsspacing}[1]{\textls*[150]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls*[50]{#1}}
\newcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{#1}}}
\newcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\begin{document}
Stop \smallcaps{Stealing Sheep} Stop \allcaps{Stealing Sheep}\par
\end{document}


Does anybody have an idea why it happens and/or how I could get a similarly adjusted interword space, while not having to adjust it manually (via \spaceskip) or to rely on fontspec's \LetterSpace command? Possibly related: this post and this post

• I'm not sure what's happening here. I tested not loading the letterspace and the textcase packages, and tuning the microtype options, but with no avail. My hunch is that different fonts are being loading in each case. Using pdffonts (from poppler), in the PDFLaTeX case, I find that the "TKDTHA+LinLibertineT (Type 1)" font is being loaded; in the LuaLaTeX case, I get two fonts: "VLTBVA+LinLibertineO CID Type 0C Identity-H" and "PHHVVI+LinLibertineO CID Type 0C Identity-H". – NVaughan Jul 5 '16 at 21:52
• @NVaughan: Thanks for having a look. According to my understanding the font LinLibertineT is just the type 1 (.pfb file) version of LinLibertineO (opentype otf), hence the letter T. I do not think that the problem is font specific because it happens with every font I tried (e.g. FiraSans), but rather engine specific and perhaps something in the inner workings of luaotfload and the way letterspacing is implemented there. Unfortunately, my lua skills are limited to be able to elaborate on that :-( – Thanasis Jul 8 '16 at 19:17

I see the same issue when using the Lucida OpenType fonts with LuaLaTeX, as well as with the Libertine fonts. There's another thread that gets into the fine details of what appears to be a small issue in LuaTeX. I found that I could gain control in LuaLaTeX by using Microtype's commands to adjust interword spacing, e.g.:

\SetTracking[
spacing = {500*,100*,}, % choose values you like
outer kerning = {*,*}
]
{encoding = *}
{ 50 }  % choose a value you like


and then invoking \textls{\scshape{Stop stealing sheep!}. Microtype without manually increased interword the spacing seems to leave too little space between words when the interletter spacing is made rather large (e.g., 200/1000 em for some heading text).

• Thank you for your answer. I did make some progress playing around with the settings, but the result is still not as desired. Using the \SetTracking command, applies the setting on top of the argument of \textls*[]{}. I will have a closer, more rigorous look and post again. I am accepting this as an answer for now. Thanks again. – Thanasis Aug 20 '17 at 14:48

The correct behaviour in LuaTeX's letterspacing/tracking seems to have returned with the most recent version of luaotfload (v2.96 2019/02/14). From the documentation:

In version 2.95 letterspacing was broken due to a change in the fontloader (issue 38). This has been repaired. At the same time a number of oddities and bugs in the letterspacing has been corrected[...]

The letterspace and microtype packages (from v2.7b 2019/02/28) also behave as expected now.