[NTG-context] Escaping reserved/problematic characters

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Thu Mar 11 19:03:02 CET 2021


Benct Philip Jonsson schrieb am 11.03.2021 um 18:37:
> In a program I'm writing I have a function for escaping characters which 
> are reserved or problematic in LaTeX. I would like to have a 
> corresponding function for ConTeXt, so I'm wondering which ones are 
> different/superfluous/missing from a ConTeXt perspective in the 
> following list (sorry about the formatting!):
> 
>      '{': "\\{"

\letterleftbrace

>      '}': "\\}"

\letterrightbrace

>      '_': "\\_"

No escape needed.

>      '%': "\\%"

\letterpercent

>      '#': "\\#"

\letterhash

>      '$': "\\$"

\letterdollar

>      '&': "\\&"

No escape needed.

>      '`': "\\textasciigrave{}"

\textgrave

>      '^': "\\textasciicircum{}"

\letterhat

>      '~': "\\textasciitilde{}"

\lettertilde

>      '\\': "\\textbackslash{}"

\letterbackslash

>      '|': "\\textbar{}"

\letterbar

>      '<': "\\textless{}"
>      '>': "\\textgreater{}"
>      '[': '{[}'
>      ']': '{]}'

No escape needed.

> Note that I'm not looking for accented letters, Unicode quotes and 
> dashes etc. I'm assuming that people in the year 2021 are using an 
> UTF-8-aware engine (and my corresponding HTML escape function similarly 
> caters only to & < > " ').

Another option is to use \utfchar, e.g. \utfchar{0x60}

Wolfgang


More information about the ntg-context mailing list