CTeX-org / ctex-kit

Macro Packages and Scripts for Chinese TeX users
965 stars 124 forks source link

ctxdoc: update patch for `\MakeUppercase ` [ci skip] #670

Closed muzimuzhi closed 11 months ago

muzimuzhi commented 11 months ago

Since LaTeX2e 2022-11-01, full expansion of \MakeUppercase{<text>} has been changed from \MakeUppercase {<text>} (single space in csname) to \MakeUppercase []{<text>} (three spaces in csname).

Then LaTeX2e 2023-06-01 improved it to be \MakeUppercase []{{... <text> ...}}.

The macro prefixes are kept and the extra group is restored for both versions.

See


ctxdoc.cls skips \MakeUppercase applied to section marks by letting (the full expansion form of) \MakeUppercase to the identity macro locally in \@thehead, so one can safely use

% \def\LuaLaTeX{\hologo{LuaLaTeX}}
\section{\LuaLaTeX{} ...}

But since LaTeX2e 2022-11-01, the full expansion form of \MakeUppercase has changed. This makes the existing patch no longer in effect, which resulting in the problem mentioned in #668: building ctex.pdf from ctex.dtx throws error(s)

! Package hologo Error: Unknown logo `LUALATEX'.

This PR extends the patch for \MakeUppercase to make the doc compile again.

muzimuzhi commented 11 months ago

An example to test (play with), since currently CI doesn't cover doc generation.

\documentclass{article}
\usepackage{etoolbox}

\makeatletter
\ifcsdef{MakeUppercase\space\space\space}
  {\preto\@thehead
    {\protected\long\csdef{MakeUppercase\space\space\space}[#1]#2{{#2}}}}
  {\preto\@thehead
    {\protected\long\csdef{MakeUppercase\space}#1{{#1}}}}
\makeatother

\pagestyle{headings}

\begin{document}
\section{Lua\LaTeX{}}
content
\end{document}

image