# Tag Info

5

Assunming that the input to \dothis is exactly one letter long in each case (which holds for this specific example -- so I guess it's the actual use case) you could simply use \expandafter: \foreach \n in {a,b,c,e} {\expandafter\dothis\n}. Full example \documentclass{beamer} \usepackage{tikz} \makeatletter \newcommand*{\dothis}[1]{% \stringcases {#1}% {% ...

4

The test \value{A} < \value{B} works for me. I've used \@ifundefined{csname}{true}{false} where csname is the command name to be tested without the escape character \. The most important thing here is constructing the various command names, with \csname foo\Alph{...}\endcsname. \documentclass{article} \usepackage{forloop} ...

3

If you got trouble getting your data parsed the right way by the foreach-statement, you could do the following. Evaluate the values you need in the outer loop with evaluate and just pass them as the min/max values to the foreach. \foreach [count=\i, evaluate=\i as \ymin using int(\x-1), evaluate=\i as \ymax using int(\x+1)] \x in ...

3

I think the first two matrices are what the OP asked for. I believe I have got the 3rd level, as well. The key is in realizing that the indices are basically in binary (base 2) notation. EDIT, To keep up with egreg, I also did 4th level. \documentclass[landscape]{article} \usepackage[margin=1cm]{geometry} \usepackage{amsmath} \newcommand\Amatrix[2]{% ...

3

Not really recursive. But, hey, it works! \documentclass{article} \usepackage{amsmath} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\recursematrix}{O{B}m} {% #1 is the (optional) symbol for the coefficient, #2 is the step \begin{pmatrix} \passerby_recursematrix:nn { #1 } { #2 } \end{pmatrix} } \tl_new:N \l_passerby_recursebody_tl ...

2

There are a few problems with your code. The code \ifdefined\expandafter\AuthorName\Alph{loopTitleCoverAuthor} tests whether \expandafter is defined. However the code \expandafter\ifdefined\expandafter\AuthorName\Alph{loopTitleCoverAuthor} would do no good either, because you'd get, when loopTitleCoverAuthor has the value 1, \ifdefined\AuthorName A ...

1

Though there are already good answers, I contribute the version, I used for my currently growing Liederbuch-package: \def\TesT#1{ \expandafter\def\csname test\Alph{#1}\endcsname{} } \newcounter{wseva} \setcounter{wseva}{4} \TesT{wseva} \def\doesItExist#1{ \expandafter\ifx\csname test\Alph{#1}\endcsname\relax no \else yes \fi } \begin{document} ...

Only top voted, non community-wiki answers of a minimum length are eligible