From: Hans Hagen <pragma@wxs.nl>
Subject: extended pretty printing
Date: Sun, 20 Jun 1999 18:18:06 +0200 [thread overview]
Message-ID: <376D143E.A1CF3AD1@wxs.nl> (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 --]
next reply other threads:[~1999-06-20 16:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-20 16:18 Hans Hagen [this message]
1999-06-21 12:47 ` Tobias Burnus
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=376D143E.A1CF3AD1@wxs.nl \
--to=pragma@wxs.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).