# Problems compiling Tufte title page in XeLaTex

I'm not sure why, but I can compile a simple Tufte-style title page using pdfLaTex and Texworks, but the same file chokes in XeLaTex under Texshop.

Where is the error?

First, this MWE compiles:

\documentclass{tufte-book}
\usepackage{lipsum}
\usepackage{geometry}

\geometry{paperheight=9in,paperwidth=6in}

\title{This is a Title}
\author{Me}
\date{Fall 2014}

{\noindent\textbf{#2}\marginnote{#1}\\}{\vspace{0.5cm}}

\begin{document}

\maketitle

\begin{loggentry}{2009-Oct-31}{Snow}
\lipsum[1]
\end{loggentry}

\end{document}


This MWE does not:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass{tufte-book}
\usepackage{geometry}

\geometry{paperheight=9in,paperwidth=6in,right=4.cm,bottom=3.cm}

\title{this is a title}
\author{me}
\date{}

{\noindent\textbf{#2}\marginnote{#1}\\}{\vspace{1.5cm}}

\begin{document}

\maketitle

\chapter*{2014}

\begin{loggentry}{2014-Dec-31}{Party}

Party
\end{loggentry}
\end{document}


I get an error that says, "Argument of \MakeTextUppercase has an extra }. \par 1.19 \maketitle

I can't find the difference, other than XeLaTex and Texshop. Should these make that much of a difference?

• I'm not clear whether you see a difference with MWE 1 versus MWE 2 or whether you see a difference with both MWE 1 and MWE 2 depending on editor and engine. Either way, try to eliminate the possibilities. Try pdfLaTeX in TeXShop and XeLaTeX in TeXWorks, for example. [The editor should not make a difference; the engine may well do.] And if you can reproduce with a single MWE, use that one for your question and remove the other.
– cfr
Sep 20, 2014 at 1:58

It's a bug in the tufte suite. The minimal example

\documentclass{tufte-book}

\title{this is a title}
\author{me}

\begin{document}

\maketitle

\end{document}


also fails when compiled with latex, because with latex and xelatex there's no possibility of using microtype for letterspacing, so tufte-common.def resorts to using soul features. However, \MakeTextUppercase fails with this method.

For XeLaTeX a workaround can be found in my answer to XeTeX seems to break headers in Tufte-handout

\documentclass{tufte-book}

\usepackage{ifxetex}
\ifxetex
\newcommand{\textls}[2][5]{%
}
\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}}}
\usepackage{fontspec}
\fi

\title{this is a title}
\author{me}

\begin{document}

\maketitle

\end{document}


Of course you'll have to define font substitutes for the text fonts; the choice

\ifxetex
\newcommand{\textls}[2][5]{%
}
\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}}}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]
\fi


should produce a quite similar output. The method for choosing the font may be different on your machines, it mostly depends on the installation; so mileage may vary. (Please, ask in comments if the proposed code doesn't work for you.)

Both MWE 1 and MWE 2 compile with pdfLaTeX. Neither MWE 1 nor MWE 2 compiles with XeLaTeX. This is at the command line - the editor is irrelevant.

The following MWE demonstrates the problem:

\documentclass{tufte-book}

\title{this is a title}
\author{me}

\begin{document}

\maketitle

\end{document}


The issue apparently has to do with \MakeTextUppercase which is triggering an error with \maketitle for XeLaTeX but not pdfLaTeX.

Just to clarify, \MakeTextUppercase is provided by textcase. However, I cannot reproduce the error with textcase alone so it has something to do with tufte's usage of it.

This bug is described here. The proposed workaround is to add these to the preamble, after fontspec has been loaded:

  % Set up the spacing using fontspec features