From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/21708 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Verbatim with linebreaks sillyness Date: Fri, 29 Jul 2005 15:33:53 +0200 Message-ID: <42EA3041.3030209@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1122644092 16754 80.91.229.2 (29 Jul 2005 13:34:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Jul 2005 13:34:52 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Jul 29 15:34:43 2005 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1DyV04-0002ql-KI for gctc-ntg-context-518@m.gmane.org; Fri, 29 Jul 2005 15:34:08 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9E5CA12833; Fri, 29 Jul 2005 15:34:06 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05800-03; Fri, 29 Jul 2005 15:34:01 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 03D941280A; Fri, 29 Jul 2005 15:34:01 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 059A81280A for ; Fri, 29 Jul 2005 15:34:00 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05527-08 for ; Fri, 29 Jul 2005 15:33:58 +0200 (CEST) Original-Received: from glenfiddich.elvenkind.com (elvenknd.xs4all.nl [213.84.171.68]) by ronja.ntg.nl (Postfix) with ESMTP id B5D651278A for ; Fri, 29 Jul 2005 15:33:58 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by glenfiddich.elvenkind.com (Postfix) with ESMTP id 4F863FA90 for ; Fri, 29 Jul 2005 15:31:20 +0200 (CEST) Original-Received: from glenfiddich.elvenkind.com ([127.0.0.1]) by localhost (glenfiddich.elvenkind.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18748-10 for ; Fri, 29 Jul 2005 15:31:16 +0200 (CEST) Original-Received: from [10.10.0.6] (glenlivet.elvenkind.com [10.10.0.6]) by glenfiddich.elvenkind.com (Postfix) with ESMTP id 64223E1C1 for ; Fri, 29 Jul 2005 15:31:16 +0200 (CEST) User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users X-Virus-Scanned: by amavisd-new at elvenkind.net X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on smtp.ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:21708 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:21708 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=3D10 }} \gdef\BREAKsethandlers% {\installprettyhandler 10 \BREAKtypeone } \newcount\BREAKcharcounter \newcount\BREAKmaxcharcount \def\BREAKtypeone#1% {\advance\BREAKcharcounter 1 \ifnum\BREAKcharcounter > \BREAKmaxcharcount \hfil\break \BREAKcharcounter=3D1 \fi \getpretty{#1}} \def\BREAKsetcounters% {\setbox\scratchbox=3D\hbox{0}% \BREAKmaxcharcount=3D\hsize \divide\BREAKmaxcharcount \wd\scratchbox \def\flushrestofverbatimline{\BREAKcharcounter=3D0 }% \BREAKcharcounter=3D0 } \gdef\setupprettyBREAKtype% {\def\prettyidentifier{BREAK}% \BREAKsetcounters \BREAKsethandlers \BREAKsetspecials} \installprettytype [BREAK] [BREAK] \starttext \framed [width=3D8cm, align=3Dflushleft]{% \setuptyping[option=3DBREAK] \starttyping h=F6=F6ah:aloh/aa?lha llol!loh%lloh#allhal\lohhll;ohohal~loll ohal=F6lo \stoptyping } \stoptext