Questions tagged [csname]
This tag is specific to the use of \csname ... \endcsname constructions, typically used to construct control sequences (macros) that are otherwise difficult to create using \<csname>.
102
questions
3
votes
1
answer
84
views
Table Missing Values
I'm trying to improve my ability to read math and physics equations, so I borrowed this code from someone on GitHub. I'm a bit of a latex novice. I was having issues getting the document to build at ...
3
votes
1
answer
41
views
Fontspec and \readline produce trailing blank symbol
I am using \readline to paste the contents of a plain text file to a LaTeX document, which works fine. This is what the plain text file looks like:
This is the first line.
This is the second line.
...
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 ...
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\...
0
votes
1
answer
15
views
How can I use escapeinside within a minted environment with the bash lexer?
The escapeinside functionality doesn't work properly with the bash lexer. Is there any way to fix this?
MWE:
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}[escapeinside=|...
2
votes
2
answers
64
views
Calling variables in latex via newcommands arguments
I want to make my life easier with some calculations in LaTex, therefore I define a compound specific variablecalled \compound1molarmass. I use \newcommand to call another function from chemmacros so ...
2
votes
2
answers
115
views
How to pass an argument to a macro called with \csname
I have a macro that generates lists of random numbers and converts them into letters to print. I'd like to create another macro that prints those lists with intervening text. That is, if
\first ...
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, ...
0
votes
0
answers
76
views
Extra Braces When \url Uses Variable
When using \url{} in the following example, it adds additional braces around the variable. So the code below renders:
{google.com} - google.com
Why is this happening, how can I avoid it?
Is there a ...
0
votes
1
answer
79
views
Doesn't "\csname" need contain "\0"?
On page 40 of The TeXbook,
Conversely, you can go from a list of character tokens to a control sequence by saying ‘\csname\endcsname’.
So \csname TeX\endcsname equals \TeX. However, \TeX contains ...
3
votes
0
answers
68
views
Are there tricks for detecting whether a `\csname..\endcsname`-thingie went wrong and, if so, delivering additional messages explaining the issue?
For the sake of having expandable tokens expanded before stringification I sometimes combine \csname..\endcsname-expansion with \string as in
\chardef\stopromannumeral=`\^^00
\edef\gobbleToPrefix{%
\...
1
vote
3
answers
81
views
Branch over number of characters of an argument provided to a macro
I currently have the following command:
\newcommand*{\setfontshape}[1]{\@ifnotmtarg{#1}{\csname#1shape\endcsname}}
that helps me produce the command: \scshape from text sc.
I would like to modify my ...
0
votes
1
answer
36
views
Cannot plot CSV with PGFPlotTable, Missing \endcsname inserted
Let's say I have this pretty standard CSV file:
id,x0,y,sy,yhat,yerr,yrelerr,ychi2
0,-1,-1.083108355,0.075,-1.013608377,-0.069499978,0.068566894,0.85871057
1,-0.857142857,-0.625857469,0.075,-0....
0
votes
1
answer
82
views
Exercise 5.7 in TeX - define control sequences with grouping
I want to solve Exercise 5.7 in the TeXBook by Donald E. Knuth.
Define control sequences **\beginthe**<block name> and **\endthe**<block name>
that provide a “named” block structure.
In ...
0
votes
2
answers
69
views
! Missing \endcsname inserted error when using \seq_map_pairwise_function:ccN
This question is related to Execute list of commands generated by pairing elements from two \clist s or \seq s.
I am trying to perform a sequence of commands of the form
\def\alpha {^^^^03b1}
...