Thanks Aditya and Wolfgang for the information.  I've added it all to
the wiki <http://wiki.contextgarden.net/PDF_Bookmarks_and_Headers> so
let me know if you find any problems there.  I noticed two possible
bugs when trying out a few examples -- see below.

>> If I inline the \1, as in \chapter{Long\hfil\break title}, then
>> it's mostly fine except that the bookmark has "hfil penalty ..."
> Usual way is
> \appendtoks\def\1{}\to\simplifiedcommands

Thanks, that's useful (and now I found it elsewhere in the wiki).

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

> You can also make a extra bookmarkentry by hand.
> \starttext
> \chapter{A rather long title}
> \bookmark{Short title}
> \stoptext

Also useful and wikified.

Now for the two possible bugs.  

1. An empty chapter breaks \bookmark:

============================================================
\setupinteraction[state=start]
\placebookmarks[chapter]
\setupinteractionscreen[option=bookmark]
\starttext
\chapter{A very long chapter\\ about splines}
\bookmark{Splines}
\stoptext
============================================================

The bookmark text is "A very long chapter about splines".  But adding
a letter or word to the chapter body fixes that:

============================================================
\setupinteraction[state=start]
\placebookmarks[chapter]
\setupinteractionscreen[option=bookmark]
\starttext
\chapter{A very long chapter\\ about splines}
\bookmark{Splines}
hello
\stoptext
============================================================


2. The second problem is perhaps my misunderstanding.  The wiki page
said to use \placebookmarks[chapter,section,subsection][chapter] to
make only chapter bookmarks visible.  But I find that chapter
bookmarks are open by default in the bookmark window, so I tried the
following example instead:

============================================================
\setupinteraction[state=start]
\placebookmarks[chapter,section,subsection][chapter,section]
\setupinteractionscreen[option=bookmark]
\starttext
\chapter{The beginning}
Hi!
\chapter{A very, very\\ long title}
Greetings!
\section{Why so long}
I don't know
\subsection{Why not?}
Good point.
\chapter{The never-ending story}
Oh no.
\chapter{The never-ending story}
\bookmark{Forever!}
Oh no.
\stoptext
============================================================

I expected chapter and section bookmarks to be open, which they were,
but so were the subsection bookmarks.  And

\placebookmarks[chapter,section,subsection][chapter]

made chapter and section bookmarks open.  Is there an 'off by one'
error \placebookmarks?  Or have I misunderstood the purpose of the
command (I'll then fix the wiki)?

3. And a third question is whether the bookmark window is open by
default.  I use xpdf (Ubuntu Linux) and it always opens the bookmark
window, whether or not \setupinteractionscreen[option=bookmark] is
given.  Perhaps that's an xpdf-specific behavior but acroread acts
differently?

-Sanjoy

`Never underestimate the evil of which men of power are capable.'
         --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to