* extended pretty printing
@ 1999-06-20 16:18 Hans Hagen
1999-06-21 12:47 ` Tobias Burnus
0 siblings, 1 reply; 2+ messages in thread
From: Hans Hagen @ 1999-06-20 16:18 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 3746 bytes --]
[ A typeset version is attached, demonstrating the features described,
an update will be uploaded to our www server ]
\usemodule[abr-01]
\setupbodyfont[pos,10pt]
\setupwhitespace[big]
\setupcolors[state=start]
\starttext
Hi Tobias and Berend,
I've tried to implement both your verbatim pretty printing
wishes. Actually, some hooks were already present, but not
yet used. I extended the pretty printer by 'typeset comment
in \TEX' feature, which is more general than just {\it
italics as Berend wanted}. I also provided settings for
setting the fonts of keywords. Instead of using font
parameters, I use command ones: given some constraints, one
can use whatever command, i.e. optionally grabbing one
argument.
As soon as I've implemented 'font palets' I will also provide
setting fonts in a way similar to colors (I know that Taco
wants this, e.g. for the maps, but for the moment his way of
setting them is ok.).
\startbuffer
\startTEX
\def\mathematics#1% % usage: \type {\mathematics{x^2}}
{\ifmmode#1\else$#1$\fi} % becomes: \mathematics{x^2}
\stopTEX
\stopbuffer
You know this one:
\typebuffer
This gives:
\getbuffer
I'm not if you're aware of the present for long comment
escape. When \type {\newprettytrue} is set, e.g. in \type
{cont-sys.tex}, one can use \type {%%\ M} to switch to for
instance \METAPOST\ mode, or \type{%%\[+} to let \type {[}
be pretty printed as \type {+}. I implemented the latter to
support catcode changes, so this only makes sense in pretty
printing complex \TEX\ code. More examples can be found in
the \type {verb} files. I added the natural \TEX\ \type{N}
key:
\startbuffer
\startTEX
\def\mathematics#1% %%\ N usage: \type {\mathematics{x^2}}
{\ifmmode#1\else$#1$\fi} %%\ N becomes: \mathematics{x^2}
\stopTEX
\stopbuffer
\typebuffer
or:
\getbuffer
Now back to \SQL:
\startbuffer
\startSQL
select * -- indeed, here we {\em do} select
from tableA
where 1 = 2
\stopSQL
\stopbuffer
\typebuffer
By default one gets:
\getbuffer
A new mode, called natural text mode, will however turn your
comments into typeset \TEX. For \TEX\ typesetting this looks
like:
\startbuffer
\setuptyping
[TEX]
[text=yes]
\startTEX
\def\mathematics#1% % usage: \type {\mathematics{x^2}}
{\ifmmode#1\else$#1$\fi} % becomes: \mathematics{x^2}
\stopTEX
\stopbuffer
\getbuffer
This is keyed in as follows; watch out, preceding \type{%}'s
are handled as normal!
\typebuffer
The \type {text} key enables natural \TEX\ mode, while the
command keys set the fonts or else. So, how about \SQL ?
\startbuffer
\setuptyping
[SQL]
[text=yes,palet=,icommand=\bf,vcommand=,ccommand=\it]
\startSQL
select * -- indeed, here we {\em do} select
from tableA
where 1 = 2
\stopSQL
\setuptyping
[SQL]
[ccommand=\tf\underbar]
\startSQL
select * -- indeed, here we {\em do} select
from tableA
where 1 = 2
\stopSQL
\stopbuffer
\typebuffer
Now watch:
\getbuffer
I suppose that the both of you can set up your local \type
{cont-sys} file to honor your personal preferences. By the
way, Berend, is \type {//} also a \SQL\ comment?
You need \eTeX\ or pdf\eTeX\ to use this features, but I
suppose you already use one of them. You need also need a
font patch, because some silly and obscure nesting bug
surfaced (only in non dutch versions).
\stoptext
I hope this suited your purposes,
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------
[-- Attachment #2: tob-ber.pdf --]
[-- Type: application/pdf, Size: 16502 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: extended pretty printing
1999-06-20 16:18 extended pretty printing Hans Hagen
@ 1999-06-21 12:47 ` Tobias Burnus
0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 1999-06-21 12:47 UTC (permalink / raw)
Cc: NTG-CONTEXT
Hallo Hans, hi all,
Is there any possibility (but // //) to get '//' before the JAVA-// comments?
The /* */ can appear, but must not.
Tobias
PS: I'm going to get the new TeX code to test it now.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-06-21 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-20 16:18 extended pretty printing Hans Hagen
1999-06-21 12:47 ` Tobias Burnus
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).