Skip to main content

Questions tagged [expandafter]

The tag has no usage guidance.

1 vote
1 answer
52 views

Expanding Variables to Input as Arguments for Macro

I have an issue when trying to use variables in a command (\ResearchModule). I read up to 8 lines from a text file and have them set to elements of an array (using code thanks to egreg!), with \...
MrOakPlanks's user avatar
3 votes
1 answer
45 views

Generate \charge arguments with a macro

I'm trying to use a macro to generate arguments that should be passed to \charge. I'm trying this: \documentclass{minimal} \usepackage{chemfig} \begin{document} \charge{-135:1pt=5}{C} \...
ttsc's user avatar
  • 415
6 votes
3 answers
248 views

How to expand a command with \csname and \expandafter

I get it when I write: \expandafter\def\agent{Hello} \expandafter\def\expandafter\agent\expandafter{\agent World} \agent result: Hello World It doesn't work for me when I write: \expandafter\def\...
Juli's user avatar
  • 121
3 votes
3 answers
170 views

Define a new command as a loop of existing Latex commands

I want to define a new command, which is a composition of commands already defined within the \csvsimple package. Therefore I've written the following code, which correctly works for my purpose: \...
MattiaP's user avatar
  • 43
1 vote
2 answers
65 views

Table csvreader: loop over columns

I have a csv file called "data.csv" containing the following data: 1,2,3 4,5,6 I am writing the following table in Latex by using \csvreader: \begin{table} \centering \begin{tabular}{|c|c|c|}...
MattiaP's user avatar
  • 43
4 votes
2 answers
287 views

How to use \foreach and \newtheorem together?

I want to use \foreach and newtheorem together, so I've assigned an array with the package listofitems \setsepchar{;/,}\ignoreemptyitems \readlist\baz { theorem, lemma, definition, corollary, ...
Meiu's user avatar
  • 558
2 votes
1 answer
115 views

Understanding `\expandafter` when checking nested `\csname…\endcsname`

Please consider the following MWE, which is an excerpt from a much larger project. The scenario is to define a conditional \IfComp{<number>}{<defined>}{<undefined>} that queries, ...
Lupino's user avatar
  • 2,762
1 vote
1 answer
43 views

amsart problem with typsetting title

I tried to implement a metalevel for the author and title commands, because most style files want them to be a little bit different and I want to be able to easily change the style file. Long story ...
Nathanael Skrepek's user avatar
5 votes
1 answer
149 views

Question in Stephan's TUGboat article about \expandafter

In the first page of Stephan Bechtolshein's TUGboat article about \expandafter, he described the rules of the execution of \expandafter. I think the case iii should not be listed here since the ...
Stephen's user avatar
  • 4,494
0 votes
3 answers
132 views

How to understand "\appendroman#1#2#3" on page 41 of The TeXbook?

At the bottom of page 41 of The TeXbook, there is a question: Define a control sequence \appendroman with three parameters such that \appendroman#1#2#3 defines control sequence #1 to expand to a ...
Y. zeng's user avatar
  • 2,105
6 votes
2 answers
1k views

Doesn't "\romannumeral1986" equal "mcmlxxxvi" in TeX?

In TeX, \uppercase{\romannumeral1986}\par %\catcode`\m=12 \uppercase{mcmlxxxvi} \bye produces So, doesn't mcmlxxxvi equal \romannumeral1986? What the difference between them? \expandafter can bypass ...
Y. zeng's user avatar
  • 2,105
0 votes
1 answer
50 views

How to expand from DLTforeach prior to function call

Apologies if this is a trivial problem, I've seen a lot of similar posts, but i have not been able to solve this. Setup: I have created a table based on this answer. I have created a function for ...
Malle's user avatar
  • 3
0 votes
1 answer
63 views

Trying to expand items within a newglossaryentry in a generic function without causing the Improper alphabetic constant

I've looked at both these related topics, but my situation is a little bit different. improper alphabetic constant with-glossaries improper alphabetic constant The first thing I found in the ...
Miraino Hikari's user avatar
5 votes
2 answers
102 views

Problem expanding math in arguments of en environment

I want to redefine by hand a "restatable" environment for theorems. I have to do so because for some obscure reason the jloganal class (for the Journal of Logic and Analysis) mess it up: ...
Quentin G's user avatar
4 votes
3 answers
157 views

Command gobbling extra letters not working when passed another command

On another topic, I was given the following command as an answer: it takes either a two letter font shape (sc, it...) or a full version (scshape, itshape...) to set the corresponding font shape. \...
Vincent's user avatar
  • 5,327

15 30 50 per page