From: Hans Hagen <pragma@wxs.nl>
Subject: Re: stretched title text
Date: Fri, 13 Jan 2006 11:23:21 +0100 [thread overview]
Message-ID: <43C77F99.5060809@wxs.nl> (raw)
In-Reply-To: <32804.213.233.219.56.1137143242.squirrel@webmail.solcon.nl>
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.
> <recently read> \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
prev parent reply other threads:[~2006-01-13 10:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-13 9:07 M.guravage
2006-01-13 9:57 ` Taco Hoekwater
2006-01-13 10:23 ` Hans Hagen [this message]
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=43C77F99.5060809@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.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).