Re: [NTG-context] ASCII mode within \footnote

2019-11-02 Thread Aditya Mahajan

On Sat, 2 Nov 2019, cont...@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
___
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
___


Re: [NTG-context] ASCII mode within \footnote

2019-11-02 Thread context

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 "%".)


Best regards,

Lukas


On 2019-11-01 14:36, Hans Hagen wrote:

On 11/1/2019 2:23 PM, cont...@vivaldi.net wrote:

Hello,

the following code doesn't compile:


\starttext
   \startasciimode %@$\stopasciimode
   A
   \footnote{\startasciimode %@$\stopasciimode} %  Try to comment 
this

\stoptext


When the line with \footnote is commented, compilation works fine.

What's "evil" in \footnote{\startasciimode %@$\stopasciimode}?
the fact that startasciimode will not be in action as it's passed as 
argument


\starttext
\startasciimode
%@$
A
\footnote{%@$} %  Try to comment this
\stopasciimode
\startasciimode
\footnote{%@$}
\stopasciimode
\stoptext

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-

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