Questions tagged [detokenize]

The e-TeX primitive `\detokenize`, which removes special meaning from TeX code.

Filter by
Sorted by
Tagged with
16
votes
2answers
2k views

Removing a backslash from a character sequence

For indexing I wanted to write a macro \macroname that removes leading backslashes from macro names but leaves the names of environments untouched. That is \macroname{\relax} --> relax \...
40
votes
2answers
12k views

What are the exact semantics of \detokenize?

How does \detokenize work? The e-TeX Short Reference Manual states: When followed by a <general text>, expands to yield a sequence of character tokens of \catcode 10 (space) or 12 (...
6
votes
1answer
894 views

Strange behaviour with \detokenize and underscore

I just learned about \detokenize, so this question is likely a naive one. Nonetheless, based on what I thought that I understood about \detokenize, I would have expected \detokenize{_} to render as _....
2
votes
1answer
483 views

Automatic Labels with automatically generated keys

I am writing a collection of documents in book form, one each for 4-5 topics. Each book has upwards of 30 chapters each in a different file. The books must be able to cross reference each other since ...
7
votes
4answers
375 views

Expand multiple math-tokens before detokenize

I am a long time Latex user and over the last few weeks I am involved in a project that needs to do the following: I want to put in verbatim some math latex code that may include user-defined macros. ...
6
votes
2answers
544 views

How can I check if the value of a variable is the same as what another variable?

My question is simple but I don't know any simple solution for it. I have an unknown variable namely \unknown and a variable which I want to compare \unknown with it, namely \test. I want a command ...
3
votes
2answers
1k views

How listing and verbatim do to escape special character?

I use one macro to display text using texttt style. For the moment this macro is very basic. For example, if I want to use the character _, its catcode must be changed. Is there a clever way to ...
2
votes
1answer
74 views

Hyphenate word with detokenized underscores

I want to write clean underscores without backslashes and hyphenate words by underscores. I tried to use underscore package, but it doesn't work with clean underscores and also breaks ...