Skip to main content

Questions tagged [active-characters]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
3 answers
146 views

Having ... (three dots) as macro name

For convenience (and also to deepen my LaTeX knowledge), I'm trying to define a list in a simple manner: \mylist(First, Second, Third, ...) Replacing the commas by something else (in this case by \...
E_3's user avatar
  • 43
1 vote
1 answer
128 views

How to handle babel active characters when writing a package?

In the bodeplot package, I defined new environments using (defined like this to avoid issues with externalization of tikz graphics) \documentclass{standalone} \usepackage{pgfplots,xparse} \pgfplotsset{...
Rushi's user avatar
  • 837
5 votes
1 answer
83 views

Active character only in text mode

I have the following code to replace ' to \textquotesingle, because I prefer this symbol when I type an apostrophe. \makeatletter \catcode`\'=\active \def'{\textquotesingle} \makeatother The problem ...
Agente 156's user avatar
3 votes
2 answers
138 views

Active character can be defined, but not within \def?

This is a follow up to my earlier question here: Detect catcode of next character? What I want to do: Count the number of " used in the document body. I am not using " for purposes such as ...
user avatar
3 votes
1 answer
90 views

Make only first space active

This is follow up to a previous question that has been closed because it was treated wrongly. Brief recap: let \newcommand{\foo}{foo}. Having \foo in text like so test \foo bar will omit the space ...
antshar's user avatar
  • 4,612
0 votes
1 answer
41 views

Prevent active character from being expanded in macro argument

Goal: Have an active character not expanded when writing to file MWE \documentclass{article} \makeatletter % == Package code -- untouchable \def\foo{\@ifnextchar[{\@foo}{\@foo[x]}} \...
aker's user avatar
  • 15
1 vote
1 answer
35 views

Detect space after active character does not handle trailing formatting macro

There's an active character * (can be anything, asterisk just used for demonstration purposes). If the character following * is a space, write \marginpar{foo}, otherwise write \marginpar{bar}. This ...
aker's user avatar
  • 15
0 votes
2 answers
143 views

How to print a vertical bar if it is \active?

I'm trying to print a vertical bar symbol, but it's \active in the ltxdoc document style (this code doesn't compile): \documentclass{ltxdoc} \begin{document} This is a vertical bar: |\|| \end{document}...
yegor256's user avatar
  • 12.1k
2 votes
1 answer
51 views

Make <: ... :> acts like one macro

I use jinja to write templates. This makes me work with files like the one below. \documentclass[a4paper, 12pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \newcommand\devtool[1]{\...
projetmbc's user avatar
  • 13.4k
5 votes
2 answers
125 views

Why does \newcommand on an already defined active character not yield an error?

We (or at least I) usually think of an active character as just another command whose name just happens to a character rather than a control sequence. So why does \newcommand<active character> ...
Gaussler's user avatar
  • 12.9k
2 votes
2 answers
71 views

How to define a new character while avoiding clashes with existing character definitions?

I want to define a new character. For context, in particular, my new character would act similar to the ^ character for superscripts, but would put parentheses around the context of the superscript. ...
ashman's user avatar
  • 121
1 vote
1 answer
129 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 ...
btshepard's user avatar
  • 680
10 votes
2 answers
608 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 ...
Andrew Stacey's user avatar
4 votes
2 answers
134 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.
Noldorin's user avatar
  • 910
2 votes
1 answer
106 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 ...
Doc Octal's user avatar
  • 369
1 vote
1 answer
85 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{...
Rajesh N's user avatar
  • 829
1 vote
1 answer
221 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 ...
user237114's user avatar
7 votes
2 answers
207 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 ...
Hu Yajie's user avatar
0 votes
0 answers
37 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 ...
Gaussler's user avatar
  • 12.9k
3 votes
2 answers
181 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 ...
user21820's user avatar
  • 878
3 votes
2 answers
176 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: & ...
Denis Bitouzé's user avatar
0 votes
0 answers
78 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, ...
Kumquat's user avatar
5 votes
1 answer
589 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 ...
Robbie's user avatar
  • 2,903
0 votes
0 answers
122 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,...
chsk's user avatar
  • 3,687
1 vote
0 answers
178 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. ...
murray's user avatar
  • 8,640
1 vote
2 answers
536 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 ...
wehro's user avatar
  • 101
5 votes
1 answer
153 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} \...
wehro's user avatar
  • 101
3 votes
1 answer
215 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 ...
schtandard's user avatar
  • 15.2k
1 vote
1 answer
245 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 ...
nagmat84's user avatar
  • 1,125
7 votes
1 answer
1k 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 ...
gusbrs's user avatar
  • 14k
0 votes
1 answer
222 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]{...
Tobard's user avatar
  • 1,211
1 vote
1 answer
96 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: \...
MiB's user avatar
  • 837
4 votes
1 answer
99 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 ...
cfr's user avatar
  • 205k
4 votes
2 answers
439 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}{?}...
xavierm02's user avatar
  • 787
2 votes
1 answer
231 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 ...
Zhiyuan Ding's user avatar
1 vote
2 answers
191 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 ...
Lupino's user avatar
  • 2,762
1 vote
0 answers
144 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{...
Toothrot's user avatar
  • 3,356
2 votes
1 answer
333 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 ...
Werner's user avatar
  • 606k
8 votes
1 answer
215 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\...
Bruno Le Floch's user avatar
6 votes
1 answer
437 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 ...
Gradient's user avatar
  • 489
13 votes
3 answers
3k 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 ...
ebosi's user avatar
  • 11.8k
3 votes
1 answer
240 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, ...
Peater de Xel's user avatar
5 votes
2 answers
181 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}...
JPi's user avatar
  • 13.7k
7 votes
2 answers
104 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 ...
cfr's user avatar
  • 205k
6 votes
1 answer
504 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} ...
Matthias's user avatar
  • 459
7 votes
2 answers
372 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 ...
Sean Allred's user avatar
  • 27.5k
3 votes
1 answer
291 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, ...
ifrh's user avatar
  • 199
4 votes
1 answer
138 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 ...
Tarass's user avatar
  • 17k
6 votes
2 answers
378 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 ...
Nobody moving away from SE's user avatar
3 votes
1 answer
544 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}...
Z.H.'s user avatar
  • 3,356