On Fri, 3 Nov 2006 01:08:46 -0500 (EST)
Aditya Mahajan
On Thu, 2 Nov 2006, Sanjoy Mahajan wrote:
I was trying out line breaks for long titles (at least, long when set in 36 or 48pt text), as well as have pdf bookmarks, so I defined a \1 shorthand local to the chapter heading:
Maybe I am missing something here, but why not just use \\. Inside titles it is defined as \crlf\ignorespaces
====================================================================== \setupinteraction[state=start] \placebookmarks[chapter] \setupinteractionscreen[option=bookmark]
\setuphead[chapter][before={\bgroup\def\1{\hfil\break}}, after={\egroup}]
\starttext \chapter{Long\1 title} hello
\stoptext ======================================================================
If I inline the \1, as in \chapter{Long\hfil\break title}, then it's mostly fine except that the bookmark has "hfil penalty ..." Is there's another way to avoid that problem? Perhaps a magic option that says what the bookmark should be, the way one can tell \index what to typeset in the index when it is different from the inline text.
Usual way is
\appendtoks\def\1{}\to\simplifiedcommands
but something seems to be broken. It seems that you can not use "any" macro inside a chapter title, while using bookmarks. Here is a simple test file.
\setupinteraction[state=start] \placebookmarks[chapter] \setupinteractionscreen[option=bookmark]
\def\macro{long word}
\starttext \chapter{Long\macro title} \stoptext
You can also make a extra bookmarkentry by hand. \starttext \chapter{A rather long title} \bookmark{Short title} \stoptext
I get same error as you (ConTeXt ver: 2006.11.01 09:59 MK II)
One solution is to forbid hyphens during the \chapter (with before= and after= definitions) and also shrink the \hsize enough so that tex line
You do not require before...after for this. Something like
\setuphead[chapter][align={nothyphenated,stretch,tolerant}]
should work.
breaks where I want, but that method requires unintuitive, fontsize-dependent dimension guessing for each chapter. Putting in line breaks by hand is not too bad. Plus one might want to break the lines according to meaning, which does not always produce the same results as where breaks would go according to line length.
I agree, for headings, it is better to do linebreak by hand.
But meanwhile trying the hack method above, I get this error
(./q.tuo) (./q.tuo) ! Undefined control sequence. <argument> Long\1 title \sanitizePDFdocencoding ...docencoding \edef #2{#1 } \doPDFinsertbookmark ...oding #3\to \bookmarktext \stripstring \bookmarktext..
\doplacebookmarks ...okmarkelement \flushbookmark \egroup \else \expanded {\.. <to be read again> \setupinteractionscreen l.3 \setupinteractionscreen [option=bookmark]
It's from this line in q.tuo
\listentry{chapter}{1}{1}{Long\1 title}{2--0-1-0-0-0-0-0--1}{1}
and the \1 is not defined during \listentry, only during the \chapter.
I didn't have a problem when the same code was part of a product (each component being chapter in a book, with the \setuphead in an environment file) -- only had it when I compiled one component, which is how I got to the test case above.
[All with ConTeXt ver: 2006.10.24 13:47 MK II fmt: 2006.10.24]
-Sanjoy
ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context