ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Escaping reserved/problematic characters
@ 2021-03-11 17:37 Benct Philip Jonsson
  2021-03-11 18:03 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Benct Philip Jonsson @ 2021-03-11 17:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 891 bytes --]

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!):

    '{': "\\{"
    '}': "\\}"
    '_': "\\_"
    '%': "\\%"
    '#': "\\#"
    '$': "\\$"
    '&': "\\&"
    '`': "\\textasciigrave{}"
    '^': "\\textasciicircum{}"
    '~': "\\textasciitilde{}"
    '\\': "\\textbackslash{}"
    '|': "\\textbar{}"
    '<': "\\textless{}"
    '>': "\\textgreater{}"
    '[': '{[}'
    ']': '{]}'

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
& < > " ').

TIA,

/Benct

[-- Attachment #1.2: Type: text/html, Size: 1830 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Escaping reserved/problematic characters
  2021-03-11 17:37 Escaping reserved/problematic characters Benct Philip Jonsson
@ 2021-03-11 18:03 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2021-03-11 18:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-11 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 17:37 Escaping reserved/problematic characters Benct Philip Jonsson
2021-03-11 18:03 ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).