Hi, I saw this on the wiki: http://contextgarden.net/Verbatim_with_line_breaks and it seemed like a fun idea to play with for a bit. How's this? Cheers, Taco % % 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]{% \setuptyping[option=BREAK] \starttyping hööah:aloh/aa?lha llol!loh%lloh#allhal\lohhll;ohohal~loll ohalölo \stoptyping } \stoptext
Taco,
Just tried this and it is really cool!
But how can I make spaces without the special space character?
Thanks
On 7/29/05, Taco Hoekwater
Hi,
I saw this on the wiki:
http://contextgarden.net/Verbatim_with_line_breaks
and it seemed like a fun idea to play with for a bit. How's this?
Cheers, Taco
% % 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]{% \setuptyping[option=BREAK] \starttyping hööah:aloh/aa?lha llol!loh%lloh#allhal\lohhll;ohohal~loll ohalölo \stoptyping } \stoptext
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Regards. Eugene Toporov
Eugene Toporov wrote:
Taco,
Just tried this and it is really cool! But how can I make spaces without the special space character?
Like so: \def\BREAKtypeone#1% {\advance\BREAKcharcounter 1 \ifnum\BREAKcharcounter > \BREAKmaxcharcount \hfil\break \BREAKcharcounter=1 \fi \ifnum#1=32 % the character number for a space \setbox\scratchbox=\hbox{0}% \kern \wd\scratchbox \else \getpretty{#1}% \fi} Cheers again, Taco
Eugene Toporov wrote:
Taco,
Just tried this and it is really cool! But how can I make spaces without the special space character?
framedtext is better suited than framed here: \defineframedtext [broken] [width=8cm, align=flushleft] \definetyping[BREAK][option=BREAK] \startbroken \startBREAK hööah:aloh/aa?lha llol!loh%lloh#allhal\lohhll;ohohal~loll ohalölohööah:aloh/aa?lha llol!loh%lloh#allhal\lohhll;ohohal~loll ohalölo \stopBREAK \stopbroken
Thanks
On 7/29/05, *Taco Hoekwater*
mailto:taco@elvenkind.com> wrote: Hi,
I saw this on the wiki:
http://contextgarden.net/Verbatim_with_line_breaks
and it seemed like a fun idea to play with for a bit. How's this?
Cheers, Taco
% % 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]{% \setuptyping[option=BREAK] \starttyping hööah:aloh/aa?lha llol!loh%lloh#allhal\lohhll;ohohal~loll ohalölo \stoptyping } \stoptext
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl mailto:ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Regards. Eugene Toporov
------------------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- ----------------------------------------------------------------- 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 -----------------------------------------------------------------
participants (3)
-
Eugene Toporov
-
Hans Hagen
-
Taco Hoekwater