ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* fix for verbatim
@ 2005-11-09  9:55 Hans Hagen
  2005-11-09 10:33 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2005-11-09  9:55 UTC (permalink / raw)


The following patch

\unprotect

\let\protectedfirsttype\string

\bgroup
\catcode`\[=\@@begingroup
\catcode`\]=\@@endgroup
\catcode`\{=\@@active
\catcode`\}=\@@active
\gdef\initializetypegrouping%
  [\catcode`\{=\@@active
   \catcode`\}=\@@active
   \let\normalactivebgroup{%
   \let\normalactiveegroup}%
   \def\activeleftargument%
     [\bgroup
      \let}\activerightargument
      \normalactivebgroup
     ]%
   \def\activerightargument%
     [\normalactiveegroup
      \egroup]%
   \let{=\activeleftargument
   \let}=\egroup
  ]
\egroup

\protect

works ok for

\setupcolors[state=start]
\setuptype[option=color]
\setuptyping[option=color]
\setupwhitespace[big]

\starttext

\starttyping
x\pdfoutput{xx} {nn}
\pdfoutput{xx} {nn}
\stoptyping

\type{x\pdfoutput {xx} {nn}}
\type{x\pdfoutput{xx} {nn}}
\type{x\pdfoutput{xx} {nn}}

\stoptext

but no coloring here:

\starttabulate[|l|]
\NC \type{\pdfoutput {xx}{,,}}  \NC\NR
\NC \type{\pdfoutput{xx}{,,}}  \NC\NR
\NC \type{{xx}{,,}}  \NC\NR
\stoptabulate

beware: since in tabulate args are passed, the { } in \type are seen as 
grouping tokens and disappear.

i'll try to make up a solution (no way around space after \cs then, 
unless taco fixes tex -)

Hans

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

* Re: fix for verbatim
  2005-11-09  9:55 fix for verbatim Hans Hagen
@ 2005-11-09 10:33 ` Hans Hagen
  2005-11-09 17:33   ` Peter Münster
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2005-11-09 10:33 UTC (permalink / raw)


Hans Hagen wrote:

> The following patch

oeps, little bug,

here is the complete version:

\unprotect

\bgroup
\catcode`\[=\@@begingroup
\catcode`\]=\@@endgroup
\catcode`\{=\@@active
\catcode`\}=\@@active
\gdef\initializetypegrouping%
  [\ifnum\catcode`\{=\@@active
     \let\normalactivebgroup{%
     \let\normalactiveegroup}%
   \else
     \catcode`\{=\@@active
     \catcode`\}=\@@active
     \let\normalactivebgroup\leftargument
     \let\normalactiveegroup\rightargument
   \fi
   \def\activeleftargument%
     [\bgroup
      \let}\activerightargument
      \normalactivebgroup
     ]%
   \def\activerightargument%
     [\normalactiveegroup
      \egroup]%
   \let{=\activeleftargument
   \let}=\egroup
  ]
\egroup

\chardef\recodeverbatimmode\zerocount % 0=nothing 1=rescan 2=autorescan

\def\dodotypeA
  {\initializetype
   \initializetypegrouping
   \verbatimcolor
   \ifcase\recodeverbatimmode
     \@EA\dodotypeAA
   \or
     \@EA\dodotypeAB
   \or
     \ifnum\catcode`\{=\@@active
       \@EAEAEA\dodotypeAB
     \else
       \@EAEAEA\dodotypeAA
     \fi
   \else
     \@EA\dodotypeAA
   \fi}

\def\dodotypeAA
  {\afterassignment\protectfirsttype\let\next=}

\def\dodotypeAB
  {\bgroup
   \catcode`\}=\@@endgroup
   \catcode`\{=\@@begingroup
   \afterassignment\redotypeAB\global\globalscratchtoks}

\def\redotypeAB
  {\egroup
   \expandafter\convertargument\the\globalscratchtoks\to\ascii
   
\ifx\scantokens\undefined\ascii\else\everyeof{\hskip-\spaceskip}\scantokens\expandafter{\ascii}\fi
   \egroup}

\appendtoks \chardef\recodeverbatimmode\plustwo \to \everytabulate
\appendtoks \chardef\recodeverbatimmode\plustwo \to \everytable

\protect

\type (including colorization)  should work ok in tabulate and tables

(btw, it becomes time to drop non-etex code -)

Hans

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

* Re: fix for verbatim
  2005-11-09 10:33 ` Hans Hagen
@ 2005-11-09 17:33   ` Peter Münster
  2005-11-10 12:57     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Münster @ 2005-11-09 17:33 UTC (permalink / raw)


On Wed, 9 Nov 2005, Hans Hagen wrote:

> (btw, it becomes time to drop non-etex code -)

Is there any reason to keep it?
Cheers, Peter

-- 
http://pmrb.free.fr/contact/

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

* Re: fix for verbatim
  2005-11-09 17:33   ` Peter Münster
@ 2005-11-10 12:57     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2005-11-10 12:57 UTC (permalink / raw)


� wrote:

>On Wed, 9 Nov 2005, Hans Hagen wrote:
>
>  
>
>>(btw, it becomes time to drop non-etex code -)
>>    
>>
>
>Is there any reason to keep it?
>  
>

sentiment

Hans

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

end of thread, other threads:[~2005-11-10 12:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-09  9:55 fix for verbatim Hans Hagen
2005-11-09 10:33 ` Hans Hagen
2005-11-09 17:33   ` Peter Münster
2005-11-10 12:57     ` Hans Hagen

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