Skip to main content

All Questions

Tagged with
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 \...
谢尘竹's user avatar
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 ...
Mike Pugh's user avatar
  • 329
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
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 - \...
Mycroft_47's user avatar
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? ...
Witiko's user avatar
  • 1,006
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\...
coonlight's user avatar
  • 137
3 votes
3 answers
136 views

\def and \edef: Expansion for one level, not more

I want to save the content of a macro (which may contain text and other macros) for later use and without full expansion. \def\mcr{a} \def\textandmacro{sampletext \mcr} % this content i want to recall ...
coonlight's user avatar
  • 137
0 votes
3 answers
91 views

Unexpected behavior of \g@addto@macro in class definition

I am implementing a new class for a journal. Withi this class, I defined the command to insert the authors of an article. I anticipate that everything works perfectly in the basic form, that is, if ...
TrAmA's user avatar
  • 17
3 votes
4 answers
136 views

Compare first token after expanding macro once and discard the rest

How does one write an if clause that checks whether the first element of the immediate expansion is \mymacro, without fully expanding the input? \documentclass{minimal} \def\mymacro#1{Does something ...
Hyperplane's user avatar
5 votes
3 answers
134 views

Fallback if def failed to parse the arguments?

I love the way \def can be (ab)used to parse very efficiently a string (another option would be to loop over all chars in LaTeX3 style or use LaTeX3 regexp, but it's faaaar slower, and often harder to ...
tobiasBora's user avatar
  • 8,964
8 votes
3 answers
536 views

Get third argument from string?

So here is a way to get the first, second, and remaining elements (characters) of a given string: \makeatletter \newcommand{\firstof}[1]{\@car#1\@nil} \newcommand{\secondof}[1]{\expandafter\@car\@cdr#...
wmnorth's user avatar
  • 657
0 votes
0 answers
67 views

How to expand a macro so that it can be used as an input to another macro

I use datatool to get key-value pairs from a data file into a database. I then retrieve values using a custom command, \varConfig{}. One of these values is the number 1, saved as a string in the data ...
Andy Clifton's user avatar
  • 3,709
0 votes
2 answers
114 views

A macro to check command expandability

I would like to create a command that checks whether an expression is fully expandable, and crashes if not (ideally printing an error message). I would like to do that without a specific TeX engine in ...
Vincent's user avatar
  • 5,327
1 vote
0 answers
91 views

Design a generic numeric comparator function using expl3 working for strings, counters, numexpr, dimexpr

I would like to design a generic compare function between numbers, ideally expandable with the following signature: \NewExpandableDocumentCommand{\compare}{r[] m m m m m}{%CODE HERE%} that would be ...
Vincent's user avatar
  • 5,327
4 votes
3 answers
148 views

Problem with a command that prefixes words only if needed when the arguments are provided through macros

Consider the following code coming from this answer, where it adds a prefix to a word, only if the prefix is missing. \documentclass[border=6pt,varwidth]{standalone} \ExplSyntaxOn \...
Vincent's user avatar
  • 5,327

15 30 50 per page
1
2 3 4 5
33