Tufte-LaTeX / tufte-latex

A Tufte-inspired LaTeX class for producing handouts, papers, and books
https://tufte-latex.github.io/tufte-latex/
1.69k stars 301 forks source link

xelatex and tufte-book #180

Open hvoss49 opened 1 year ago

hvoss49 commented 1 year ago

With the current version you'll get an error with \MakeTextUppercase. The packahe textcase shoudn't be loaded anymore.

\documentclass{tufte-book}
%\usepackage{pstricks}
\title{Test title}
\begin{document}

foo
%\begin{pspicture*}(-1,-1)(2,1)
%\psline[linewidth=1pt](0,0)(1,0)
%\end{pspicture*}

\end{document}

Running with xelatex:

[...]
*geometry* driver: auto-detecting
*geometry* detected driver: xetex

Package bibentry Warning: You have used \nobibliography* 
(bibentry)                without a following \bibliography.
(bibentry)                You may not be able to run BibTeX.

! Argument of \MakeTextLowercase  has an extra }.
<inserted text> 
                \par 
l.11 \end{document}

The following changes to tufte-common.def (TL23) fixes it:

bash-3.2$ diff -u tmp/tufte-common.def `kpsewhich tufte-common.def`
--- tmp/tufte-common.def    2015-06-23 23:33:16
+++ /usr/local/texlive/2022/texmf-dist/tex/latex/tufte-latex/tufte-common.def   2023-10-18 11:00:40
@@ -656,11 +656,11 @@

 \DeclareTextFontCommand{\textsmallcaps}{\scshape}

-\RequirePackage{textcase} % provides \MakeTextUppercase and \MakeTextLowercase
+%\RequirePackage{textcase} % provides \MakeTextUppercase and \MakeTextLowercase
 \def\allcapsspacing{\@tufte@warning{Proper spacing of ALL-CAPS letters has not been set up.}}
 \def\smallcapsspacing{\@tufte@warning{Proper spacing of small-caps letters has not been set up.}}
-\newcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{#1}}}
-\newcommand{\smallcaps}[1]{\smallcapsspacing{\MakeTextLowercase{#1}}}
+\newcommand{\allcaps}[1]{\expandafter\allcapsspacing\expandafter{\MakeUppercase{#1}}}
+\newcommand{\smallcaps}[1]{\expandafter\smallcapsspacing\expandafter{\MakeLowercase{#1}}}

 % If we're using pdfLaTeX v1.40+, use the letterspace package. 
 % If we're using pdfLaTex < v1.40, use the soul package.
@@ -703,8 +703,8 @@
   \sodef\allcapsspacing{}{0.15em}{0.65em}{0.6em}%
   \sodef\smallcapsspacing{}{0.075em}{0.5em}{0.6em}%
   \sodef\sotextsc{\scshape}{0.075em}{0.5em}{0.6em}%
-  \renewcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{##1}}}%
-  \renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{##1}}}%
+  \renewcommand{\allcaps}[1]{\allcapsspacing{\MakeUppercase{##1}}}%
+  \renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeLowercase{##1}}}%
   \renewcommand{\textsc}[1]{\sotextsc{##1}}%
 }

@@ -714,8 +714,8 @@
   % Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
   \renewcommand{\allcapsspacing}[1]{\textls[200]{##1}}%
   \renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}%
-  \renewcommand{\allcaps}[1]{\allcapsspacing{\MakeTextUppercase{##1}}}%
-  \renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{##1}}}%
+  \renewcommand{\allcaps}[1]{\allcapsspacing{\MakeUppercase{##1}}}%
+  \renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeLowercase{##1}}}%
   \renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{##1}}}%
 }

@@ -756,8 +756,8 @@
         %% Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
         %\renewcommand{\allcapsspacing}[1]{\textls[200]{##1}}
         %\renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}
-        %\renewcommand{\allcaps}[1]{\textls[200]{\MakeTextUppercase{##1}}}
-        %\renewcommand{\smallcaps}[1]{\smallcapsspacing{\MakeTextLowercase{##1}}}
+        %\renewcommand{\allcaps}[1]{\textls[200]{\MakeUppercase{##1}}}
+        %\renewcommand{\smallcaps}[1]{\smallcapsspacing{\MakeLowercase{##1}}}
         %\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{##1}}}
       %}{% microtype failed, check for soul
         %\@tufte@debug@info@noline{Modern version of pdfTeX detected, but `letterspace' package not installed.  Reverting to  `soul' package for letterspacing}