Questions tagged [catcodes]

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

Filter by
Sorted by
Tagged with
3 votes
1 answer
176 views

pdflatex stops when both german and hungarian languages are set in babel

This is a MWE: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[german,hungarian]{babel} \begin{document} babel test \end{document} When I run pdflatex on ...
user avatar
  • 837
5 votes
1 answer
78 views

Why is the underscore OK inside of a `\cite` command?

The underscore character _ has a category code of 8, because it has special meaning in TeX and a special role. Including an underscore in the main body of a LaTeX document will generally cause a ...
user avatar
  • 1,372
1 vote
0 answers
31 views

What is the right way of cascading styles using nested environments/macros, while each environment/macro might partially stylize its embedded content?

I have asked similar to this question before, but I think I have to describe it in another way. Need What is the right way of cascading styles using nested environments/macros (much like the way CSS ...
user avatar
  • 365
0 votes
0 answers
35 views

How to make \endlinechar act exactly like a(n) (active) space? [duplicate]

I know that, in normal circumstances, an endlinechar (=13) of input gets converted into white-space. But, in this MWE, I make the charcode 32 space character active and replace it with a ...
user avatar
0 votes
0 answers
5 views

csvsimple problem: csvreader reads > as?, what can I do? [duplicate]

I'm a beginner using LaTex. Currently I'm doing my thesis project and I need to do a table from a csv. However, csvreader from the csvsimple package is giving me problems because it reads > as ¿ ...
user avatar
0 votes
0 answers
26 views

How can I run scantokens with modified environment, but use the normal environment within the scanned code?

For example if I run %! TEX program = lualatex \documentclass{article} \begin{document} {% prepare a token list <a> (assume this is provided by user) \catcode 13=12\relax % 12:other \global\...
user avatar
  • 1,444
0 votes
2 answers
96 views

Make a char behave like a 'space', in math mode

Some may find it a terrible idea, but I have tried to use the dot . to behave like a space in math mode. The idea is to be able to write \cos.x or, more generally, \macro.x rather than \macro{x} or \...
user avatar
  • 21
2 votes
2 answers
30 views

How to return a filename containing underscore from a switch-case function (like ifEqualCase) as a parameter into a function like addplot?

When plotting and iterating through a list of filenames, I wanted to call them from a switch-code and apply them in \addplot. I used the switch-function \IfEqCase from the xstring package. However, ...
user avatar
1 vote
1 answer
30 views

How to well convert underscore with catcode=12 with make4ht?

I have the following 'MWE.tex' file where I defined underscore with \catcode'_=12: \documentclass{article} \catcode`_=12 \begin{document} Text containing underscore between parenthesis (_) \end{...
user avatar
2 votes
1 answer
103 views

How to avoid redefining ampersand & globally?

In my attempt to make my library zx-calculus based on tikz & tikzcd compatible with tikz externalize (to save compilation time), I've basically been using this solution https://tex.stackexchange....
user avatar
  • 5,043
3 votes
0 answers
31 views

Defining an environment with markdown in a tcolorbox

This works in Overleaf: \begin{tcolorbox} \begin{markdown} - Foo - Bar \end{markdown} \end{tcolorbox} But I can't define a new environment that does this with a single environment declaration (...
user avatar
  • 131
3 votes
3 answers
166 views

What's the alternative for the standard verbatim environment that can be used inside argument/does not change catcode?

How can I get something to typeset the output identical to that of a verbatim environment, e.g. of this code \documentclass[12pt]{article} \begin{document} before \begin{verbatim} 123456_789$^% \end{...
user avatar
  • 1,444
1 vote
1 answer
75 views

Adjust space between words in \mathrm

I defined the following command: \newcommand{\mymathrm}[1]{\operatorname{\mathrm{#1}}} The problem is that $\mymathrm{A B}$ gives something like AB, which does not typeset the space between A and B. ...
user avatar
1 vote
0 answers
91 views

TeX or LaTeX file with a hidden pasword

This question is inspired by this one: Convert PDF to PDF of images? As the author does have the code, creating a LaTeX version that is difficult to decrypt seems to be a good solution. Certainly, it ...
user avatar
1 vote
1 answer
48 views

What is causing punctuation to appear around my matrices?

I have an input file called mathchar.tex, which I rely on pretty heavily: \mathchardef\Gamma="7400 \mathchardef\Delta="7401 \mathchardef\Theta="7402 \mathchardef\Lambda="7403 \...
user avatar
  • 257
2 votes
1 answer
49 views

redefining & within an environment

I've been following the solution here to get tikzcd and the externalisation library to play nicely with each other. One step of this redefines &. However, at the moment, it does this for the whole ...
user avatar
3 votes
2 answers
47 views

Are there any significant differences between letter and other catcode in stored token lists?

While parsing input, the catcode 11 (letter) and 12 (other) are different (that the latter cannot appear as a part of a multi-character control sequence). However, when they're already parsed it doesn'...
user avatar
  • 1,444
2 votes
2 answers
248 views

Automatically change l to \ell in a math mode

I want to find a way how to automatically change "l" into "\ell" in a math mode. I tried to do it using \catcode, but it's quite difficult for me. I want it to change "l" ...
user avatar
0 votes
1 answer
37 views

How to load amsfonts/umsa.fd

I changed the catcode of F to active in my environment and now I can't use math mode. The problem is this: (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd ! Undefined control sequence. l.29 \...
user avatar
  • 87
7 votes
2 answers
178 views

Increase the skip after a comma, in math mode

I want to define a command \widecomma, so that $\widecomma{a,b}$ looks the same as $a,~b$. The following is my attempt. \let\comma, \newcommand{\widecomma}[1]{\begingroup\catcode`,=\active\newcommand,...
user avatar
1 vote
0 answers
46 views

Create a new `catcodetable` in LuaLaTeX

The latest LaTeX versions incorporated the luatexbase package in the kernel. The package predefined a number of named catcode tables, which have now been absorbed in the kernel. These named tables can ...
user avatar
4 votes
2 answers
179 views

Consequences of setting \mathcode of letters and symbols to "8000?

I know this is not something that you’re supposed to do. But for fun, I played around with the idea of changing the \mathcode of all letters to "8000 and defining them as commands. Each such ...
user avatar
  • 10.9k
3 votes
2 answers
84 views

Force \endlinechar to reset before the end of last line

I am creating a macro which should write its argument as a literal string to an external file. This is its current state: \newcommand{\mycmd}{% \begingroup \let\do\@makeother \dospecials \...
user avatar
3 votes
1 answer
162 views

Why does space with catcode 12 yield a weird dash?

For fun, let’s change the category code of space to 12. Then we get the following weird dash instead of a space. Why? \documentclass{article} \begin{document} \begingroup \catcode` =12 Hello World,...
user avatar
  • 10.9k
2 votes
1 answer
97 views

Writing zeros with backslash natively

To avoid the general confusion with 0,O,o in general text, I am trying to define my own zero with a backslash within it (it also remains distinct from the \emptyset symbol or similar alphabets from ...
user avatar
  • 487
1 vote
1 answer
42 views

datatool - How can you load database from .csv-file with values tokenized with same catcode-settings as are used by \verb|...|?

I plan to use the package datatool for loading a .csv-file as database: \DTLloaddb[<options>]{<db name>}{<filename>} How to achieve tokenizing values of that database under the same ...
user avatar
2 votes
1 answer
78 views

Hyperlink in a footnote containing a %

I want to write a link to a webpage into a footnote. Using the hyperref package, this works fine unless I have a % symbol in the link. This is the MWE (which is not working): \documentclass[12pt]{...
user avatar
  • 343
1 vote
1 answer
79 views

What's the function of the @ symbol? [duplicate]

I'm sure that this is TeX basics and I'm just being a fool, but I can't figure out for what/how the @ symbol is used. All I can tell is that to make sure it works you have to put it between \...
user avatar
0 votes
1 answer
104 views

On the proper use of `\tl_rescan`

Looking at the code below, what would the setup in 6. have to be to return F? Also, why does 2. return F in other words how are \group_begin: and \c_group_begin_token different? \begin{enumerate} \...
user avatar
  • 1,868
1 vote
1 answer
62 views

Prevent babel shorthands from interfering with catcode changes

I want to write an XML-like key-value-parser for LaTeX. That is, kv-pairs are separated by spaces, and values are separated from keys by = and encapsulated by double qoutes. The following minimal ...
user avatar
  • 2,325
3 votes
1 answer
48 views

Non letter name in command definition

I'd like to define similar commands one with underscore the other — without. However such an approach throws me an error \def\Fix#1{\mathrm{Fix}(#1)} \def\Fix_#1#2{\mathrm{Fix}_{\,#1}(#2)} I tried to ...
user avatar
  • 1,849
1 vote
3 answers
81 views

Reducing space only within parenthesis

I would like to reduce the spacing around relation symbols that appear within parenthesis from thickmuskip to thinmuskip. Here is what I have come up with: \documentclass{article} \usepackage{xcolor} \...
user avatar
  • 226
4 votes
1 answer
117 views

Define \textunderscore to mimic look of standard underscore

I noticed that the look of the underscore _ differs greatly from the look of \textunderscore How can I redefine \textunderscore to look like the standard underscore of the set font? I want to avoid ...
user avatar
1 vote
2 answers
88 views

what do these commands do

Could anyone explain what the commands \@tempcntb \count@\@ne \@curtab For reference, I found them on How to produce a list of prime numbers in LaTeX i do understand that i can create new counts ...
user avatar
  • 903
3 votes
1 answer
84 views

How do I make a character active only in text mode?

I want to make the character > active only in text mode (to create markdown-style block quotes) but not in math mode. I know the \mathcode`>="8000 way to make a character active only in ...
user avatar
  • 903
3 votes
2 answers
216 views

Default enumerate environment with easylist syntax

With the package easylist, we can create nested lists easily: \documentclass{article} \usepackage[at]{easylist} \begin{document} \begin{easylist} @ First % -> 1. First @@ Second % -&...
user avatar
  • 105
5 votes
1 answer
163 views

catcode 12 spaces

I would like to understand TeX's behaviour when the catcode of the space character is set to 12. The following two example input files differ in just one position: where the first has the character 4 ...
user avatar
0 votes
1 answer
54 views

Ask LuaLaTeX to ignore an active catcode previously written into aux file by pdflatex

I'm writing a package that loads babel and which users might run under either pdflatex or lualatex. When babel's french option is loaded, ":" is made active; and pdflatex writes the ...
user avatar
  • 2,054
4 votes
1 answer
132 views

Why does TeX have so many category codes?

When I look at the long list of category codes, I simply don’t understand why they are all needed. For instance: $, ^, _, and & could have easily been defined as active characters instead. ...
user avatar
  • 10.9k
0 votes
0 answers
61 views

How are class, package, document writers using modifications to \catcode

I'm thinking that the primary uses of changing \catcode in LaTeX are to: enable “private” macros (e.g., \makeatletter ... \@foo ... \makeatother or the expl3 syntax allow for verbatim-like commands/...
user avatar
  • 12.9k
2 votes
1 answer
73 views

Display blank lines at half-height in fancyvrb Verbatim environment

I'm typesetting code that includes lots of blank lines, like this: \documentclass{minimal} \usepackage{fancyvrb} \begin{document} \begin{Verbatim} def xyz(): """Some documentation. ...
user avatar
  • 3,914
1 vote
0 answers
32 views

`\makeatletter` and `\makeatother` : the difference relationship and usage of [duplicate]

Can a MWE be given showing the difference, relationship and usage of \makeatletter and \makeatother ? The existing answer explain these commands but do not provide a useful MWE which would show the ...
user avatar
  • 1,838
0 votes
0 answers
58 views

How to make brackets work like group separators?

I know that the following is not something you are usually supposed to do, but I ask anyway: I am getting quite tired of the fact that TeX does not treat the content of brackets [...] as groups like {....
user avatar
  • 10.9k
0 votes
1 answer
60 views

catcode in expl3 string

(Forgot where I saw this but should be some official doc): A TEX string (and thus an expl3 string) is a series of characters which have category code 12 (“other”) with the exception of space ...
user avatar
  • 597
0 votes
1 answer
29 views

Misplaced \noalign following two newlines

Why does a \noalign command produce a ! Misplaced \noalign when it follows at least two newlines. For example, this code works : \documentclass[10pt,letterpaper]{article} \begin{document} \halign{\...
user avatar
4 votes
1 answer
149 views

Catcode change for command arguments

I want to write commands that can have arguments within <> by changing the catcode of the two signs. \documentclass{beamer} \newcommand{\mycommand}[3]{ This is #1. This is #2. This is #3. } \...
user avatar
  • 148
4 votes
3 answers
475 views

About catcodes and active characters

I'm reading about catcodes and I want to play a bit with them. However, there's a point I don't really understand. When I want to define an active character, e.g., square brackets ([ and ]) I do the ...
user avatar
1 vote
1 answer
30 views

incompatibility of xparse e- and t-type argument with subscriptcorrection option of newtxmath

It appears that the subscriptcorrection option for newtxmath is incompatible with e- and t-type arguments of xparse that use _. Using examples adapted from egreg's answers here and here, the following ...
user avatar
  • 35
3 votes
1 answer
333 views

Setting the backslash's catcode

For fun, I want to change the backslash's catcode from 0 to 12. However, I can't seem to make it work. Here's my current MWE, which gives an error "improper alphabetic constant": \catcode`\...
user avatar
  • 447
4 votes
0 answers
57 views

amsart + \makeatletter + @ @ @ in a caption = disappear

In some circumstance adding @ into the caption will cause it to disappear. This can be solved by adding \makeatother at proper places. I just want to know why is this happening. \documentclass{amsart}...
user avatar
  • 35.4k

1
2 3 4 5
7