{catcodes} is about "category codes" — an integer number from 0–15 associated to each of the 256 character codes. The category codes indicate the role of a character.

learn more… | top users | synonyms

14
votes
2answers
337 views

Macro to take a character as argument, make it active, then \def it.

I have a XeLaTeX document in which I want some unicode symbols to be auto-substituted, like ¼ → 1/4, » → >>, « → <<. But instead of a long list like \catcode`\¼=\active\def¼{1/4} ...
5
votes
2answers
179 views

Changing catcode for commercial at (@) inside a macro to get it matched in pattern.

This question is related to TikZ: pgfutil-common: pgfutil@in@ - how does it work? and is a result of coping with that problem. I've already read How to change #catcode in a macro, but it didn't help ...
31
votes
4answers
1k views

What are category codes?

Following on from this question, I'd like to ask a more general question: What are category codes, and what can I achieve by changing them?
6
votes
1answer
924 views

Using tilde `~` in csname in Beamer

In beamer, I would like to be able to use the tilde character ~ in the name of a command sequence. I tried with adjusting catcodes. While this was successful with the standard article class, it failed ...
14
votes
1answer
562 views

How to change #catcode in a macro

I want to change the catcode in a macro, but it seems it doesn't work. Can anyone help me? \def\A{\catcode`\|=0 |bf{test}} |bf{test} would not work as expect.
19
votes
2answers
443 views

How bad is slack \makeatother discipline really?

Following Will Robertson's admission that Fwiw, i'm not aware of any troubles with a missing \makeatother, but you're right. It's a bad habit of mine to omit it, and my own progressive slackness about ...
2
votes
2answers
631 views

ignorespace and unskip in verbatim/listings?

I am writing a \bashDemo macro that will (a) execute its argument in a shell, e.g., bash, script, and (b) display the argument in a listings. So, \bashDemo ls -ls > myfiles \END will both run ls ...
4
votes
2answers
144 views

Command to display free-text answers from a survey, eliminating ascii control chars

I'd like to create a report from a survey with free-text answers that is collected in a database. For each question there are typically many answers which I could present in an itemize environment, ...
4
votes
2answers
196 views

Get tokens between two commands

I'm trying to create a screenplay-like class that uses a very simple syntax to create the dialogue, and dumps it as a plain text file for use in subtitles. To divide the subtitle sections I use &, ...
255
votes
1answer
34k views

What do \makeatletter and \makeatother do?

Many TeX “hacks” begin with \makeatletter and end with \makeatother. What do these commands do?
9
votes
4answers
584 views

How do I get the category code of a character that is the value of a control sequence?

How can I get the category code of a character that is the value of a control sequence? If I do this The catcode for A is \the\catcode`A. I get The catcode for A is 11. If I do this \let\abc=A ...
15
votes
4answers
2k views

How to make a real backslash (escape) character?

I just want a good way to make a backslash character (or whatever character(s) any given format uses as escape characters), suitable to \write to a file or pass to a pdfTeX primitive. Let me ...
34
votes
1answer
3k views

Is it \catcode or \catcode`?

I've noticed that \catcode is poorly documented in the TeXbook. The primitive is defined as \catcode but every time it is used, it is used as \catcode` ... the backquote is never discussed. ` itself ...
4
votes
2answers
447 views

How to test whether next token on input stream is catcode 10

Why doesn't the following code work? From a failed, now fixed, SO answer of mine: \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \newcommand\latinabbrev[1]{ \peek_meaning:NTF . {% Same ...