Closed ACCakut closed 3 months ago
\XSIMmixedcase
is a thin wrapper of expl3 function \text_titlecase:n
, which has been deprecated since release 2023-10-23 of l3kernel
.
On its deprecation, the behavior is also slightly changed: now the title-casing is done on a per-word basis and the leading space is treated as an inter-word space, thus prohibits the title-casing of the word right after it.
In your example, the easiest change is to drop the space between {
and \GetExerciseName
:
-\XSIMmixedcase { \GetExerciseName }
+\XSIMmixedcase {\GetExerciseName}
\documentclass{article}
\usepackage{xsim}
\begin{document}
\def\mytext{text TEXT}
% results in "Text text" and "text text"
\XSIMmixedcase {\mytext}
\XSIMmixedcase { \mytext}
\ExplSyntaxOn
% results in "Text text" and "text text"
\text_titlecase:n {\mytext} \space
\text_titlecase:n {~\mytext} \par
\ExplSyntaxOff
\end{document}
In your example, the easiest change is to drop the space between
{
and\GetExerciseName
:-\XSIMmixedcase { \GetExerciseName } +\XSIMmixedcase {\GetExerciseName}
As \XSIMmixedcase
never removed leading spaces from its argument, I think the no-space version is all-time preferable.
Thanks, that resolves my issue. I made a PR to fix this in the whole repo from where I took the code snippet some time ago.
Pull request: https://github.com/cgnieder/xsim/pull/128
I made a PR to fix this in the whole repo from where I took the code snippet some time ago.
Well those spaces in xsim
source code are actually ignored.
All the xsim
code are wrapped between expl3
commands \ExplSyntaxOn ... \ExplSyntaxOff
, which employ a special catcode table in which space character is ignored, _
and :
are characters, and ~
is the normal space. See the doc of \ExplSyntax(On|Off)
in texdoc interface3
, sec. 1.2 Documentation conventions.
I see, thanks for that insights, I was not aware of this. Nevertheless, there is this problem: If one copies code from .sty to alter the template (like I did and also did today for a grading table for collaborative exam correction), that "bug" emerges.
Is there a solution to that, except writing it in the RTFM boldly of repeating \ExplSyntaxOn ... \ExplSyntaxOff
in every relevant snippet? I see that whitespace makes the code more readable, whereas in this case, I tend towards removing it for the mixed case thingies.
Is there a solution to that, except writing it in the RTFM boldly of repeating
\ExplSyntaxOn ... \ExplSyntaxOff
in every relevant snippet?
I'm afraid no. You always need to write something to set and restore the catcode of space.
All the
xsim
code are wrapped betweenexpl3
commands\ExplSyntaxOn ... \ExplSyntaxOff
, which employ a special catcode table ...
Note that package code is also auto-wrapped between \makeatletter ... \makeatother
, which allows using @
in names of control sequences, like using letters (a-zA-Z). It happens that the piece of xsim
code you copied didn't make use of this "feature", but theoretically ... .
Hello,
we use xsim to create our exercise sheets, and I played around with the settings in overleaf today. When switching TexLive from 2023 to 2024, I encountered a strange problem: The exercise name is small letters only. I tried several things using
\XSIMmixedcase
, but with no success.