[NTG-context] ASCII mode within \footnote

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Mon Nov 4 17:34:11 CET 2019


Aditya Mahajan schrieb am 04.11.2019 um 15:05:
> On Mon, 4 Nov 2019, Aditya Mahajan wrote:
>
> That should have been:
>
>> As Hans' mentioned, use:
>>
>> \startasciimode
>> \footnote{\type{%APPDATA%\file.txt}}
>> \stopasciimode

In a longer document setting \asciimode at the begin can be the better 
solution.

The reason why setting \asciimode in the \footnote doesn't work is that 
TeX uses
uses the meaning of a special character it had when it read the 
argument, i.e.
when TeX reads the text "%APPDATA%\file.txt" the percent sign acts as 
begin of
a comment and everything after it is ignored. As a result the asciimode 
command
can't work because the text has already disappeared.

Other characters like $ are less problematic because there are ways to 
change
their meaning afterwards (# can be tricky) but not comments because 
nothing remains.

\setupbuffer
   [before=\blank,
    after=\blank]

\starttext

Normal comment:

\startbuffer
     % comment
\stopbuffer

\typebuffer \getbuffer

Comment in \type{asciimode} environment:

\startbuffer
     \startasciimode
         % comment
     \stopasciimode
\stopbuffer

\typebuffer \getbuffer

Comment in the argument of a command:

\startbuffer
     \firstofoneargument
         {
             % comment
         }
\stopbuffer

\typebuffer \getbuffer

Comment in the argument of a command + \type{asciimode} in the argument:

\startbuffer
     \firstofoneargument
         {
             \startasciimode
                 % comment
             \stopasciimode
         }
\stopbuffer

\typebuffer \getbuffer

Comment in a argument after \type{asciimode} was enabled:

\startbuffer
     \startasciimode
     \firstofoneargument
         {
             % comment
         }
     \stopasciimode
\stopbuffer

\typebuffer \getbuffer

\stoptext

Wolfgang



More information about the ntg-context mailing list