ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Sanjoy Mahajan <sanjoy@mrao.cam.ac.uk>
Subject: bookmarks using linebreaks in chapter titles
Date: Thu, 02 Nov 2006 23:08:12 -0500	[thread overview]
Message-ID: <E1GfqLk-0003vW-U4@approximate.corpus.cam.ac.uk> (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

             reply	other threads:[~2006-11-03  4:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-03  4:08 Sanjoy Mahajan [this message]
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

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=E1GfqLk-0003vW-U4@approximate.corpus.cam.ac.uk \
    --to=sanjoy@mrao.cam.ac.uk \
    --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).