Quantcast
Channel: What's causing mysterious "Missing \endcsname inserted" error that didn't exist four months ago? - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

What's causing mysterious "Missing \endcsname inserted" error that didn't exist four months ago?

$
0
0

I am running MacTeX 2022 with all updates applied. I have a large project that last built correctly on September 3, 2022. Today I get a mysterious Missing \endcsname inserted error on one particular line and I can't find the reason. Pressing H in the console reveals that a \let control sequence is erroneously inside \csname...\endcsname but there is no \let in my code. The MWE code has been copied and pasted directly from the source project into the MWE .sty and .tex files. The only change was consistently renaming certain variables. The MWE exactly replicates the error.

This code has not been touched since September of 2022 so something in an update since September is the likely culprit. The only things I see that might be related are either use of \MakeUppercase (as I know there have been some recent modifications to that) or in the key handling mechanism. What is causing this error?

EDIT: I need the words alternate, base, and derived to be all lowercase when echoed to the console by typeout but with the first letter capitalized when used to invoke the corresponding macro. That's why I initially used \MakeUppercase which now seems to not work. I can't get \MakeTitlecase to work.

Here is the MWE package file. Name it keymwe.sty.

% !TEX program = lualatexmk% !TEX encoding = UTF-8 Unicode\usepackage{pgfopts}\usepackage{iftex}\RequireLuaTeX\newcommand*{\keymwe@selectunits}{}\newcommand*{\keymwe@selectprecision}{}\newcommand*{\keymwe@selectapproximate}[2]{#1}\newcommand*{\keymwe@selectprecise}[2]{#2}\newcommand*{\keymwe@selectbaseunits}[3]{#1}\newcommand*{\keymwe@selectderivedunits}[3]{#2}\newcommand*{\keymwe@selectalternateunits}[3]{#3}\NewDocumentCommand{\AlwaysUseBaseUnits}{}  {\renewcommand*{\keymwe@selectunits}{\keymwe@selectbaseunits}}%\NewDocumentCommand{\AlwaysUseDerivedUnits}{}  {\renewcommand*{\keymwe@selectunits}{\keymwe@selectderivedunits}}%\NewDocumentCommand{\AlwaysUseAlternateUnits}{}  {\renewcommand*{\keymwe@selectunits}{\keymwe@selectalternateunits}}%\NewDocumentCommand{\AlwaysUseApproximateConstants}{}  {\renewcommand*{\keymwe@selectprecision}{\keymwe@selectapproximate}}%\NewDocumentCommand{\AlwaysUsePreciseConstants}{}  {\renewcommand*{\keymwe@selectprecision}{\keymwe@selectprecise}}%\NewDocumentCommand{\HereUseBaseUnits}{ m }{\begingroup\AlwaysUseBaseUnits#1\endgroup}%\NewDocumentCommand{\HereUseDerivedUnits}{ m }{\begingroup\AlwaysUseDerivedUnits#1\endgroup}%\NewDocumentCommand{\HereUseAlternateUnits}{ m }{\begingroup\AlwaysUseAlternateUnits#1\endgroup}%\NewDocumentCommand{\HereUseApproximateConstants}{ m }{\begingroup\AlwaysUseApproximateConstants#1\endgroup}%\NewDocumentCommand{\HereUsePreciseConstants}{ m }{\begingroup\AlwaysUsePreciseConstants#1\endgroup}%\NewDocumentEnvironment{UseBaseUnits}{}{\AlwaysUseBaseUnits}{}%\NewDocumentEnvironment{UseDerivedUnits}{}{\AlwaysUseDerivedUnits}{}%\NewDocumentEnvironment{UseAlternateUnits}{}{\AlwaysUseAlternateUnits}{}%\NewDocumentEnvironment{UseApproximateConstants}{}{\AlwaysUseApproximateConstants}{}%\NewDocumentEnvironment{UsePreciseConstants}{}{\AlwaysUsePreciseConstants}{}%\newif\ifusingpreciseconstants\pgfkeys{%  /keymwe/options/.cd,  initial@setup/.style={%    /keymwe/options/buffered@units/.initial=alternate,%  },%  initial@setup,%  preciseconstants/.is if=usingpreciseconstants,%  units/.is choice,%  units/.default=derived,%  units/alternate/.style={/keymwe/options/buffered@units=alternate},%  units/base/.style={/keymwe/options/buffered@units=base},%  units/derived/.style={/keymwe/options/buffered@units=derived},%  .unknown/.code={%    \typeout{}%    \typeout{keymwe: You used unknown option '\pgfkeyscurrentname'.}%  },%}%\ProcessPgfPackageOptions{/keymwe/options}\newcommand*{\keymwe@do@setup}{%  \csname AlwaysUse\expanded{\noexpand\MakeUppercase%    \pgfkeysvalueof{/keymwe/options/buffered@units}}Units\endcsname%  \typeout{keymwe: You will get \pgfkeysvalueof{/keymwe/options/buffered@units}\space units.}%  \ifusingpreciseconstants    \AlwaysUsePreciseConstants    \typeout{keymwe: You will get precise constants.}%  \else    \AlwaysUseApproximateConstants    \typeout{keymwe: You will get approximate constants.}%  \fi  \typeout{}%}%\keymwe@do@setup\NewDocumentCommand{\keymwesetup}{ m }%  {%    \IfValueT{#1}%      {%        \pgfqkeys{/keymwe/options}{#1}        \typeout{}%        \typeout{keymwe: keymwesetup options...}        \keymwe@do@setup      }%  }%

Here is the MWE document that uses the test package. Name it keymwe.tex.

% !TEX program = lualatexmk% !TEX encoding = UTF-8 Unicode\documentclass{article}\usepackage{keymwe}\begin{document}Hello, world.\end{document}

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>