* How to disable the hypernation in verbatim environment
@ 2009-10-13 9:50 Joshua Lee
0 siblings, 0 replies; only message in thread
From: Joshua Lee @ 2009-10-13 9:50 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1: Type: text/plain, Size: 421 bytes --]
Hi All,
The hypernation in verbatim environment will break the keywords of the
input source code, for example, it break the C language statement. I
googling the wiki of ConTeXt site and find that
http://wiki.contextgarden.net/Verbatim_with_line_breaks#Why_German_is_a_relatively_easy_language
demonstrate the usage. But it does not works now, attached files are the sample and output.
Thanks in advance.
BR/JL
Joshua
[-- Attachment #2: sample.tex --]
[-- Type: text/x-tex, Size: 1057 bytes --]
%
% BREAK is a special pretty handler that auto-wraps lines
% to fit the current hsize.
\gdef\BREAKsetspecials%
{\dorecurse{256}{\setpretty\numexpr \recurselevel-1\relax=10 }}
\gdef\BREAKsethandlers%
{\installprettyhandler 10 \BREAKtypeone }
\newcount\BREAKcharcounter
\newcount\BREAKmaxcharcount
\def\BREAKtypeone#1%
{\advance\BREAKcharcounter 1
\ifnum\BREAKcharcounter > \BREAKmaxcharcount
\hfil\break
\BREAKcharcounter=1
\fi
\getpretty{#1}}
\def\BREAKsetcounters%
{\setbox\scratchbox=\hbox{0}%
\BREAKmaxcharcount=\hsize
\divide\BREAKmaxcharcount \wd\scratchbox
\def\flushrestofverbatimline{\BREAKcharcounter=0 }%
\BREAKcharcounter=0 }
\gdef\setupprettyBREAKtype%
{\def\prettyidentifier{BREAK}%
\BREAKsetcounters
\BREAKsethandlers
\BREAKsetspecials}
\installprettytype [BREAK] [BREAK]
\starttext
\framed
[width=8cm,
align=flushleft,
strut=no]{%
\setuptyping[option=BREAK]
\starttyping
Hottentottenstottertrottelmutterlattengitterkotterbeutelratenattentater
\stoptyping
}
\stoptext
[-- Attachment #3: sample.pdf --]
[-- Type: application/pdf, Size: 5651 bytes --]
[-- Attachment #4: Type: text/plain, Size: 486 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-10-13 9:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13 9:50 How to disable the hypernation in verbatim environment Joshua Lee
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).