{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

10
votes
1answer
222 views

Making a character active vs assigning it a specific catcode

My query arises from my answer to Tab not as extra alignment tab and Andrey's rather nicer version. The question at hand involved making the TAB character usable for aligning tables. I assigned it to ...
7
votes
1answer
162 views

Printing a character that has been made active in text and/or math mode?

I am not very familiar with TeX's category codes. If I use \catcode`\|=13 \renewcommand{|}{hello world} then every use of | in my document will be replaced by hello world. However, how would I be ...
12
votes
3answers
463 views

How do I test for a character, irrespective of catcode?

This came up from Labels in TikZ are incorrectly interpreted, but it's also something I've run into with the braids package, and a couple of other things I've done. Also, from looking at the TikZ ...
7
votes
2answers
382 views

Active characters after \begin{document}

I'm using XeLaTeX and I want to do automatic repeating of plus sign after breakline. I've found the unoffical package for this but it seems to me a bit overkill (although didn't try it). I tried to ...
4
votes
3answers
242 views

Why does a defined command appear differently in the align environment?

In the LaTeX document shown below, my definition \comp does not show correctly in the align environment. Why it is this the case? ========== Begin LaTeX scripts ============= ...
1
vote
0answers
215 views

How to use tikz matrix in a LaTeX command? [duplicate]

Possible Duplicate: Problem with defining shortcuts for TikZ matrices. I tried to use a tikz Matrix in a LaTeX document as the following: \documentclass{article} \usepackage{tikz} ...
3
votes
1answer
230 views

How to prevent \endlinechar=-1 from interfering a loaded EPS image?

I have to work in a block that begins with \endlinechar=-1\relax removing any space at the end of each line. After the \endlinechar=-1\relax, there will be codes related to loading an image ...
11
votes
2answers
625 views

How to get the catcode of a token?

For debugging a complicated macro I would like to print out the catcode of a token. Optimally I would like to have a macro \getcatcode such that, for example, \getcatcode{a} would expand to 10. How ...
2
votes
1answer
432 views

Scope of catcode change for escape character ?

In the following macro, I change the category code for the escape character (\) to "other" (12): \def\xxA{\begingroup \catcode`\\ = 12 \gdef\xxB ##1z{\tt ##1\endgroup} \xxB} How the heck does ...
10
votes
1answer
326 views

Is there a \show for catcodes?

In the course of attempting to out-pedant another mathematician, I wanted to \show the catcode of $ to convince myself that it was a "special" character in ordinary TeX as well as LaTeX. I was just ...
14
votes
2answers
348 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
184 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 ...
32
votes
4answers
2k 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
1k 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
610 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
522 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
635 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
146 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
202 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 &, ...
287
votes
1answer
40k 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
617 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 ...
16
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 ...
38
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
468 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 ...