Linked Questions
41 questions linked to/from When to use \edef, \noexpand, and \expandafter?
25
votes
1answer
11k views
What are the differences between \def, \edef, \gdef and \xdef? [duplicate]
I am a LaTeX guy, slowly working into the miracles of TeX.
Can anybody tell me the differences between \def, \edef, \gdef and \xdef?
Where shall I use which, what are the pros and cons? Or is it ...
72
votes
4answers
15k views
What is the difference between \let and \edef?
When you write
\edef\a{\b}
\let\a\b
the results are often identical. What is the difference between these two commands? When do they behave the same? When do they not?
(The question isn't for me; ...
42
votes
8answers
3k views
How can I specify a long list of math operators?
The preambles of my LaTeX documents often include many many lines of \DeclareMathOperator instructions, e.g.
\DeclareMathOperator{\Rep}{Rep}
\DeclareMathOperator{\Tet}{Tet}
\DeclareMathOperator{\Maps}...
28
votes
4answers
2k views
How to properly smuggle (with or even without TikZ)?
I am seeking to find something that allows me to "broadcast" macros outside a group. Concrete examples include paths and scopes in tizpictures. Here is an M(N)WE.
\documentclass[tikz,border=3.14mm]{...
25
votes
4answers
2k views
Does \noexpand have to be a primitive?
Background: I'm trying to deepen my understanding of TeX and how the intricacies work (spurred a little by this place, I should say, and hoping one day to not be a "Cargo Cult Programmer" - see When ...
33
votes
1answer
1k views
What does “expanding” mean in (La)TeX?
You can often read about expanding a macro or when a macro does expand, sometimes about expansion. But what does this mean - in English?
16
votes
5answers
6k views
Re-using the title of the previous Beamer slide
Is there a way to reference the title of the previous Beamer slide? Often, a sequence of slides have the same title, and I'd like to avoid having to repeat the title. I could define a macro for the ...
27
votes
2answers
2k views
How to understand and write LaTeX code?
LaTeX is like a language. In order to write LaTeX code I have to understand the "word" and the "sentences structure". I have searched on wiki, some LaTeX books, but they just give the LaTeX command, ...
17
votes
4answers
753 views
How can I know the number of expandafters when appending to a csname macro?
I am looking for an informative answer here. If I want to append to a macro, I have a couple of options, each depending on whether I want the items fully expanded, partially expanded (a certain number ...
16
votes
3answers
1k views
I'm a cargo cult programmer …
... because I don't know why this works
\def\my@addextraoption#1{%
\xdef\my@extraoptions{%
\@ifundefined{my@extraoptions}\@empty\my@extraoptions,%
\zap@space#1 \@empty}}
\...
14
votes
3answers
495 views
Expansion of first token in a tabular cell
Background
I currently do some work on the collcell package which collects the content of a tabular/array cell and provides it to a user defined macro, e.g. using >{\collectcell\mymacro}c<{\...
5
votes
4answers
922 views
Expand a macro with parameters in tabular head
My eventual goal is to create my own tabular-like environment in which all entries are in math-mode by default, let's call it fancytable. (One requirement is that the first column be separated from ...
9
votes
3answers
1k views
\expandafter, \csname issue related to test for macro being defined
Just when I think I starting to understand \expandafter I run into this problem where I am trying to test if \ConditionG, \ConditionH, etc are defined in a loop. I tried all the combinations I could ...
5
votes
3answers
1k views
Define macro for sequence/list/tuple macros
I would like to define a macro for defining further macros to display sequences/lists/tuples of elements by specifying the following parameters:
The name of the new command.
What to display for an ...
6
votes
2answers
438 views
LaTeX newcommand limitation
I want to know the possibilities and the limitation of LaTeX's \newcommand regarding the definition and the use/call of new macros. I know some of these examples are primitive but they can help to ...