[NTG-context] ASCII mode within \footnote

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Thu Nov 7 23:04:18 CET 2019


 > Hello,
 >
 > thanks Aditya and Wolfgang for "deep" explanation in several last
 > mails.
 >
 > We are approaching the goal...
 >
 > Aditya's ocde:
 >
 > ----
 > \starttext
 >    \startasciimode
 >      \footnote{\type{%APPDATA%\file.txt}}
 >    \stopasciimode
 > \stoptext
 > ----
 >
 > gives (in the footnote):
 >
 > "
 > 1 %APPDATA%\file .txt
 > "               ^
 > ............... +------ So there is ONE UNWANTED SPACE - how to make
 > it disappear?
 >
 > Thank you again for patience and best regards,
 >
 > Lukas

When you use \type in the argument of another command there are some
limitation in TeX and this is another one.

The reason for the space is that TeX adds a space after a command when
it reads the argument which will in this case appears in the output.
When you use \type outside of the footnote this won't happens because
\file in the argument is treated as a backslash followed by four single
letters but in this case TeX handles it as the commend \file.

Below is a simple example which demonstrates the behaviour, with the
\detokenize command (nothing you need in a normal document) you can
visualize TeX's behaviour. The second example shows another problematic
characters.


\starttext

\type{\dummy.}

\firstofoneargument{\type{\dummy.}}

{\tt\detokenize{\dummy.}}

\blank

\type{#}

\firstofoneargument{\type{#}}

{\tt\detokenize{#}}

\stoptext


A way to avoid this problem is to use a slash a path separator
instead of the backslash. Another way to get rid of it is to save
the path a buffer and print the content of the buffer with the
\typeinlinebuffer command.


\starttext

\startbuffer
%APPDATA%\file.txt
\stopbuffer

\footnote{\typeinlinebuffer}

\stoptext


Wolfgang


More information about the ntg-context mailing list