Questions tagged [expansion]
{expansion} is about expanding tokens, including the manipulation of expansion order and the suppressing of expansion.
1,124
questions
0
votes
2
answers
138
views
design a \Command that allows a Dual-parameter \Command passing its return into another \Command as one (which might be a label) of its inputs
Design: a (La)TeX command (maybe look like this \passresult{\outercommand}{\innercommand}{param1}{param2}),
which pass the return of a dual-parameter \innercommand{param1}{param2} into another \...
1
vote
1
answer
65
views
How does one fully expand a macro between \csname and \encsname?
The best way to ask this question is to present two MWEs, one of which works and one of which does not. Naturally, I would like to get this into the second form, but I am at a loss as to what is ...
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 \...
2
votes
2
answers
110
views
hyperref warning: Token not allowed in a PDF string - macro Refactoring as a fix
I have a macro that takes a comma-separated list of lists and applies some formatting to it. The list consists of the first and last names of the document's authors. I managed to create a macro - \...
4
votes
2
answers
173
views
Anonymous macro with #1 argument specifier
\def\foo#1{a#1b}
creates \foo that expects for a mandatory argument when used.
I'm trying to create so called "anonymous" or "lambda" macro that is essentially a token list with a ...
2
votes
1
answer
51
views
How to trim spaces without expanding what is inside in expl3?
Consider the following pattern:
\NewDocumentCommand{\mycommand}{m}{
\myinternalcommand:n{#1}
}
\cs_new:Nn \myinternalcommand:n{
\tl_if_single:nTF{#1}{TRUE}{FALSE}
}
and let's say that I want ...
4
votes
5
answers
320
views
Convert control sequence with a variable number of undelimited parameters into a token list
In expl3, I can translate a token list \l_greet_tl into a control sequence \greet that takes two parameters as follows:
\tl_new:N
\l_greet_tl
\tl_set:Nn
\l_greet_tl
{ Hello,~#1!~How~is~#2~doing? ...
3
votes
1
answer
84
views
How to know for certain in expansion-contexts the moment when the result of a fully expandable expl3-function is there?
There are a lot of functions provided by the expl3 programming environment that in interface3.pdf are marked with a black asterisk (fully expandable) or with a white asterisk (restricted expandable).
...
1
vote
0
answers
31
views
Record the content of an environment as a property
I came up with this question since I saw copy and reuse the content of an environment and thought that this might be solved using ltproperties.
I want to record the content of an environment as a ...
0
votes
0
answers
35
views
How to mask \begin and \end in the versions package?
With the versions package, a version switch foo can be created to turn on/off the text that is written within the foo environment. My goal is to create new commands \mybegin and \myend, which mask the ...
0
votes
2
answers
59
views
def inside def gives an error when used with ref
I want to define a command that returns a label to use with \ref, but it requires using \edef to expand another command. However, I am getting several errors starting with Missing \endcsname inserted. ...
4
votes
2
answers
116
views
Memoir pagenote (endnote) id's all coming out the same
I am creating a document using the memoir package and specifically memoir's endnote facility (which is called pagenote to avoid naming conflicts). The document, when complete, will have an entry for ...
4
votes
2
answers
155
views
Get the string return by \namecref to use in another command
Suppose I have a theorem with \label{thm}, and I want to create a theorem of the same type as thm, here's what I want it ideally behaves:
\documentclass{article}
\usepackage{lipsum}
\usepackage{...
4
votes
1
answer
143
views
What is the regurgitation process?
After a long time fighting with an \uppercase in a \csname ... \endcsname, I came across this post that mentions the argument being “regurgitated,” which means that to capitalize a control sequence, ...
1
vote
4
answers
88
views
expansion of a macro defined with \csname
I have a problem with expanding and not expanding macros together with \csname. Please look at the following code:
% Save content of a macro via \csname
\def\LetCsVar#1#2{\expandafter\let\csname#1\...