# Tag Info

1

It's not very clear what's the reason for this indirect method. You can use \scantokens: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{tikz} \newcommand{\dosthfunny}{\foreach \x in {1,...,5} {\x\\}} \def\Macro{\dosthfunny} \makeatletter \edef\String{\expandafter\strip@prefix\meaning\Macro} \makeatother \begin{...

1

Your question is very unclear and there are no regular expressions involved here (Lua patterns are quite distinct from regex) But I think you are looking for something like this, which prints a string involving \$and$ and then prints it with the \$still intact but all unquoted$ replaced. z="aaa \\ x=1$" print(z) tmp=string.gsub(z,'\\%$', '...

2

The following is an approach using the fp package for calculations and the xstring package for string splitting. The formatting commands are hard-coded, in this case bold, blue, and Large font. Code: \documentclass{article} \usepackage{xstring} \usepackage{fp} \usepackage{xcolor} \newcommand{\divprint}[1]{% \StrLen{#1}[\mylen]% get length of string \FPeval\...

2

\ifx compares the first level expansion of two macros, but also their status with respect to \long. If you do \def\temp{\somename{}}, the replacement text is definitely not empty. Even if you do \edef\temp{\somename{}} (with empty replacement text for \somename) you'd get not empty, because the braces are still there. Note that you need \somename{} in ...

10

You can use do a comma-separated list parser to loop through the list of items and check if the given item is present in the list. Since the comma-separated list can be read by using a delimited macro, this can be done expandably, allowing you to plug the macro into \fpeval to get the syntax you want. Using expl3 (you are loading it with xfp anyway) ...

2


1

I could just say RTFM, but the latest version of the manual is unreadable. \documentclass{article} \usepackage{xstring} \begin{document} \edef\fullname{Jane Doe}% \StrBefore{\fullname}{ }[\firstname]% \StrBehind{\fullname}{ }[\lastname]% {\fullname} or \lastname, \firstname \end{document}

Top 50 recent answers are included