[Tex/LaTex] Problems compiling Tufte title page in XeLaTex

titlestufte

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}


\newenvironment{loggentry}[2]% date, heading
{\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{}

\newenvironment{loggentry}[2]% date, heading
{\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?

Best Answer

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]{%
    \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}}}
  \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]{%
    \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}}}
  \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.)

Related Question