ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Treating underscore as a normal character
@ 2007-02-06 21:41 Berend de Boer
  2007-02-06 22:06 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Berend de Boer @ 2007-02-06 21:41 UTC (permalink / raw)
  To: ConTeXt mailinglist

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

In computer code underscores are used frequently. Until recently sticking

  \catcode`\_=12

somewhere at the top did work, but it has become harder. More stuff
seems to reset this, so I know have to stick it just above \starttext.

But that doesn't help in all cases.

I get this for example:

- --------------------------------------------------
structure       : begin of sectionblock appendices
(./eposix-classes.tuo
! Missing $ inserted.
<inserted text> 
                $
<to be read again> 
                   _
<argument> STDC_
                BASE
\Eclass #1->#1
              
\listtextcommand #1->\begstrut #1
                                 \endstrut 
\doattributes ...sname #1#2\@EA \endcsname \fi {#4
                                                  }\dostopattributes 
...
l.24 ...class {STDC_BASE}}{3--0-1-1-0-0-0-0--5}{6}
- --------------------------------------------------


And when I look at line 24 in eposix-classes.tuo I see:

\listentry{section}{2}{A.1}{Short form of \Eclass {STDC_BASE}}{3--0-1-1-0-0-0-0--5}{6}


Is there a method to fix this to avoid typing \_ all the time? I just
want a global switch that says _ is perfectly ok. Only inside $ it
should be treated as something special.

- -- 
All the best,

Berend de Boer


PS: This email has been digitally signed if you wonder what the strange
characters are that your outdated email client displays.
PGP public key: http://www.pobox.com/~berend/berend-public-key.txt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFFyPXuIyuuaiRyjTYRAs8KAKDU+kx9Jxjn3MCDWxSdfV66qxrhbwCeLBTh
6RHeWoUsWxmx8gynpltwqiA=
=Q54c
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Treating underscore as a normal character
  2007-02-06 21:41 Treating underscore as a normal character Berend de Boer
@ 2007-02-06 22:06 ` Hans Hagen
  2007-02-07  1:55   ` Berend de Boer
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2007-02-06 22:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Berend de Boer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi All,
>
> In computer code underscores are used frequently. Until recently sticking
>
>   \catcode`\_=12
>
> somewhere at the top did work, but it has become harder. More stuff
> seems to reset this, so I know have to stick it just above \starttext.
>   
\defineactivecharacter _ {\mathortext{_}{\_}} text_text  $a^2$


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Treating underscore as a normal character
  2007-02-06 22:06 ` Hans Hagen
@ 2007-02-07  1:55   ` Berend de Boer
  0 siblings, 0 replies; 3+ messages in thread
From: Berend de Boer @ 2007-02-07  1:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "Hans" == Hans Hagen <pragma@wxs.nl> writes:

    Hans> \defineactivecharacter _ {\mathortext{_}{\_}} text_text
    Hans> $a^2$

Hi Hans,

Thanks, but it is not sufficient. I finally narrowed it down to a
\placelist.


Here is a very short example:

- --------------------------------------------------
\def\MyHead#1#2%
  {\setupframed[frame=off]
   \framed[width=\hsize,offset=overlay]
     {\placesidebyside
        {\doifmodeelse{*sectionnumber}%
           {\framed[width=.6\hsize,offset=1em,strut=no,align=right,background=screen,backgroundscreen=0.4]
              {In this chapter: \blank
                    \placelist
                      [section]
                      [criterium=chapter,
                       style=boldslanted,
                       align=right,
                       interaction=all,
                       symbol=1,
                       width=1em,
                       pagenumber=no,
                       before=,
                       after=]}}%
           {\framed[width=.6\hsize]{}} % dummy
        }%
        {\framed
           [width=.4\hsize,offset=1em,strut=no,align=left]
           {{\bsd #1\par\leftskip=0pt plus1fil #2}}}}%
}

\setuphead
  [chapter]
  [command=\MyHead]

\defineactivecharacter _ {\mathortext{_}{\_}}

\starttext

\chapter{Short (flat) listing of Standard C classes}

\section{STDC_BASE}

\stoptext
- --------------------------------------------------


Result:

- --------------------------------------------------
(./test.tuo
! Missing $ inserted.
<inserted text> 
                $
<to be read again> 
                   _
<argument> STDC_
                BASE
\listtextcommand #1->\begstrut #1
                                 \endstrut 
\doattributes ...sname #1#2\@EA \endcsname \fi {#4
                                                  }\dostopattributes 
<argument> ...ont \limitatedlistentry {STDC_BASE}}
                                                  \egroup \ifdim \wd 4=\zero...
...
- --------------------------------------------------


I suppose you know the trick to fix this? If you look at test.tuo you
will see this line:

\listentry{section}{2}{1.1}{STDC_BASE}{2--0-1-1-0-0-0-0--1}{1}


That's the culprit, should have been written as STDC\_BASE I assume.

- -- 
All the best,

Berend de Boer


PS: This email has been digitally signed if you wonder what the strange
characters are that your outdated email client displays.
PGP public key: http://www.pobox.com/~berend/berend-public-key.txt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFFyTF/IyuuaiRyjTYRAmTJAKCw50VzN8ppOSeLiuOiLSVUV5luXgCdF8cZ
mpyQnVAZfN2ogsUUKaAkiJM=
=awTD
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-07  1:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 21:41 Treating underscore as a normal character Berend de Boer
2007-02-06 22:06 ` Hans Hagen
2007-02-07  1:55   ` Berend de Boer

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