ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Mathieu Boespflug <mboes@tweag.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Bad interaction between new interpretation of underscore and modules
Date: Fri, 14 Jan 2011 11:09:50 +0100	[thread overview]
Message-ID: <AANLkTimE7cJaX=vDSfzCjL1v6a=th6D3z-YBWGRWb-ms@mail.gmail.com> (raw)
In-Reply-To: <B46A2A71-1FB5-4653-B32C-BCDD85DD5E52@gmail.com>

Hi Wolfgang,

thank you for the explanation and the solution.

Best,

Mathieu

On Fri, Jan 14, 2011 at 10:32 AM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 14.01.2011 um 10:15 schrieb Mathieu Boespflug:
>
>> Thank you for the solution, Wolfgang.  But it seems rather painful to
>> have to replace every occurrence of _ in my definitions module with
>> the very verbose \normalsubscript just because it's a module. The new
>> default catcode for _ introduces extra difficulty when defining math
>> macros. Would it be possible to at least have a macro to revert to the
>> old behaviour? Also, I'm still stumped as to why modules make any
>> difference here. I would have expected this problem to also show up if
>> the definitions were made inline at the top of the source file for the
>> document.
>
> When you write a module you put \unprotect and \protect at the begin and
> end of the file because they make @, !, ? and _ to a normal letter like abc
> which can be used in macros. When you load a file with \usemodule or
> \environment this isn’t necessary because context adds already calls
> both commands when the file is opened and closed for reading and this
> mechanism is used even if you aren’t aware of this.
>
> PS  For \environment this is only true when you use it in a document
> with \starttext or when you write it before \startproduct, \startcomponent etc.
>
> PPS  You can abuse \nonknuthmode to make your module to work
>
> \startbuffer[definitions]
> \pushcatcodes\nonknuthmode % \startnonknuthmode
> \def\lambdax{\lambda_x}
> \popcatcodes               % \stopnonknuthmode
> \stopbuffer
>
> \savebuffer[definitions][p-definitions.tex]
>
> \startbuffer[more]
> \def\morex{\more_x}
> \stopbuffer
>
> \savebuffer[more][p-more.tex]
>
> \usemodule[definitions,more]
>
> \starttext
> blah $\lambdax$ blah. \morex
> \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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2011-01-14 10:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 16:18 Mathieu Boespflug
2011-01-13 21:50 ` Wolfgang Schuster
2011-01-13 22:43   ` Aditya Mahajan
2011-01-14  0:14     ` Wolfgang Schuster
2011-01-14  9:15   ` Mathieu Boespflug
2011-01-14  9:32     ` Wolfgang Schuster
2011-01-14 10:09       ` Mathieu Boespflug [this message]
2011-01-14 11:01     ` Hans Hagen
2011-01-14 11:13       ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimE7cJaX=vDSfzCjL1v6a=th6D3z-YBWGRWb-ms@mail.gmail.com' \
    --to=mboes@tweag.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).