Linked Questions

36 votes
1 answer

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 ...
Jan's user avatar
  • 5,283
74 votes
4 answers

What is "expansion"?

I'm relatively new to (La)TeX, but I have a reasonable amount of experience with computational programming languages. Until I began learning (La)TeX, I'd never heard of "expansion"... So, what is "...
jasonglassbrook's user avatar
77 votes
4 answers

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; ...
Will Robertson's user avatar
44 votes
8 answers

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}...
Scott Morrison's user avatar
28 votes
4 answers

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]{...
user avatar
29 votes
5 answers

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 ...
Andrew Stacey's user avatar
16 votes
5 answers

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 ...
jogloran's user avatar
  • 303
33 votes
1 answer

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?
BairDev's user avatar
  • 443
27 votes
2 answers

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, ...
trequartista's user avatar
  • 1,881
17 votes
4 answers

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 ...
Jonathan Komar's user avatar
16 votes
3 answers

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}} \...
David Hammen's user avatar
  • 2,039
5 votes
4 answers

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 ...
Bart Michels's user avatar
  • 1,288
14 votes
3 answers

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<{\...
Martin Scharrer's user avatar
5 votes
3 answers

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 ...
cryingshadow's user avatar
  • 2,340
9 votes
3 answers

\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 ...
Peter Grill's user avatar

15 30 50 per page