ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* stretched title text
@ 2006-01-13  9:07 M.guravage
  2006-01-13  9:57 ` Taco Hoekwater
  2006-01-13 10:23 ` Hans Hagen
  0 siblings, 2 replies; 3+ messages in thread
From: M.guravage @ 2006-01-13  9:07 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

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?

Cheers,

Michael

[-- Attachment #2: stretch.tex --]
[-- Type: application/octet-stream, Size: 552 bytes --]

% interface=en output=pdftex

\setuppagenumbering[state=stop]
\def\CapStretchAmount{0.3em}
\def\CapStretch#1{\def\stretchedspaceamount{\CapStretchAmount}\stretchednormalcase{#1}}
\def\stretchedbox#1%
  {\bgroup
  \framed [frame=off, offset=.5em, align=middle,
           width=broad]{\CapStretch{\sc #1}}\egroup}
\setuphead [subject][textcommand=\stretchedbox]
\starttext 
  \subject{feeling stretched feeling stretched feeling stretched feeling stretched}
    \processfile{tufte}
  \subject{feeling stretched}
    \processfile{tufte}
\stoptext
%finis

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stretched title text
  2006-01-13  9:07 stretched title text M.guravage
@ 2006-01-13  9:57 ` Taco Hoekwater
  2006-01-13 10:23 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Taco Hoekwater @ 2006-01-13  9:57 UTC (permalink / raw)




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?

This is due to a change in core-sec.tex, for 2005.11.24.

(the addition of \ifcase\headtimingmode to \doplaceheadtext).
Below is a patched version (see lines marked with %TH), but
I am not completely sure if that doesn't break that
\headtimingmode accidentally.

Cheers, Taco


\unprotect
\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
%TH
%TH  \getvalue{\??ko#1\c!textcommand}%
%TH   {\setstrut\begstrut\ifcase\headtimingmode\hbox{#2}\fi#3\endstrut}%
      \ifcase\headtimingmode\hbox{#2}\fi                             %TH
      \getvalue{\??ko#1\c!textcommand}{\setstrut\begstrut#3\endstrut}%TH
%TH
                  \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}{#3}%
                \fi
                \getvalue{\??ko#1\c!commandafter}%
                \ifdisplaysectionhead\endgraf\fi
              \dostopattributes
            \dostopattributes}}%
    \fi
    \endheadplacement{#1}{#4}}
\protect

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stretched title text
  2006-01-13  9:07 stretched title text M.guravage
  2006-01-13  9:57 ` Taco Hoekwater
@ 2006-01-13 10:23 ` Hans Hagen
  1 sibling, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2006-01-13 10:23 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-01-13 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-13  9:07 stretched title text M.guravage
2006-01-13  9:57 ` Taco Hoekwater
2006-01-13 10:23 ` Hans Hagen

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).