ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Escaping reserved/problematic characters
Date: Thu, 11 Mar 2021 19:03:02 +0100	[thread overview]
Message-ID: <48cf5e8d-37e4-e450-cf90-9ab62d3643d3@gmail.com> (raw)
In-Reply-To: <CAFC_yuRB9Rbk_CT4ZULcG2ktDbQNH_jJCHv=OyP1AOzJtwAooQ@mail.gmail.com>

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
___________________________________________________________________________________

      reply	other threads:[~2021-03-11 18:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 17:37 Benct Philip Jonsson
2021-03-11 18:03 ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48cf5e8d-37e4-e450-cf90-9ab62d3643d3@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).