On Thursday 13 November 2008 12:46:27 am Hans Hagen wrote:
Bart C. Wise wrote:
Wolfgang, thanks so much for your help so far.
I was able to take the code and make it work correctly to stretch the chapter title. What I want is two lines for a chapter head. For example, Line 1: "Chapter One" Line 2: "Title for Chap 1"
I want line 1 to be stretched. Everything I have tried does not work. I can get the "Chapter" word to stretch, but not the whole line (and it should probably be treated as a whole line when stretching). I was never able to get the chapter number (now a word) to stretch.
So how do I grab the output for line 1 and then stretch it?
Here's a sample of what I have without any stretching:
\def\Myheader#1#2{% \framedtext[width=0.60\textwidth, frame=off, align=middle]{% \vbox{\headtext{chapter}~#1 \blank #2}}}
\def\englishnumbers#1{ \ifcase#1 \or ONE\or TWO\or THREE\or FOUR\or FIVE\fi} \defineconversion[englishnumbers][\englishnumbers]
\setupsection[chapter][conversion=englishnumbers] \setuphead [chapter][ command=\Myheader, textcommand=\bfd, ] \setupheadtext[chapter=CHAPTER] % used by \headtext \starttext \chapter{Title for Chap 1} \processfile{tufte} \stoptext
P.S. If there's a better way to do the number->word conversion, let me know.
On Wednesday 12 November 2008 10:17:35 am Wolfgang Schuster wrote:
Am 12.11.2008 um 18:03 schrieb Bart C. Wise:
Okay, it works until I place an an argument in the stretched command.
def\MyChapterCommand#1#2{ \framed[align=center,frame=off,width=\textwidth]{ \vbox{ fails--> \stretched{#2} works--> \stretched{This is a Test} } } \setuphead[chapter][ command=\MyChapterCommand }
I get the following error when I run texexec:
! Missing \endcsname inserted. <to be read again> \let \nextprocessedtoken ...oup \ifincolor \ifcsname #1 #3\endcsname \let \dostopa...
\dodoprocesstokens ...token \let \before \between \fi \let \nextprocessedtok... <argument> This is a test: \dostartattributes {\??ko \v!title }\c!style \c!c...
\processtokens ...fore \before \doprocesstokens #5 \lastcharacter \endgroup \stretched ... \relax \hss \relax {\hss \hss }{#1} \egroup ...
How can I use the #1 & #2 arguments in the stretched command?
You could use it only with \deeptextcommand, here is a old mail with a example from Hans (you could ignore the other code).
http://archive.contextgarden.net/message/20060113.102321.bf24d7ca.en.htm l
look for the property mechanism
\startproperty[stretch]stretched\stopproperty
token processing is always tricky since the parser does not know what to expect; properties use a pdf trick; in mkiv we have more clever stretching
Hans, I tried the above code and it failed. I looked around on the ConTeXt site and the web in general. It seems like a \defineproperty[stretch] needs to be declared, but I can't find it anywhere. You'll have to excuse my ignorance, but will you be explicit on how to use the \startproperty[stretch] stretch \stopproperty. Bart