This question ask for a variant of the answer to expl3: lowercase a token list given by Joseph Wright
I want to convert to lowercase a token list that is composed by letter, digits and the control sequence \\
.
The method used by Joseph Wright (which is to make robust \\
) works fine in normal text, but fails with a compilation error when used inside a TikZ
node.
\documentclass{article}
\usepackage{xparse}
\usepackage{tikz}
\ExplSyntaxOn
\NewDocumentCommand \LowerCase { m }
{
\group_begin:
\cs_set_protected:Npx \\ { \exp_not:o \\ }
\tl_lower_case:n {#1}
\group_end:
}
\tl_new:N \g_metadata_title_tl
\NewDocumentCommand \mytext {m}
{
\tl_gset:Nn \g_metadata_title_tl {#1}
}
\NewDocumentCommand \thetext {}
{
\tl_use:N \g_metadata_title_tl
}
\ExplSyntaxOff
\begin{document}
\mytext{This is my\\ Text}
\noindent\LowerCase{\thetext}
\begin{tikzpicture}[overlay, remember picture]
\node[align=left] (text1) {\thetext};
\node[align=left, below of = text1] (text2) {\LowerCase{\thetext}};
\end{tikzpicture}
\end{document}
Note: The text to lowercase is should be taken from a token list variable.
xparse
ones no. If you define with\NewDocumentCommand
you get a protected macro. – Manuel Sep 8 '16 at 8:56