Tagged Questions
9
votes
1answer
63 views
Expandable, very specific keyval processing
I am having a hard time trying to come up with an fully expandable keyval parsing macro which deals only with specific keys/values. I wouldn't even attempt this in full generality, that's way beyond ...
8
votes
3answers
122 views
Nested use of \ifcsname needs protection
I have a macro \command to ensure that the names of macros in my documentation are consistently formatted. Been work great, until I had an urge to procrastinate and had this brilliant idea that I can ...
10
votes
3answers
133 views
\expandafter and counters not playing nicely
My google-fu has finally failed me...
I'm trying to write a package that will allow you say \addauthor{name, email} several times and have the title page properly formatted. Here is a minimal example ...
6
votes
1answer
82 views
Package providing fully expandable conditionals
Is there a package providing a collection of fully expandable conditionals like this one:
\newcommand\myif@num[1]
{\ifnum#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
Background: ...
6
votes
2answers
210 views
Nesting of test commands (IfStrEq, IfSubStr etc.) of xstring
The following code does not work:
\documentclass{article}
\usepackage{xstring}
\newcommand\checkempty[1]{
\IfStrEq{#1}{}{%
Empty
}{%
NonEmpty
}
}
\begin{document}
...
6
votes
3answers
143 views
How to “demux” several aspects from a `\foreach` variable with `\ifstrequal`?
How can I "demux" several features from a mode specification given in a \foreach?
I would like to use a \foreach to draw several nodes in a TikZ picture. The loop will specify a mode for each ...
18
votes
4answers
546 views
On testing two fully expanded character strings for equality
I know three macros that test two fully expanded character strings for equality:
\ifthenelse{\equal{<op1>}{<op2>}}{<true>}{<false>} (ifthen package)
...
6
votes
1answer
578 views
\newif conditional causing problem in \typeout or \edef
The following code produces result as expected, i.e.,
False True
on the typeset document.
\documentclass{minimal}
\newif\iftest
\newcommand{\test}[2]{
\iftest
#1
\else
#2
\fi
}
...
7
votes
2answers
126 views
How to put a conditional construct in \edef
\ifthenelse works fine normally, but when used in \edef:
\documentclass{article}
\usepackage{ifthen}
\newcommand\testing[1][]{%
\edef\tmp{\ifthenelse{\equal{#1}{}}{Blank}{#1}}%
}
\begin{document}
...
13
votes
2answers
2k views
What does \begingroup\expandafter…\endgroup do?
I often see code of the following form in package implementations (this example is from the LaTeX3 sources):
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname ...