[NTG-context] ASCII mode within \footnote

Aditya Mahajan adityam at umich.edu
Sat Nov 2 16:35:46 CET 2019


On Sat, 2 Nov 2019, context at vivaldi.net wrote:

> Hello,
>
> OK, thanks for reaction.
>
> One more example - \text instead of ascii mode:
>
> ----
> \starttext
>   \type{%@$}
>   A\footnote{\type{*\$%
>   }}
>   B\footnote{\type{*\$\%
>   }}
> \stoptext
> ----
>
> gives:
>
> "
> *\$
> *\$\%
> "
>
> in the footnote.
>
> IOW, I cannot simply print "%": "%" at the end yields "" whilst "\%" 
> produces "\%".
>
> Is there a simple way to prinst simple "%"?
> (There is probably a more clumsy way - type \letterpercent instead of % 
> - but this is a minimal sample; in my real sample there are many "%"s to 
> be shown as "%".)

Why not just use asciimode?

To understand why \footnote{\type{...}}} doesn't work, you need to 
understand TeX's "digestive system". \type{...} (and asciimode) work by 
modifying the catcode tables. However, they are are used inside a 
footnote, the argument of \footnote is parsed according to the catcode 
table which is active when footnote is passed. Under the default catcode 
table, % is a comment, so when you type:

\footnote{\type{*\$%
}}

the argument of \footnote is `\type{*\$}`

So, if you want \footnote to "see" the %, you need to activate a catcode 
table where % is a letter. So, the simplest solution is to use \asciimode.

Aditya


More information about the ntg-context mailing list