ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* bookmarks using linebreaks in chapter titles
@ 2006-11-03  4:08 Sanjoy Mahajan
  2006-11-03  6:08 ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: Sanjoy Mahajan @ 2006-11-03  4:08 UTC (permalink / raw)


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:

======================================================================
\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.

One solution is to forbid hyphens during the \chapter (with before= and
after= definitions) and also shrink the \hsize enough so that tex line
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.

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

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

end of thread, other threads:[~2006-11-03 22:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-03  4:08 bookmarks using linebreaks in chapter titles Sanjoy Mahajan
2006-11-03  6:08 ` Aditya Mahajan
2006-11-03 10:13   ` Wolfgang Schuster
2006-11-03 14:01     ` Sanjoy Mahajan
2006-11-03 20:13       ` Hans Hagen
2006-11-03 22:37         ` Sanjoy Mahajan

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