summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-04-11 23:02:14 +0000
committerKarl Berry <karl@freefriends.org>2007-04-11 23:02:14 +0000
commit6858df01ea6ebb32f4be0f68e4b2e03d8713f38f (patch)
treed0466192a4c6ae7f99e95d2e6e9b613ebcb73d3d /Master/texmf-dist/source/latex/oberdiek/bookmark.dtx
parent59314283a9039be6cceb0bbee8600837477c9058 (diff)
oberdiek: accsupp, atenddvi, hycolor, iflang (11apr07)
git-svn-id: svn://tug.org/texlive/trunk@4149 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/bookmark.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/bookmark.dtx486
1 files changed, 384 insertions, 102 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx b/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx
index 4ce1a3dbe44..1f8ffa13564 100644
--- a/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/bookmark.dtx
@@ -65,7 +65,7 @@
%
%<*ignore>
\begingroup
- \def\x{LaTeX2e}
+ \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
\ifx\csname processbatchFile\endcsname\relax\else1\fi
@@ -76,7 +76,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: bookmark 2007/03/03 v0.6 PDF bookmarks (HO)}
+\Msg{* Package: bookmark 2007/04/09 v0.8 PDF bookmarks (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -149,16 +149,16 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bookmark.drv}%
- [2007/03/03 v0.6 PDF bookmarks (HO)]
+ [2007/04/09 v0.8 PDF bookmarks (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}
\begin{document}
- \DocInput{bookmark.dtx}
+ \DocInput{bookmark.dtx}%
\end{document}
%</driver>
% \fi
%
-% \CheckSum{1846}
+% \CheckSum{1950}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -179,7 +179,7 @@ and the derived files
% \GetFileInfo{bookmark.drv}
%
% \title{The \xpackage{bookmark} package}
-% \date{2007/03/03 v0.6}
+% \date{2007/04/09 v0.8}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
@@ -230,10 +230,11 @@ and the derived files
% Options can be given at three places:
% \begin{enumerate}
% \item \cs{usepackage}|[|\meta{options}|]{bookmark}|\\
-% This is the only place for driver options.
+% This is the only place for driver options
+% and option \xoption{atend}.
% \item \cs{bookmarksetup}|{|\meta{options}|}|\\
% This command is just for setting options.
-% \item \cs{pdfbookmark}|[|\meta{options}|]{|\meta{title}|}|\\
+% \item \cs{bookmark}|[|\meta{options}|]{|\meta{title}|}|\\
% This command sets the bookmark. The option settings remain
% limited to this bookmark.
% \end{enumerate}
@@ -243,7 +244,7 @@ and the derived files
% Supported drivers are \xoption{pdftex}, \xoption{dvips},
% \xoption{dvipsone}, \xoption{textures},
% \xoption{dvipdfm} (\xoption{xetex}), and \xoption{vtex}.
-% The \TeX\ engines pdf\TeX, Xe\TeX, and V\TeX\ are automatically detected.
+% The \TeX\ engines \pdfTeX, Xe\TeX, and V\TeX\ are automatically detected.
% The default for the DVI drivers is \xoption{dvips}. This can
% be changed in the configuration file \xfile{bookmark.cfg} by
% \cs{BookmarkDefaultDriver}, e.g.:
@@ -251,6 +252,18 @@ and the derived files
% |\def\BookmarkDefaultDriver{dvipdfm}|
% \end{quote}
%
+% \paragraph{Open bookmarks with dvipdfmx.} Since 2007-03-29 the
+% cvs version of dvipmdfmx contains a patch that extends the
+% \cs{special} for bookmarks in order to specify the open status of
+% an outline entry. Option \xoption{dvipdfmx-outline-open} notifies
+% the package that the dvi driver program understands this kind
+% of \cs{special}. Alternatively \cs{SpecialDvipdfmxOutlineOpen}
+% can be defined as number one in the configuration file or before
+% the package is loaded, e.g.:
+% \begin{quote}
+% |\chardef\SpecialDvipdfmxOutlineOpen=1\relax|
+% \end{quote}
+%
% \subsubsection{Style options}
%
% \paragraph{Font options.}
@@ -263,22 +276,31 @@ and the derived files
% Both \xoption{bold} and \xoption{italic} can be used together.
% Using value |false| disables the font option.
%
-% \paragraph{Color options.}
+% These options are ignored with a warning if \eTeX\ is not
+% detected.
+%
+% \paragraph{Color option.}
%
% Colored bookmarks are a feature of PDF 1.4, they are not supported
% by all PDF viewers.
% \begin{description}
-% \item[\xoption{rgbcolor}:] This option expects an RGB tripel,
-% three space separated values in the range 0 until 1.
-% Example for blue: |rgbcolor=0 0 1|
% \item[\xoption{color}:] Here the color can be given as
-% color specification of packages \xpackage{color}/\xpackage{xcolor}.
-% Package \xpackage{xcolor} must be loaded first, before this option
-% can be used.
+% color specification of packages \xpackage{color} or \xpackage{xcolor}.
+% An empty value means that the color property is not set.
+% Without package \xpackage{xcolor} the recognized values
+% are restricted to
+% \begin{itemize}
+% \item Empty value, no color is set,\\
+% example: |color={}|
+% \item Explicit color specification of color model rgb,\\
+% example for red: |color=[rgb]{1,0,0}|
+% \item Explicit color specification of color model gray,\\
+% example for dark gray: |color=[gray]{0.25}|
+% \end{itemize}
+% Note that this restriction also holds if package \xpackage{color}
+% is loaded. With \xpackage{xcolor}, however, the full range
+% of color specifications can be used.
% \end{description}
-% Both options are exclusive. Used together the second option overwrites
-% the previous color option settings. The use of color is disabled by
-% using the empty value, e.g.: |color={}|
%
% \subsubsection{Action options}
%
@@ -403,19 +425,60 @@ and the derived files
% \cs{belowpdfbookmark}
% \end{quote}
%
+% \subsection{Adding bookmarks at the end}
+%
+% Package option \xoption{atend} enables the following macro:
+% \begin{declcs}{BookmarkAtEnd}
+% \M{stuff}
+% \end{declcs}
+% Macro \cs{BookmarkAtEnd} puts \meta{stuff} at the end
+% of the document. \meta{stuff} means bookmark commands.
+% Example:
+% \begin{quote}
+%\begin{verbatim}
+%\usepackage[atend]{bookmark}
+%\BookmarkAtEnd{%
+% \bookmarksetup{startatroot}%
+% \bookmark[named=LastPage, level=0]{Last page}%
+%}
+%\end{verbatim}
+% \end{quote}
+%
+% \paragraph{Remarks.}
+% \begin{itemize}
+% \item
+% \cs{BookmarkAtEnd} hides the fact that the method for
+% adding bookmarks at the end of the document depends
+% on the driver.
+%
+% Some drivers
+% (\xoption{pdftex}, \xoption{dvips}, \xoption{dvipsone},
+% \xoption{textures})
+% uses \LaTeX's \cs{AtEndDocument} for this purpose.
+%
+% However \cs{AtEndDocument} cannot be used in general.
+% The last page can already be finished if the hook
+% of \cs{AtEndDocument} is called.
+% The implementation of the other drivers
+% (\xoption{dvipdfm}, \xoption{xetex}, \xoption{vtex})
+% depends on
+% \cs{special} that does not have an effect after the last
+% page. In this case \cs{AtEndDvi} of package \xpackage{atenddvi}
+% helps. It puts its argument on last page of the document.
+% Two \LaTeX\ runs are necessary at least, because
+% the last page is detected by a reference.
+% \item
+% The time of expansion of the argument of \cs{BookmarkAtEnd}
+% is not specified. This can happen immediately or at the end
+% of the document.
+% \end{itemize}
+%
% \subsection{Limitations/ToDos}
%
% \begin{itemize}
-% \item Support for missing driver (vtexpdfmark).
% \item Support for missing actions (Launch, \dots).
% \item Better design for \xpackage{hyperref}'s option
% \xoption{bookmarkstype}.
-% \item Adding bookmarks at the end of the document
-% is difficult for \xoption{dvipdfm}, because the \cs{special}
-% must go into a page. The problem can be solved by two runs
-% using \xpackage{zref-abspage} for detecting the last page and
-% package \xpackage{everyshi} for adding the \cs{special}s at the
-% end of the last page.
% \end{itemize}
%
% \section{Example}
@@ -429,30 +492,37 @@ and the derived files
\usepackage{hyperref}
\usepackage[
open,
- openlevel=2
-]{bookmark}
+ openlevel=2,
+ atend
+]{bookmark}[2007/04/09]
\bookmarksetup{color=blue}
+\BookmarkAtEnd{%
+ \bookmarksetup{startatroot}%
+ \bookmark[named=LastPage, level=0]{End/Last page}%
+ \bookmark[named=FirstPage, level=1]{First page}%
+}
+
\begin{document}
\section{First section}
\subsection{Subsection A}
\begin{figure}
\hypertarget{fig}{}%
- \bookmark[
- rellevel=1,
- keeplevel,
- dest=fig
- ]{A figure}
A figure.
\end{figure}
+\bookmark[
+ rellevel=1,
+ keeplevel,
+ dest=fig
+]{A figure}
\subsection{Subsection B}
\subsubsection{Subsubsection C}
\subsection{Umlauts: \"A\"O\"U\"a\"o\"u\ss}
\newpage
\bookmarksetup{
bold,
- rgbcolor=1 0 0
+ color=[rgb]{1,0,0}
}
\section{Very important section}
\bookmarksetup{
@@ -527,13 +597,41 @@ and the derived files
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bookmark}%
- [2007/03/03 v0.6 PDF bookmarks (HO)]
+ [2007/04/09 v0.8 PDF bookmarks (HO)]%
% \end{macrocode}
%
% \subsubsection{Requirements}
%
+% \paragraph{\eTeX.}
+%
% \begin{macrocode}
-\RequirePackage{pdfescape}%
+\newif\ifBKM@WithFlags
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname numexpr\endcsname\relax
+ \def\BKM@CalcExpr#1#2#3#4{%
+ \begingroup
+ \count@=#2\relax
+ \advance\count@ by#3#4\relax
+ \edef\x{\endgroup
+ \def\noexpand#1{\the\count@}%
+ }%
+ \x
+ }%
+ \BKM@WithFlagsfalse
+\else
+ \def\BKM@CalcExpr#1#2#3#4{%
+ \edef#1{%
+ \the\numexpr#2#3#4\relax
+ }%
+ }%
+ \BKM@WithFlagstrue
+\fi
+% \end{macrocode}
+%
+% \paragraph{Escape features of \pdfTeX.}
+%
+% \begin{macrocode}
+\RequirePackage{pdfescape}[2007/03/20]
\def\BKM@EscapeName#1{%
\ifx#1\@empty
\else
@@ -565,8 +663,11 @@ and the derived files
\RequirePackage{ifvtex}
\RequirePackage{hyperref}
\RequirePackage{auxhook}
-\RequirePackage{flags}
\RequirePackage{kvoptions}
+\RequirePackage{hycolor}
+\ifBKM@WithFlags
+ \RequirePackage{flags}%
+\fi
% \end{macrocode}
%
% \subsubsection{Package options}
@@ -623,7 +724,7 @@ and the derived files
\DeclareBoolOption{keeplevel}
\DeclareBoolOption{startatroot}
\define@key{BKM}{rellevel}{%
- \edef\BKM@level{\number\numexpr#1+\BKM@currentlevel\relax}%
+ \BKM@CalcExpr\BKM@level{#1}+\BKM@currentlevel
}
\def\BKM@currentlevel{0}
% \end{macrocode}
@@ -670,48 +771,50 @@ and the derived files
% \paragraph{Style options.}
%
% \begin{macrocode}
-\resetflags{BKM@style}
-\define@key{BKM}{italic}[true]{%
- \expandafter\ifx\csname if#1\endcsname\iftrue
- \setflag{BKM@style}{1}%
- \else
- \clearflag{BKM@style}{1}%
- \fi
-}
-\define@key{BKM}{bold}[true]{%
- \expandafter\ifx\csname if#1\endcsname\iftrue
- \setflag{BKM@style}{2}%
- \else
- \clearflag{BKM@style}{2}%
- \fi
+\ifBKM@WithFlags
+ \expandafter\@firstoftwo
+\else
+ \expandafter\@secondoftwo
+\fi
+{%
+ \resetflags{BKM@style}%
+ \define@key{BKM}{italic}[true]{%
+ \expandafter\ifx\csname if#1\endcsname\iftrue
+ \setflag{BKM@style}{1}%
+ \else
+ \clearflag{BKM@style}{1}%
+ \fi
+ }%
+ \define@key{BKM}{bold}[true]{%
+ \expandafter\ifx\csname if#1\endcsname\iftrue
+ \setflag{BKM@style}{2}%
+ \else
+ \clearflag{BKM@style}{2}%
+ \fi
+ }%
+ \def\BKM@PrintStyle{%
+ \printflags{BKM@style}%
+ }%
+}{%
+ \def\BKM@temp#1{%
+ \define@key{BKM}{#1}[true]{%
+ \PackageWarning{bookmark}{%
+ Option `#1' is not available\MessageBreak
+ because of missing e-TeX%
+ }%
+ }%
+ }%
+ \BKM@temp{italic}%
+ \BKM@temp{bold}%
+ \def\BKM@PrintStyle{0}%
}
% \end{macrocode}
%
% \paragraph{Options for color.}
%
% \begin{macrocode}
-\define@key{BKM}{rgbcolor}{%
- \def\BKM@color{#1}%
-}
\define@key{BKM}{color}{%
- \ifx\\#1\\%
- \let\BKM@color\@empty
- \else
- \@ifundefined{XC@bordercolor}{%
- \PackageWarning{bookmark}{%
- Load package `xcolor' (version >= 2.11) first.\MessageBreak
- Ignoring color specification%
- }%
- }{%
- \begingroup
- \csname @safe@activestrue\endcsname
- \XC@bordercolor{}{#1}%
- \expandafter\endgroup
- \expandafter\def\expandafter\BKM@color\expandafter{%
- \@bordercolor
- }%
- }%
- \fi
+ \HyColor@BookmarkColor{#1}\BKM@color{bookmark}{color}%
}
\let\BKM@color\@empty
% \end{macrocode}
@@ -906,6 +1009,15 @@ and the derived files
}
% \end{macrocode}
%
+% \subsubsection{Option \xoption{atend}}
+%
+% \begin{macrocode}
+\DeclareBoolOption{atend}
+\def\BKM@DisableOptions{%
+ \DisableKeyvalOption{BKM}{atend}%
+}
+% \end{macrocode}
+%
% \subsubsection{Driver setup and loading}
%
% \paragraph{Driver detection.}
@@ -915,18 +1027,31 @@ and the derived files
\define@key{BKM}{#1}[]{%
\def\BKM@driver{#1}%
}%
- \g@addto@macro\BKM@DisableDriverOptions{%
+ \g@addto@macro\BKM@DisableOptions{%
\DisableKeyvalOption{BKM}{#1}%
}%
}
-\let\BKM@DisableDriverOptions\@empty
\BKM@DefineDriverKey{pdftex}
\BKM@DefineDriverKey{dvips}
\BKM@DefineDriverKey{dvipsone}
\BKM@DefineDriverKey{textures}
\BKM@DefineDriverKey{dvipdfm}
+\BKM@DefineDriverKey{dvipdfmx}
\BKM@DefineDriverKey{xetex}
\BKM@DefineDriverKey{vtex}
+\define@key{BKM}{dvipdfmx-outline-open}[true]{%
+ \expandafter\ifx\csname if#1\expandafter\endcsname
+ \csname iftrue\endcsname
+ \chardef\SpecialDvipdfmxOutlineOpen\@ne
+ \else
+ \chardef\SpecialDvipdfmxOutlineOpen\z@
+ \fi
+}
+\g@addto@macro\BKM@DisableOptions{%
+ \DisableKeyvalOption{BKM}{dvipdfmx-outline-open}%
+}
+% \end{macrocode}
+% \begin{macrocode}
\InputIfFileExists{bookmark.cfg}{}{}
\providecommand*{\BookmarkDriverDefault}{dvips}
\ifpdf
@@ -938,7 +1063,7 @@ and the derived files
\ifvtex
\def\BKM@driver{vtex}%
\else
- \let\BKM@driver\BookmarkDriverDefault
+ \edef\BKM@driver{\BookmarkDriverDefault}%
\fi
\fi
\fi
@@ -948,12 +1073,26 @@ and the derived files
%
% \begin{macrocode}
\ProcessKeyvalOptions*
-\BKM@DisableDriverOptions
+\BKM@DisableOptions
% \end{macrocode}
%
% \paragraph{Driver validation and loading.}
%
% \begin{macrocode}
+\newif\ifBKM@DvipdfmxOutlineOpen
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname SpecialDvipdfmxOutlineOpen\endcsname\relax
+\else
+ \ifnum\SpecialDvipdfmxOutlineOpen>\z@
+ \BKM@DvipdfmxOutlineOpentrue
+ \fi
+\fi
+% \end{macrocode}
+% \begin{macrocode}
+\def\BKM@temp{dvipdfmx}%
+\ifx\BKM@temp\BKM@driver
+ \def\BKM@driver{dvipdfm}%
+\fi
\def\BKM@temp{pdftex}%
\ifpdf
\ifx\BKM@temp\BKM@driver
@@ -1023,9 +1162,8 @@ and the derived files
\pdfbookmark[\BKM@currentlevel]%
}
\renewcommand*{\subpdfbookmark}{%
- \expandafter\pdfbookmark\expandafter[%
- \the\numexpr\BKM@currentlevel+1\relax
- ]%
+ \BKM@CalcExpr\BKM@CalcResult\BKM@currentlevel+1%
+ \expandafter\pdfbookmark\expandafter[\BKM@CalcResult]%
}
\renewcommand*{\belowpdfbookmark}[2]{%
\xdef\BKM@gtemp{\number\BKM@currentlevel}%
@@ -1072,7 +1210,7 @@ and the derived files
%<*dvipdfm>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bkm-dvipdfm.def}%
- [2007/03/03 v0.6 bookmark driver for dvipdfm (HO)]
+ [2007/04/09 v0.8 bookmark driver for dvipdfm (HO)]%
% \end{macrocode}
%
% \begin{macrocode}
@@ -1111,7 +1249,7 @@ and the derived files
\expandafter\expandafter\expandafter\BKM@getx
\csname BKM@\BKM@prev\endcsname
\ifnum\BKM@level>\BKM@x@level\relax
- \edef\BKM@abslevel{\the\numexpr\BKM@x@abslevel+1\relax}%
+ \BKM@CalcExpr\BKM@abslevel\BKM@x@abslevel+1%
\expandafter\xdef\csname BKM@\the\BKM@id\endcsname{%
{\BKM@prev}{\BKM@level}\BKM@abslevel
}%
@@ -1122,7 +1260,7 @@ and the derived files
\fi
}%
\pdfstringdef\BKM@title{#2}%
- \edef\BKM@FLAGS{\printflags{BKM@style}}%
+ \edef\BKM@FLAGS{\BKM@PrintStyle}%
\let\BKM@action\@empty
\ifx\BKM@gotor\@empty
\ifx\BKM@dest\@empty
@@ -1170,7 +1308,7 @@ and the derived files
\ifx\BKM@page\@empty
\def\BKM@page{0}%
\else
- \edef\BKM@page{\the\numexpr\BKM@page-1\relax}%
+ \BKM@CalcExpr\BKM@page\BKM@page-1%
\fi
\ifx\BKM@view\@empty
\def\BKM@view{Fit}%
@@ -1190,7 +1328,14 @@ and the derived files
}%
\fi
\special{pdf:%
- out \BKM@abslevel
+ out \ifBKM@DvipdfmxOutlineOpen
+ \ifBKM@open
+ \ifnum\BKM@level<\BKM@openlevel
+ -%
+ \fi
+ \fi
+ \fi
+ \BKM@abslevel
<<%
/Title(\BKM@title)%
\ifx\BKM@color\@empty
@@ -1225,7 +1370,7 @@ and the derived files
%<*vtex>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bkm-vtex.def}%
- [2007/03/03 v0.6 bookmark driver for VTeX (HO)]
+ [2007/04/09 v0.8 bookmark driver for VTeX (HO)]%
% \end{macrocode}
%
% \begin{macrocode}
@@ -1285,7 +1430,7 @@ and the derived files
}%
\pdfstringdef\BKM@title{#2}%
\BKM@vtex@title
- \edef\BKM@FLAGS{\printflags{BKM@style}}%
+ \edef\BKM@FLAGS{\BKM@PrintStyle}%
\let\BKM@action\@empty
\ifx\BKM@gotor\@empty
\ifx\BKM@dest\@empty
@@ -1510,7 +1655,7 @@ and the derived files
%<*pdftex>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bkm-pdftex.def}%
- [2007/03/03 v0.6 bookmark driver for pdftex (HO)]
+ [2007/04/09 v0.8 bookmark driver for pdfTeX (HO)]%
% \end{macrocode}
%
% \begin{macrocode}
@@ -1580,7 +1725,7 @@ and the derived files
\ifx\BKM@DO@page\@empty
\def\BKM@DO@page{0}%
\else
- \edef\BKM@DO@page{\the\numexpr\BKM@DO@page-1\relax}%
+ \BKM@CalcExpr\BKM@DO@page\BKM@DO@page-1%
\fi
\ifx\BKM@DO@view\@empty
\def\BKM@DO@view{Fit}%
@@ -1622,7 +1767,7 @@ and the derived files
%<*dvips>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bkm-dvips.def}%
- [2007/03/03 v0.6 bookmark driver for dvips (HO)]
+ [2007/04/09 v0.8 bookmark driver for dvips (HO)]%
% \end{macrocode}
% \begin{macrocode}
\def\BKM@PSHeaderFile#1{%
@@ -1637,7 +1782,7 @@ and the derived files
%<*dvipsone>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bkm-dvipsone.def}%
- [2007/03/03 v0.6 bookmark driver for dvipsone (HO)]
+ [2007/04/09 v0.8 bookmark driver for dvipsone (HO)]%
% \end{macrocode}
% \begin{macrocode}
\def\BKM@PSHeaderFile#1{%
@@ -1652,7 +1797,7 @@ and the derived files
%<*textures>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{bkm-textures.def}%
- [2007/03/03 v0.6 bookmark driver for textures (HO)]
+ [2007/04/09 v0.8 bookmark driver for textures (HO)]%
% \end{macrocode}
% \begin{macrocode}
\def\BKM@PSHeaderFile#1{%
@@ -1685,7 +1830,7 @@ and the derived files
/pdfmark/cleartomark load put%
}%
}%
- \BKM@write{ifelse}
+ \BKM@write{ifelse}%
}
\def\BKM@write#{%
\immediate\write\BKM@file
@@ -1871,10 +2016,9 @@ and the derived files
{\BKM@prev}{\BKM@level}0%
}%
\ifnum\BKM@prev>\z@
+ \BKM@CalcExpr\BKM@CalcResult\BKM@x@childs+1%
\expandafter\xdef\csname BKM@\BKM@prev\endcsname{%
- {\BKM@x@parent}{\BKM@x@level}{%
- \the\numexpr\BKM@x@childs+1\relax
- }%
+ {\BKM@x@parent}{\BKM@x@level}{\BKM@CalcResult}%
}%
\fi
\BKM@swfalse
@@ -1884,7 +2028,7 @@ and the derived files
\fi
}%
\pdfstringdef\BKM@title{#2}%
- \edef\BKM@FLAGS{\printflags{BKM@style}}%
+ \edef\BKM@FLAGS{\BKM@PrintStyle}%
\BKM@EscapeHex\BKM@dest
\BKM@EscapeHex\BKM@uri
\BKM@EscapeHex\BKM@gotor
@@ -1958,16 +2102,134 @@ and the derived files
%</pdftex|pdfmark>
% \end{macrocode}
%
+% \subsection{Option \xoption{atend}}
%
+% \subsubsection{Hook}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+% \begin{macrocode}
+\ifBKM@atend
+\else
+% \end{macrocode}
+% \begin{macro}{\BookmarkAtEnd}
+% This is a dummy definition that generates a warning
+% if option \xoption{atend} has not been given.
+% \begin{macrocode}
+ \newcommand{\BookmarkAtEnd}[1]{%
+ \PackageWarning{bookmark}{%
+ Ignored, because option `atend' is missing%
+ }%
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \expandafter\endinput
+\fi
+% \end{macrocode}
+% \begin{macro}{\BookmarkAtEnd}
+% \begin{macrocode}
+\newcommand*{\BookmarkAtEnd}{%
+ \g@addto@macro\BKM@EndHook
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\let\BKM@EndHook\@empty
+% \end{macrocode}
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \subsubsection{Drivers using \cs{AtEndDocument}}
+%
+% \cs{AtEndDocument} can be used, if the implementation
+% of \cs{bookmark} does not depend on \cs{special}:
+% \begin{itemize}
+% \item
+% Driver \xoption{pdftex} uses \cs{pdfoutline} that can
+% be used after the last page.
+% \item
+% PostScript drivers such as
+% \xoption{dvips} use an external PostScript header file
+% for the bookmarks. File writing can be done after
+% the last shipout page, thus \cs{AtEndDocument} works.
+% \end{itemize}
+% \begin{macrocode}
+%<*pdftex|pdfmark>
+\ifBKM@atend
+ \AtBeginDocument{%
+ \AtEndDocument{%
+ \clearpage
+ \BKM@EndHook
+ }%
+ }%
+\fi
+%</pdftex|pdfmark>
+% \end{macrocode}
+%
+% \subsubsection{Drivers using \cs{AtEndDvi}}
+%
+% The other drivers implement \cs{bookmark} using \cs{special}
+% commands. Thus the last bookmarks must be put on the last page,
+% not afterwards.
+% \cs{AtEndDocument} cannot be used, because it is too late, the
+% last page can already be output. Therefore we use package
+% \xpackage{atenddvi} that uses the help of packages \xpackage{everyshi}
+% and \xpackage{zref}. The argument of \cs{AtEndDvi} is put
+% at the end of the last page. At least two \LaTeX\ runs are necessary.
+% \begin{macrocode}
+%<*dvipdfm|vtex>
+\ifBKM@atend
+ \RequirePackage{atenddvi}%
+ \AtEndDvi{\BKM@EndHook}%
+\fi
+%</dvipdfm|vtex>
+% \end{macrocode}
% \section{Installation}
%
-% \paragraph{CTAN.} This package is available on
+% \subsection{Download}
+%
+% \paragraph{Package.} This package is available on
% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}:
% \begin{description}
% \item[\CTAN{macros/latex/contrib/oberdiek/bookmark.dtx}] The source file.
% \item[\CTAN{macros/latex/contrib/oberdiek/bookmark.pdf}] Documentation.
% \end{description}
%
+%
+% \paragraph{Bundle.} All the packages of the bundle `oberdiek'
+% are also available in a TDS compliant ZIP archive. There
+% the packages are already unpacked and the documentation files
+% are generated. The files and directories obey the TDS standard.
+% \begin{description}
+% \item[\CTAN{macros/latex/contrib/oberdiek/oberdiek-tds.zip}]
+% \end{description}
+%
+% \subsection{Bundle installation}
+%
+% \paragraph{Unpacking.} Unpack the \xfile{oberdiek-tds.zip} in the
+% TDS tree (also known as \xfile{texmf} tree) of your choice.
+% Example (linux):
+% \begin{quote}
+% |unzip oberdiek-tds.zip -d ~/texmf|
+% \end{quote}
+%
+% \paragraph{Script installation.}
+% Check the directory \xfile{TDS:scripts/oberdiek/} for
+% scripts that need further installation steps.
+% Package \xpackage{attachfile2} comes with the Perl script
+% \xfile{pdfatfi.pl} that should be installed in such a way
+% that it can be called as \texttt{pdfatfi}.
+% Example (linux):
+% \begin{quote}
+% |chmod +x scripts/oberdiek/pdfatfi.pl|\\
+% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/|
+% \end{quote}
+%
+% \subsection{Package installation}
+%
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
% \docstrip\ archive. The files are extracted by running the
% \xfile{.dtx} through \plainTeX:
@@ -2005,8 +2267,10 @@ and the derived files
% TDS installing feature, then some files can already be in the right
% place, see the documentation of \docstrip.
%
-% \paragraph{Refresh file databases.} If your \TeX~distribution
-% (\teTeX, \mikTeX, \dots) rely on file databases, you must refresh
+% \subsection{Refresh file name databases}
+%
+% If your \TeX~distribution
+% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh
% these. For example, \teTeX\ users run \verb|texhash| or
% \verb|mktexlsr|.
%
@@ -2083,10 +2347,11 @@ and the derived files
% Driver options \xoption{vtex} (PDF mode), \xoption{dvipsone},
% and \xoption{textures} added.
% \item
-% Option \xoption{depth} also accepts division name like \xpackage{hyperref}'s
+% Implementation of option \xoption{depth} completed. Division names
+% are supported, see \xpackage{hyperref}'s
% option \xoption{bookmarksdepth}.
% \item
-% \xpackage{hyperref}'s \xoption{bookmarksopen},
+% \xpackage{hyperref}'s options \xoption{bookmarksopen},
% \xoption{bookmarksopenlevel}, and \xoption{bookmarksdepth} respected.
% \end{Version}
% \begin{Version}{2007/03/03 v0.6}
@@ -2094,6 +2359,23 @@ and the derived files
% Option \xoption{numbered} as alias for \xpackage{hyperref}'s
% \xoption{bookmarksnumbered}.
% \end{Version}
+% \begin{Version}{2007/03/07 v0.7}
+% \item
+% Dependency from \eTeX\ removed.
+% \end{Version}
+% \begin{Version}{2007/04/09 v0.8}
+% \item
+% Option \xoption{atend} added.
+% \item
+% Option \xoption{rgbcolor} removed.
+% \verb|rgbcolor=<r> <g> <b>| can be replaced by
+% \verb|color=[rgb]{<r>,<g>,<b>}|.
+% \item
+% Support of recent cvs version (2007-03-29) of dvipdfmx
+% that extends the \cs{special} for bookmarks to specify
+% open outline entries. Option \xoption{dvipdfmx-outline-open}
+% or \cs{SpecialDvipdfmxOutlineOpen} notify the package.
+% \end{Version}
% \end{History}
%
% \PrintIndex