XeTeX seems to break headers in Tufte-handout

I get the following messed-up running headers on pages 2 and following when using Tufte-Handout class with fontspec (and therefore XeTeX). The headers repeat the Title and then add a black box.

A lot of errors are thrown up, starting with:

Latex Error: ./MinimalExample.tex:13 Argument of \MakeTextLowercase has an extra }.
Runaway argument?


A minimal document producing this error follows. Thanks for any advice.

\documentclass[nofonts]{tufte-handout}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Adobe Caslon Pro}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Helvetica}
\setmonofont[Scale=MatchLowercase]{Inconsolata}
\usepackage{lipsum}
\title{Problem Document Title}
\author{Author Name}
\date{\today}
\begin{document}
\maketitle
\lipsum[1-10]
\end{document}

• Just for info: the errors do not occur using LuaLaTeX. For use with LuaLaTeX, replace all mapping=tex-text with Ligatures=TeX. Sep 11, 2014 at 20:55
• Good, thanks @PaulGessler: That's a good workaround. I notice that the running headers are now lowercased versions of the title, and not small-caps. Sep 11, 2014 at 21:05
• Yes, I noticed that too. I was looking into why, but had to catch a bus. I'll look into it later this evening if no one else gets to it first. :-) Sep 11, 2014 at 21:06
• I have the same problem with both LuaLaTeX and XeLaTeX, with a smaller document : \documentclass{tufte-handout} \usepackage{lipsum} \title{Lorem Ipsum} \begin{document} \maketitle \lipsum[1-5] \end{document} Feb 13, 2016 at 13:57
• ... and @egreg ’s solution worked for me ! Thanks ! Feb 13, 2016 at 14:14

1 Answer

In tufte-common.def it is said that in case XeLaTeX is used, its features for letter spacing will be used, but the authors forgot to do it, so the soul fallback mechanism is used, which miserably fails.

Fix the definition:

\documentclass[nofonts]{tufte-handout}
\usepackage{fontspec}
\usepackage{ifxetex}
\setmainfont{Minion Pro}
\usepackage{lipsum}

\ifxetex
\newcommand{\textls}[2][5]{%
\begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
}
\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\fi

\title{Problem Document Title}
\author{Author Name}
\date{\today}
\begin{document}
\maketitle

\allcaps{Abcdef}\\
\smallcaps{Abcdef}\\
\textsc{Abcdef}

\lipsum[1-10]
\end{document}


Check the values against compilation with LuaLaTeX.

You can use \ifluatex (from the ifluatex package) in case you want to use LuaLaTeX. If you want code that works for both engines, see Combining \ifxetex and \ifluatex with the logical OR operation

• Thank you very much, egreg! It solves the problem to include your {\ifxetex ... \fi} code in the preamble. I take it this reflects a bug in {tufte-common.def}. I can submit the report, unless a more savvy user can add the code or something. Sep 12, 2014 at 15:08
• Thank you, it seems this helped me as well. What's the status? And, strangely, why did this issue hit my document a few months ago? Sep 22, 2015 at 18:05
• @NikosAlexandris I don't think it has been fixed. Sep 22, 2015 at 19:22
• I hit the same problem with lualatex, and your fix worked. I suggest replacing the \ifxetex by \ifx\ifxetex\ifluatex\else to test for both, together with \usepackage[ifluatex,ifxetex] Feb 13, 2016 at 14:11
• @FrédéricGrosshans I added a reference to the relevant question. That trick is funny, but I can't recommend using it. However, users can choose among several possibilities. Feb 13, 2016 at 14:56