Questions tagged [active-characters]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
78 views

What characters are active by default in TeX?

Since the character ~ has a catcode of 13, it is considered active. I can (ab)use this by executing something like the code \let~\catcode ~`a8 which assigns the character a a catcode of 8 (for ...
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 ...
9 votes
2 answers
534 views

In LaTeX3, how do I peek ahead for an active character?

LaTeX3 defines the \peek_catcode_ignore_spaces:NTF which allows me to look ahead at the next token in the stream (ignoring spaces) and test its catcode against those of a slew of standard tokens. So ...
4 votes
2 answers
70 views

Redefine active character `~` in expl3

Is there any way to redefine the tilde (~) active character in expl3 syntax? In expl2, I would simply do something like \let~\relax, but due to the interpretation of ~ in expl3, this is not possible.
2 votes
1 answer
69 views

How to use str_foldcase in the preamble without generating a missing begin document error

Edit Thanks to @PhelypeOleinik for pointing out the problem wasn't the \str_foldcase itself but the switch statement bodies trying to typeset text before the document has begun. The cognitive overload ...
1 vote
1 answer
31 views

\lccode to be activate in latex command

Why does \lccode`~=`, with an active , work only in an environment definition but not in a LaTeXcommand? We are using an active , to produce bullets: Here is an MWE: \documentclass{book} \usepackage{...
1 vote
1 answer
56 views

Hyphenate character inside a table

I am generating a long table that has 3 columns. The content of the table contains words that contain underscore such as "ABCD_243_SSD_FCA_SDD" and using the hyphenate package I managed to ...
6 votes
2 answers
175 views

Why don't unexpandable active characters work in \csname...\endcsname?

Page 213 of The TeXbook has a definitive explanation of \csname...\endcsname: When TeX expands \csname it reads to the matching \endcsname, expanding tokens as it goes; only character tokens should ...
0 votes
0 answers
35 views

What kinds of constructions are `, --, ---, and ``? [duplicate]

A couple of questions of a similar nature: We all know that -- prints an endash, while --- prints an emdash. But - is not an active character, right? So how does TeX process -- and --- and make them ...
3 votes
2 answers
152 views

Make equality-sign automatically blue

I know that we can redefine inequality-signs such as \le by simply doing \let\oldle\le and \def\le{\mathrel{...}}. But I have no idea how to redefine the equality-sign =. So if I want to automatically ...
3 votes
2 answers
155 views

Characters made active and used the same way to define macros behave differently in verbatim environments

The following MCE shows that Unicode and ASCII characters made active and used exactly the same way to define macros, when compiled with lualatex, behave differently in verbatim environments: & ...
0 votes
0 answers
69 views

Adjusting spacing in mathdesign

I like mathdesign package, but spacing between some letters looks pretty awful, for example, look at the letter A: I've found the solution here: Make Characters Active via Macro in Math Mode. So, ...
5 votes
1 answer
177 views

What are use-cases for active characters?

The TikZ manual has this little gem of wisdom in its description of the \foreach command (emphasis mine): In the easiest case, ‹variables› is a single TeX command like \x or \point. (If you want to ...
0 votes
0 answers
99 views

Polyglossia: babelshorthands stopped working in \title

I'm using polyglossia rather than babel for multilingual documents, with babel's shorthands activated for the German language so I can easily add explicit hyphens to words without breaking hyphenation,...
1 vote
0 answers
91 views

Which characters are safe to use in labels?

To my dismay, I've learned that it is unsafe to use the colon (:) in labels if you are using babel-french together with at least one other package, namely, crossreftool, which operates upon labels. ...
1 vote
2 answers
249 views

Active apostrophe character in math mode

For some reason, I need a package providing an active apostrophe. For the sake of simplicity, let's say that every apostrophe shall be replaced by ABC in text mode. In math mode, the default behaviour ...
5 votes
1 answer
143 views

Apostrophe in math formula prevents luatex compilation for Slovak

The following example can be compiled with pdflatex or xelatex without any problems, but with lualatex, the compilation comes never to an end. \documentclass{article} \usepackage[slovak]{babel} \...
1 vote
1 answer
164 views

Babel shorthands not working with `beamer` class (quotation mark not recognized as active character)

For the German language the babel package defines a set of shorthand commands that I use quite often. They all start with a quotation mark (") which is redefined as an active character. In detail, I'm ...
3 votes
1 answer
149 views

Getting a list of active characters

There are some characters that are active in plain TeX (e.g. ~) and some packages like babel make additional characters active (e.g. "). Is there a way to get a list of all active characters from ...
4 votes
1 answer
569 views

Character choice for csquotes active quotes

We all know csquotes and the multiple facilities it provides for displaying quotations and related content. One feature I'm particularly fond of are the active quotes, using \MakeAutoQuote. That's ...
0 votes
1 answer
151 views

Use of \NoAutoSpacing inside a macro

I would like to locally deactivate the colon character (made active by babel package used with frenchb option). But it appears to not work within a macro: \documentclass{article} \usepackage[frenchb]{...
1 vote
1 answer
77 views

glossaries and csquotes: how to use autoquotes in gls description?

I am trying to get csquotes's \MakeAutoQuote to work with glossaries - no luck so far. The defined autoquotes are simply not active anymore by the time the description is read. Here is the MWE: \...
4 votes
1 answer
93 views

How can I fix active quote mark characters on update to TL 2018? [duplicate]

MWE: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{csquotes} \MakeAutoQuote{‘}{’} \MakeAutoQuote*{“}{”} \begin{document} Hylo \end{document} This code works fine with pdfLaTeX ...
4 votes
2 answers
285 views

Code redefining ampersand stops working when put in command

I want to redefine & in a command. I tried to adapt this code that redefines ^ in an environment but couldn't make it work. \documentclass[]{article} \begin{document} \newcommand{\myampersand}{?}...
2 votes
1 answer
174 views

Conflict of active strings in WinEdt

I am using WinEdt 10.2. I designed two active strings which do the following jobs. One active string automatically changes "\c?}" into "\mathcal{?}" if ? is a single uppercase letter and does nothing ...
1 vote
2 answers
126 views

Remap single character within fontstyle definition

I have created a font from otf using autoinst to typeset some chord symbols in TeX. This font is designed (by its creator) to map character positions to certain musical symbols, like the small latin ...
1 vote
0 answers
105 views

Deactivating an active character

How do I deactivate an active character? The following works without the activizations in the preamble, but not with them, in spite of my attempt to reset the catcode of : to 12. \documentclass{...
2 votes
1 answer
240 views

How to map special characters in CSV to something else when processing via datatool

The datatool user guide mentions that certain special characters are automatically mapped to the typesetting equivalent when loading a database in raw mode (via \DTLloadrawdb). If you want to change ...
8 votes
1 answer
200 views

LuaTeX analogue of \ifcsname for active characters

In pdfTeX or XeTeX the following code runs through active characters and eventually produces an error such as Invalid code (1114112) (but with 256 in pdfTeX). \catcode`*=13 % active \count0=32 \def\...
5 votes
1 answer
351 views

Why is \active defined as \char13 (and not 13)?

In plain TeX, we have \chardef\active=13 \catcode`\~=\active I thought a catcode should be assigned a number between 0 and 15, but \active is \char13. So how does it work? Would \catcode`\~=13 also ...
12 votes
3 answers
2k views

How to deactivate % as special character?

Background: I use LaTeX to display data that are automatically produced. I cannot manually change the raw data (since they are frequently updated). But this raw text contains LaTeX's special ...
3 votes
1 answer
212 views

redefine caret ^ while using mathtools package

consider the following MWE: \documentclass{article} %\usepackage{mathtools} \newcommand\newCaret{X} \catcode`^=\active \let^=\newCaret \begin{document} $x^2$ \end{document} this works fine, ...
5 votes
2 answers
166 views

How to make active characters work differently in mathmode and text mode?

Still learning about active characters, catcodes, mathcodes, and such. I know how to make *hello* produce bold in text mode and $x$ produce a bold $x$ in math mode. I also know how to make *{hello}...
7 votes
2 answers
95 views

How can I conditionally designate an active quote in csquotes.cfg?

How can I conditionally designate an active quote in csquotes.cfg so that no error is produced if the same character is made into an active quote in the .cfg and the document's preamble? I have the ...
6 votes
1 answer
369 views

How to use comma-separated argument list in Verbatim environment?

When I try this: \documentclass{article} \usepackage{fancyvrb} \usepackage{xcolor} \begin{document} \begin{Verbatim}[commandchars=\\\{\}] \textcolor[RGB]{255,0,0}{test} \end{Verbatim} \end{document} ...
3 votes
1 answer
931 views

How to make hyperref work with bibitem keys containing a colon and using babel french option?

As seen in this thread, the \cite command bugs when the selected language is French and a bibitem key contains a :, which is an active character in babel french. Indeed, concerned hyperlinks always ...
7 votes
2 answers
313 views

'Missing \begin{document}' when using the \lowercase trick

Mostly for fun, I'm trying to make % comments manipulatable using the \lowercase trick. For some reason, I'm getting a strange (to me) error: ERROR: LaTeX Error: Missing \begin{document}. --- TeX ...
3 votes
1 answer
244 views

How avoid "\T1\ss " as output from \immediate\write and get ß?

\usepackage[ngerman]{babel} \usepackage[T1]{fontenc} \usepackage[ansinew]{inputenc} ... \newwrite\outfile \immediate\openout\outfile=\jobname.txt % aßbc is a replacement for a long german text-block, ...
4 votes
1 answer
130 views

LuaLaTeX : passing test condition n~=3 to lua as macro parameter problem

I try to pass lua test condition as latex macro parameter and have a problem in case of ~= with the next error message. How to avoid that. ! LuaTeX error [\directlua]:1: invalid escape sequence ...
2 votes
1 answer
224 views

Argument until non-alphanumeric character

Not sure if this is possible or not... I would like to turn (say) + into a command with one argument without braces. This argument should be everything following the + up until the first non-...
6 votes
2 answers
353 views

Replace digits by arbitrary symbols

I want to write some macro that replaces all digits in its argument by previously defined symbols or macros. I envision something like \overrideDigits{1234567890} which should expand to something ...
2 votes
1 answer
512 views

Modify catcode in the preamble or in the \AtBeginDocument?

I want to modify the catcode of comma, with the following code \documentclass{article} \AtBeginDocument{% \catcode`\,=\active \protected\def,{...}% } \begin{document} a,b,c $a,b,c$. \end{document}...
2 votes
1 answer
617 views

babel's active " making problems in math mode

MWE \documentclass[norsk]{beamer} \usepackage[utf8]{inputenc} \usepackage{babel} \usetheme{Warsaw} \begin{document} \begin{frame} ``forkaster hypotesen om at $P(\text{"mynt"})=0,5$''. \end{frame} ...
4 votes
1 answer
234 views

How can I use the ampersand (&) as a delineator for tabs in LaTeX3 (expl3)/xparse syntax?

This idea evolved from the question: How can I get a count of the optional arguments with xparse? Problem I cannot get the ampersand to function as a delineator (for tab stops) inside the \...
23 votes
3 answers
6k views

Use Markdown-style formatting for bold and italic

I rather like the system here where *...* is italic, **...** is bold, and ***...*** is bold italic. Is it possible to do that in (La)TeX? A MWE that implements the first one: \documentclass{article} ...
4 votes
1 answer
307 views

Error in some rare circumstances: babel with french option after listings, active character in moving argument, code in listing across pages

Edit: I have edited my question which initially wrongly focused on labels. This question is related to Code in \lstlisting breaks document (compile error). Let us consider the following MWE: \...
10 votes
1 answer
333 views

Why does \def@#1\space not work?

The code \documentclass{article} \begin{document} \begingroup \catcode`@\active \def@#1\par{<#1>} @some text \endgroup \end{document} works flawlessly. Why not so when I replace it by the ...