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>.

97 questions
7
votes
1 answer

\csname does not work with #1?

I'm trying to use \csname to execute a command whose name depends on a variable. If I use \csname mygametitle\tmp \endcsname it works, but if I use instead of \tmp the argument #1 it…
tobiasBora
  • 8,684
2
votes
3 answers

How to store data for later use (list-like)

I use an environment "exo" defined by \usepackage{amsmath} \newtheorem{exo}{Exercice} I would like to optionally include some exercises later in the document, using the…
2
votes
3 answers

How to check if a command is empty, with a variable name?

I'm doing this: \documentclass{article} \begin{document} \newcounter{bar} \newcommand\checkit{ \ifx\csname foo\romannumeral\the\value{bar}\endcsname\empty empty …
yegor256
  • 12,021
2
votes
1 answer

\csname silences errors

It seems that \csname automatically defines the control sequence in question if it's not already defined. The code below creates a document creating "a b c"; swapping the \csname line and \foo line gives an error. I would have expected \csname to…
Kyuuhachi
  • 135
1
vote
1 answer

What's causing mysterious "Missing \endcsname inserted" error that didn't exist four months ago?

I am running MacTeX 2022 with all updates applied. I have a large project that last built correctly on September 3, 2022. Today I get a mysterious Missing \endcsname inserted error on one particular line and I can't find the reason. Pressing H in…
1
vote
1 answer

Missing \endcsname inserted. \relax

I am trying to read a set of pre-defined data using /csname and /endcsname. However, "missing /endcsname inserted" error keeps appearing. Here is a simplified LaTex code. \documentclass[11pt,…
1
vote
1 answer

Isn't \csname foo\endcsname = \foo?

On p. 40 of the TEXbook, it says that \csname TeX\endcsname is essentially the same as \TeX. But, if that is so, why isn't \foo defined below? % tex This is TeX, Version 3.14159265 (TeX Live 2019) (preloaded format=tex) **\def\csname…
Toothrot
  • 3,346