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

2019-11-08 Thread context

Hello,

many thanks again, especially \type[compact=absolute] and 
\typeinlinebuffer solve my problem!


Best regards,

Lukas


On 2019-11-08 09:52, Hans Hagen wrote:

On 11/8/2019 12:11 AM, Aditya Mahajan wrote:

On Thu, 7 Nov 2019, Wolfgang Schuster wrote:


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


Another option, if you have many such files is to define a macro:

\define[1]\APPDATA{\mono{\letterpercent 
APPDATA\letterpercent\letterbackslash#1}}


And then use:

\footnote{\APPDATA{file.txt}}

or ...

\footnote{\type[compact=absolute]{%APPDATA%\file.txt}}

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

___
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-08 Thread Hans Hagen

On 11/8/2019 12:11 AM, Aditya Mahajan wrote:

On Thu, 7 Nov 2019, Wolfgang Schuster wrote:


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


Another option, if you have many such files is to define a macro:

\define[1]\APPDATA{\mono{\letterpercent 
APPDATA\letterpercent\letterbackslash#1}}


And then use:

\footnote{\APPDATA{file.txt}}

or ...

\footnote{\type[compact=absolute]{%APPDATA%\file.txt}}

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


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

2019-11-07 Thread Aditya Mahajan

On Thu, 7 Nov 2019, Wolfgang Schuster wrote:


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


Another option, if you have many such files is to define a macro:

\define[1]\APPDATA{\mono{\letterpercent 
APPDATA\letterpercent\letterbackslash#1}}

And then use:

\footnote{\APPDATA{file.txt}}

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-07 Thread Wolfgang Schuster

> 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
___
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-05 Thread context

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


On 2019-11-04 15:05, Aditya Mahajan wrote:

On Mon, 4 Nov 2019, Aditya Mahajan wrote:

That should have been:


As Hans' mentioned, use:

\startasciimode
\footnote{\type{%APPDATA%\file.txt}}
\stopasciimode


Aditya
\starttext
  \startasciimode
\footnote{\type{%APPDATA%\file.txt}}
  \stopasciimode
\stoptext


t4.pdf
Description: Adobe PDF document
___
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-04 Thread Wolfgang Schuster

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

___
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-04 Thread Aditya Mahajan

On Mon, 4 Nov 2019, Aditya Mahajan wrote:

That should have been:


As Hans' mentioned, use:

\startasciimode
\footnote{\type{%APPDATA%\file.txt}}
\stopasciimode


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-04 Thread Aditya Mahajan

On Mon, 4 Nov 2019, cont...@vivaldi.net wrote:


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?


As Hans' mentioned, use:

\startasciicode
\footnote{\type{%APPDATA%\file.txt}}
\stopasciicode

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-04 Thread context

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.

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


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

2019-11-01 Thread Hans Hagen

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
___


[NTG-context] ASCII mode within \footnote

2019-11-01 Thread context

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}?

Best regards,

Lukas
\starttext
  \startasciimode %@$\stopasciimode
  A
  %\footnote{\startasciimode %@$\stopasciimode}
\stoptext


t.pdf
Description: Adobe PDF document
___
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
___