From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/25139 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: stretched title text Date: Fri, 13 Jan 2006 11:23:21 +0100 Message-ID: <43C77F99.5060809@wxs.nl> References: <32804.213.233.219.56.1137143242.squirrel@webmail.solcon.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1137149858 323 80.91.229.2 (13 Jan 2006 10:57:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 Jan 2006 10:57:38 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Jan 13 11:57:34 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org 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 1ExMca-0003fm-Ss for gctc-ntg-context-518@m.gmane.org; Fri, 13 Jan 2006 11:57:29 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 7A8BB127A8; Fri, 13 Jan 2006 11:57:28 +0100 (CET) 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 02220-01; Fri, 13 Jan 2006 11:57:27 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 28A93127A9; Fri, 13 Jan 2006 11:23:26 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id AEC21127A9 for ; Fri, 13 Jan 2006 11:23:24 +0100 (CET) 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 01736-02-6 for ; Fri, 13 Jan 2006 11:23:23 +0100 (CET) Original-Received: from mail.pragma-ade.net (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by ronja.ntg.nl (Postfix) with SMTP id 62C2B127A8 for ; Fri, 13 Jan 2006 11:23:23 +0100 (CET) Original-Received: from [10.100.1.102] (unverified [10.100.1.102]) by controller-1 (SurgeMail 3.5b3) with ESMTP id 461 for multiple; Fri, 13 Jan 2006 05:33:55 +0300 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: m.guravage@pragma-cts.com, mailing list for ConTeXt users In-Reply-To: <32804.213.233.219.56.1137143242.squirrel@webmail.solcon.nl> X-Server: High Performance Mail Server - http://surgemail.com r=-274017400 X-Authenticated-User: hagen@controller-1 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-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:25139 Archived-At: M.guravage wrote: >Hi, > >Something has changed in the past couple months that causes my stretched >title code to fail with the message: > > ! You can't use `\end' in internal vertical mode. > \normalend > >I've attatched a small example. Has anyone a suggestion how I can adapt my >code accordingly? > > in a coming release i will support a more transparent stretching mechanism (using a font handling) so that such hacks are no longer needed anyhow, the problem with your 'plug-in' is that it acts on a complex stream of tokens, run this: \def\CapStretchAmount {0.3em} \def\CapStretch {\let\stretchedspaceamount\CapStretchAmount \stretchednormalcase} \def\stretchedbox#1% {\framed [frame=off, offset=.5em, align=middle, width=broad] {\showargument{#1}% \sc\CapStretch{#1}}} \setuphead [subject][rawtextcommand=\stretchedbox] \starttext \subject{feeling stretched feeling stretched feeling stretched feeling stretched} \processfile{tufte} \subject{feeling stretched} \processfile{tufte} \stoptext you will see that #1 is more than text, and i'm even surprised that it worked in previous versions. What you actually need is a deep hook: \def\c!deeptextcommand {deeptextcommand} \def\c!deepnumbercommand{deepnumbercommand} \def\doplaceheadtext#1#2#3#4% {\beginheadplacement{#1}% \ifemptyhead % = needed \setbox0=\ifvertical\vbox\else\hbox\fi to \zeropoint {\headnumbercontentfalse \resetsystemmode\v!sectionnumber #2}% \makestrutofbox0 \else % = needed \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox {\headnumbercontentfalse \resetsystemmode\v!sectionnumber % less interfering \ifcase\headtimingmode\or#2\fi % outerside font determines distance \dosetfontattribute{\??ko#1}\c!style % but we don't want color to influence user commands % todo: get the if-else out of it \getvalue{\??ko#1\c!command} {} % no number {\dostartattributes{\??ko#1}\c!style\c!color\empty \dostartattributes{\??ko#1}\c!textstyle\c!textcolor\empty \dontconvertfont \ifdisplaysectionhead \setupinterlinespace \else \setupspacing \fi % \ifcase\headtimingmode#2\fi % can introduce cr \getvalue{\??ko#1\c!commandbefore}% \placeheadmargintexts{#1}% binnen #3? \ifdisplaysectionhead \getvalue{\??ko#1\c!textcommand}% struts can be nilled with \setnostrut {\setstrut \begstrut \ifcase\headtimingmode\hbox{#2}\fi \executeifdefined{\??ko#1\c!deeptextcommand}\firstofoneargument{#3} \endstrut}% \hbox prevents break \xdef\localheadheight {\the\strutht}% \xdef\localheaddepth {\the\strutdp}% \xdef\localheadlineheight{\the\lineheight}% % == \globallet\localheaddepth\strutdepth \else \ifcase\headtimingmode#2\fi \getvalue{\??ko#1\c!textcommand}% {\executeifdefined{\??ko#1\c!deeptextcommand}\firstofoneargument{#3}}% \fi \getvalue{\??ko#1\c!commandafter}% \ifdisplaysectionhead\endgraf\fi \dostopattributes \dostopattributes}}% \fi \endheadplacement{#1}{#4}} \def\doplaceheadnumbertext#1#2#3#4#5% maybe move modes outside box {\beginheadplacement{#1}% \ifemptyhead % = needed \setbox0=\ifvertical\vbox\else\hbox\fi to \zeropoint {\doiftextelse{#3} {\setsystemmode \v!sectionnumber\headnumbercontenttrue } {\resetsystemmode\v!sectionnumber\headnumbercontentfalse}% #2}% \makestrutofbox0 \else % = needed \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox {\doiftextelse{#3} {\setsystemmode \v!sectionnumber\headnumbercontenttrue } {\resetsystemmode\v!sectionnumber\headnumbercontentfalse}% % less interfering \ifcase\headtimingmode\or#2\fi % outerside font determines distance \dosetfontattribute{\??ko#1}\c!style % but we don't want color to influence user commands \getvalue{\??ko#1\c!command}% {\dostartattributes{\??ko#1}\c!style\c!color\empty \dostartattributes{\??ko#1}\c!numberstyle\c!numbercolor\empty % \getvalue{\??ko#1\c!commandbefore}% strange, why here? moved 21/11/2005 \placeheadmargintexts{#1}% binnen #3? \ifdisplaysectionhead % can be nilled with \setnostrut \getvalue{\??ko#1\c!numbercommand}% {\setstrut \begstrut \executeifdefined{\??ko#1\c!deepnumbercommand}\firstofoneargument{#3}% \endstrut}% \else \getvalue{\??ko#1\c!numbercommand}% {\executeifdefined{\??ko#1\c!deepnumbercommand}\firstofoneargument{#3}}% \fi \dostopattributes \dostopattributes} {\dostartattributes{\??ko#1}\c!style\c!color\empty \dostartattributes{\??ko#1}\c!textstyle\c!textcolor\empty \dontconvertfont \ifdisplaysectionhead \setupinterlinespace \else \setupspacing \fi % \ifcase\headtimingmode#2\fi % can introduce cr \getvalue{\??ko#1\c!commandbefore}% makes more sense here \placeheadmargintexts{#1}% binnen #3? \ifdisplaysectionhead \getvalue{\??ko#1\c!textcommand}% struts can be nilled with \setnostrut {\setstrut \begstrut \ifcase\headtimingmode\hbox{#2}\fi \executeifdefined{\??ko#1\c!deeptextcommand}\firstofoneargument{#4}% \endstrut}% \hbox prevents break \xdef\localheadheight {\the\strutht}% \xdef\localheaddepth {\the\strutdp}% \xdef\localheadlineheight{\the\lineheight}% % == \globallet\localheaddepth\strutdepth \else \ifcase\headtimingmode#2\fi % inside textcommand ? \getvalue{\??ko#1\c!textcommand}% {\executeifdefined{\??ko#1\c!deeptextcommand}\firstofoneargument{#4}}% \fi \getvalue{\??ko#1\c!commandafter}% \ifdisplaysectionhead\endgraf\fi \dostopattributes \dostopattributes}}% \fi \endheadplacement{#1}{#5}} \protect \def\CapStretchAmount {0.3em} \def\CapStretch {\let\stretchedspaceamount\CapStretchAmount \stretchednormalcase} \def\stretchedbox#1% {\framed [frame=off, offset=.5em, align=middle, width=broad] {%\showargument{#1}% \sc\CapStretch{#1}}} \setuphead [subject][deeptextcommand=\stretchedbox] \starttext \subject{feeling stretched feeling stretched feeling stretched feeling stretched} \processfile{tufte} \subject{feeling stretched} \processfile{tufte} \stoptext