[NTG-context] ASCII mode within \footnote

context at vivaldi.net context at vivaldi.net
Mon Nov 4 12:36:10 CET 2019

Hello Aditia,

thanks for reaction.

I simply want to write "%APPDATA%\file.txt" and the same into the
footnote, with ability to use the text "%APPDATA%\file.txt" without any
substitution (like "%" -> "\letterpercent") - if possible.

My attepmts with \text or \asciimode fail:

----
\starttext
\type{%APPDATA%\file.txt}
\footnote{%
%\type{%APPDATA%\file.txt}
%\asciimode{%APPDATA%\file.txt}
}
\stoptext
----

Even plays with

%\catcode\commentasciicode=\othercatcode
%\catcode\backslashasciicode=\othercatcode

don't give the desired result.

So - is there a simple way how to get strings with "%" and "\" (which
represent a path on Windows) into footnote?

Best regards,

Lukas

On 2019-11-02 16:35, Aditya Mahajan wrote:

> 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.
>