From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/31699 Path: news.gmane.org!not-for-mail From: Sanjoy Mahajan Newsgroups: gmane.comp.tex.context Subject: bookmarks using linebreaks in chapter titles Date: Thu, 02 Nov 2006 23:08:12 -0500 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1162526918 5123 80.91.229.2 (3 Nov 2006 04:08:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 3 Nov 2006 04:08:38 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Nov 03 05:08:35 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GfqM4-0006Mh-8x for gctc-ntg-context-518@m.gmane.org; Fri, 03 Nov 2006 05:08:32 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8B3AD1FF57; Fri, 3 Nov 2006 05:08:31 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13301-04; Fri, 3 Nov 2006 05:08:26 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 234541FF4F; Fri, 3 Nov 2006 05:08:26 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5CC6D1FF52 for ; Fri, 3 Nov 2006 05:08:23 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13754-02-5 for ; Fri, 3 Nov 2006 05:08:19 +0100 (CET) Original-Received: from elasmtp-scoter.atl.sa.earthlink.net (elasmtp-scoter.atl.sa.earthlink.net [209.86.89.67]) by ronja.ntg.nl (Postfix) with SMTP id 46EA51FF1E for ; Fri, 3 Nov 2006 05:08:19 +0100 (CET) Original-Received: from [24.41.6.91] (helo=approximate.corpus.cam.ac.uk) by elasmtp-scoter.atl.sa.earthlink.net with asmtp (TLSv1:AES256-SHA:256) (Exim 4.34) id 1GfqLp-0000XQ-Hm; Thu, 02 Nov 2006 23:08:17 -0500 Original-Received: from sanjoy by approximate.corpus.cam.ac.uk with local (Exim 4.62) (envelope-from ) id 1GfqLk-0003vW-U4; Thu, 02 Nov 2006 23:08:12 -0500 Original-To: ntg-context@ntg.nl X-Mailer: MH-E 8.0; nmh 1.1; GNU Emacs 21.4.1 X-ELNK-Trace: dcd19350f30646cc26f3bd1b5f75c9f474bf435c0eb9d478af50d6aea4c45bac221824a7a1a05a889e2fc8bc6e383c1e350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 24.41.6.91 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:31699 Archived-At: 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. Long\1 title \sanitizePDFdocencoding ...docencoding \edef #2{#1 } \doPDFinsertbookmark ...oding #3\to \bookmarktext \stripstring \bookmarktext.. \doplacebookmarks ...okmarkelement \flushbookmark \egroup \else \expanded {\.. \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