-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PGFMath not parsing {"two"}[0]
with \usetikzlibrary{babel}
#1062
Comments
Firstly, On the \def\normal@char@quote{"}
\catcode`\"=\active
\gdef"{%
\ifx\protect\@typeset@protect % \edef case
\else
\ifx\protect\@unexpandable@protect % \protected@edef case
\noexpand "
\else % case 3
\protect "
\fi
\expandafter\@gobble
\fi
\normal@char@quote
} With the above definition,
On |
I'm experienced in neither handling active characters nor using \usepackage{etoolbox}
% after both babel and tikz are loaded
\apptocmd\pgfmath@catcodes{\catcode`\"=12 }{}{\fail} |
You just can't win. Reverting to \pgfmathparse{width("\textbf{Hello}")} |
Resetting the quote catcode might work but then this will stop working % \usepackage[ngerman]{babel}
\pgfmathparse{width(\string"compound"=word\string")} although that is a very niche use-case at best. Probably not worth supporting. |
In principle, could one code
works? (Of course, then |
For When |
Ah, maybe % \usepackage[ngerman]{babel}
% \usepackage{etoolbox}
\apptocmd\pgfmath@catcodes{%
\scantokens{\makeatletter
\def\pgfmath@char@user@quote{"}%
\makeatother\noexpand}%
\catcode`\"=12
}
\def\pgfmathrestorecatcode#1{%
\if#1"\pgfmath@char@user@quote
\else % other cases avaliable
#1
\fi
}
\pgfmathparse{width("compound\pgfmathrestorecatcode"=word")} |
I had in mind slightly different (pseudo)code: \expandafter\def\csname pgfmath-prechar\string#1\endcsname{#1}%
…
\ifDefined{pgfmath-prechar\string#1}{\csname pgfmath-prechar\string#1\endcsname}{#1} (I do not know whether Updated: the first line above should be good when used “on the outside”, but for |
This was not clear at all from the babel section in the manual. This may need to be clarified there… |
agree |
Signed-off-by: Henri Menke <henri@henrimenke.de>
Signed-off-by: Henri Menke <henri@henrimenke.de>
Should I put the suggestion for implementing |
I've already decided not to implement it, because it's too niche of a use-case. It also won't work in many cases, mostly for content that is already tokenized and I refuse to put |
Now I’m completely lost! (After I run How can changing Furthermore, I see that |
rather than fiddle with catcodes (which would only work at the top level anyway) I'd define the active quote to expand to the non active one, something like
although possibly re-arranged a bit so that it doesn't do a global definition and the \string at run time. |
Co-authored-by: David Carlisle <d.p.carlisle@gmail.com> Signed-off-by: Henri Menke <henri@henrimenke.de>
Signed-off-by: Henri Menke <henri@henrimenke.de>
Co-authored-by: David Carlisle <d.p.carlisle@gmail.com> Signed-off-by: Henri Menke <henri@henrimenke.de>
The example from the manual for
{x}
(p.1033 in TeXLive2021):does not work with
babel
s present in TexLive2021. It was working fine (even without\usetikzlibrary{babel}
) in TeXLive2018.Minimal working example (MWE)
The error message is
The text was updated successfully, but these errors were encountered: