summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/oberdiek/bookmark.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-03-07 18:06:13 +0000
committerKarl Berry <karl@freefriends.org>2007-03-07 18:06:13 +0000
commit985a9d981dc301403c0a79353e78499c3365a629 (patch)
treeb220929a73b76bf5c6ab97117985a45bc2ec9d9b /Master/texmf-dist/tex/latex/oberdiek/bookmark.sty
parent1c15eb0bc227a081215bf372a3756aadc4d19d09 (diff)
oberdiek update: bookmark0.6, hypbmsec2.3 (5mar07)
git-svn-id: svn://tug.org/texlive/trunk@4010 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/oberdiek/bookmark.sty')
-rw-r--r--Master/texmf-dist/tex/latex/oberdiek/bookmark.sty150
1 files changed, 123 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/oberdiek/bookmark.sty b/Master/texmf-dist/tex/latex/oberdiek/bookmark.sty
index cbf01370757..ad62d8cea75 100644
--- a/Master/texmf-dist/tex/latex/oberdiek/bookmark.sty
+++ b/Master/texmf-dist/tex/latex/oberdiek/bookmark.sty
@@ -25,12 +25,13 @@
%% This work consists of the main source file bookmark.dtx
%% and the derived files
%% bookmark.sty, bookmark.pdf, bookmark.ins, bookmark.drv,
-%% bkm-dvipdfm.def, bkm-dvips.def, bkm-pdftex.def,
+%% bkm-dvipdfm.def, bkm-dvips.def, bkm-dvipsone.def,
+%% bkm-textures.def, bkm-pdftex.def, bkm-vtex.def,
%% bookmark-example.tex.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bookmark}%
- [2007/02/22 v0.4 PDF bookmarks (HO)]
+ [2007/03/03 v0.6 PDF bookmarks (HO)]
\RequirePackage{pdfescape}%
\def\BKM@EscapeName#1{%
\ifx#1\@empty
@@ -55,15 +56,57 @@
}%
\RequirePackage{ifpdf}
\RequirePackage{ifxetex}
+\RequirePackage{ifvtex}
\RequirePackage{hyperref}
\RequirePackage{auxhook}
\RequirePackage{flags}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=BKM,prefix=BKM@}
\newcommand*{\bookmarksetup}{\setkeys{BKM}}
-\DeclareBoolOption{open}
+\DeclareBoolOption[\ifHy@bookmarksopen true\else false\fi]{open}
\DeclareStringOption[\maxdimen]{openlevel}
-\DeclareStringOption[\c@tocdepth]{depth}
+\edef\BKM@openlevel{\number\@bookmarksopenlevel}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname Hy@bookmarksdepth\endcsname\relax
+ \def\BKM@depth{\c@tocdepth}%
+\else
+ \let\BKM@depth\Hy@bookmarksdepth
+\fi
+\define@key{BKM}{depth}[]{%
+ \edef\BKM@param{#1}%
+ \ifx\BKM@param\@empty
+ \def\BKM@depth{\c@tocdepth}%
+ \else
+ \@ifundefined{toclevel@\BKM@param}{%
+ \@onelevel@sanitize\BKM@param
+ \edef\BKM@temp{\expandafter\@car\BKM@param\@nil}%
+ \ifcase 0\expandafter\ifx\BKM@temp-1\fi
+ \expandafter\ifnum\expandafter`\BKM@temp>47 %
+ \expandafter\ifnum\expandafter`\BKM@temp<58 %
+ 1%
+ \fi
+ \fi
+ \relax
+ \PackageWarning{bookmark}{%
+ Unknown document division name (\BKM@param)%
+ }%
+ \else
+ \BKM@SetDepth\BKM@param
+ \fi
+ }{%
+ \BKM@SetDepth{\csname toclevel@\BKM@param\endcsname}%
+ }%
+ \fi
+}
+\def\BKM@SetDepth#1{%
+ \begingroup
+ \setbox\z@=\hbox{%
+ \count@=#1\relax
+ \expandafter
+ }%
+ \expandafter\endgroup
+ \expandafter\def\expandafter\BKM@depth\expandafter{\the\count@}%
+}
\DeclareStringOption[\BKM@currentlevel]{level}[\BKM@currentlevel]
\DeclareBoolOption{keeplevel}
\DeclareBoolOption{startatroot}
@@ -71,6 +114,36 @@
\edef\BKM@level{\number\numexpr#1+\BKM@currentlevel\relax}%
}
\def\BKM@currentlevel{0}
+\DeclareBoolOption[%
+ \ifHy@bookmarksnumbered true\else false\fi
+]{numbered}
+\g@addto@macro\BKM@numberedtrue{%
+ \let\ifHy@bookmarksnumbered\iftrue
+}
+\g@addto@macro\BKM@numberedfalse{%
+ \let\ifHy@bookmarksnumbered\iffalse
+}
+\g@addto@macro\Hy@bookmarksnumberedtrue{%
+ \let\ifBKM@numbered\iftrue
+}
+\g@addto@macro\Hy@bookmarksnumberedfalse{%
+ \let\ifBKM@numbered\iffalse
+}
+\def\BKM@PatchHyperrefOption#1{%
+ \expandafter\BKM@@PatchHyperrefOption\csname KV@Hyp@#1\endcsname%
+}
+\def\BKM@@PatchHyperrefOption#1{%
+ \expandafter\BKM@@@PatchHyperrefOption#1{##1}\BKM@nil#1%
+}
+\def\BKM@@@PatchHyperrefOption#1\BKM@nil#2#3{%
+ \def#2##1{%
+ #1%
+ \bookmarksetup{#3={##1}}%
+ }%
+}
+\BKM@PatchHyperrefOption{bookmarksopen}{open}
+\BKM@PatchHyperrefOption{bookmarksopenlevel}{openlevel}
+\BKM@PatchHyperrefOption{bookmarksdepth}{depth}
\resetflags{BKM@style}
\define@key{BKM}{italic}[true]{%
\expandafter\ifx\csname if#1\endcsname\iftrue
@@ -103,7 +176,9 @@
\csname @safe@activestrue\endcsname
\XC@bordercolor{}{#1}%
\expandafter\endgroup
- \expandafter\def\expandafter\BKM@color\expandafter{\@bordercolor}%
+ \expandafter\def\expandafter\BKM@color\expandafter{%
+ \@bordercolor
+ }%
}%
\fi
}
@@ -284,21 +359,22 @@
\endgroup
\fi
}
-\define@key{BKM}{pdftex}[]{%
- \def\BKM@driver{pdftex}%
-}
-\define@key{BKM}{dvips}[]{%
- \def\BKM@driver{dvips}%
-}
-\define@key{BKM}{dvipdfm}[]{%
- \def\BKM@driver{dvipdfm}%
-}
-\define@key{BKM}{dvipdfmx}[]{%
- \def\BKM@driver{dvipdfm}%
-}
-\define@key{BKM}{xetex}[]{%
- \def\BKM@driver{dvipdfm}%
+\def\BKM@DefineDriverKey#1{%
+ \define@key{BKM}{#1}[]{%
+ \def\BKM@driver{#1}%
+ }%
+ \g@addto@macro\BKM@DisableDriverOptions{%
+ \DisableKeyvalOption{BKM}{#1}%
+ }%
}
+\let\BKM@DisableDriverOptions\@empty
+\BKM@DefineDriverKey{pdftex}
+\BKM@DefineDriverKey{dvips}
+\BKM@DefineDriverKey{dvipsone}
+\BKM@DefineDriverKey{textures}
+\BKM@DefineDriverKey{dvipdfm}
+\BKM@DefineDriverKey{xetex}
+\BKM@DefineDriverKey{vtex}
\InputIfFileExists{bookmark.cfg}{}{}
\providecommand*{\BookmarkDriverDefault}{dvips}
\ifpdf
@@ -307,15 +383,15 @@
\ifxetex
\def\BKM@driver{dvipdfm}%
\else
- \let\BKM@driver\BookmarkDriverDefault
+ \ifvtex
+ \def\BKM@driver{vtex}%
+ \else
+ \let\BKM@driver\BookmarkDriverDefault
+ \fi
\fi
\fi
\ProcessKeyvalOptions*
-\DisableKeyvalOption{BKM}{pdftex}
-\DisableKeyvalOption{BKM}{dvips}
-\DisableKeyvalOption{BKM}{dvipdfm}
-\DisableKeyvalOption{BKM}{dvipdfmx}
-\DisableKeyvalOption{BKM}{xetex}
+\BKM@DisableDriverOptions
\def\BKM@temp{pdftex}%
\ifpdf
\ifx\BKM@temp\BKM@driver
@@ -343,6 +419,26 @@
}%
\let\BKM@driver\BKM@temp
\fi
+ \else
+ \def\BKM@temp{vtex}%
+ \ifvtex
+ \ifx\BKM@temp\BKM@driver
+ \else
+ \PackageWarningNoLine{bookmark}{%
+ Wrong driver `\BKM@driver',\MessageBreak
+ using `vtex' for VTeX instead%
+ }%
+ \let\BKM@driver\BKM@temp
+ \fi
+ \else
+ \ifx\BKM@temp\BKM@driver
+ \PackageError{bookmark}{%
+ Wrong driver, VTeX is not running in PDF mode.\MessageBreak
+ Package loading is aborted%
+ }\@ehc
+ \expandafter\expandafter\expandafter\endinput
+ \fi
+ \fi
\fi
\fi
\InputIfFileExists{bkm-\BKM@driver.def}{}{%
@@ -370,12 +466,12 @@
\global\let\BKM@currentlevel\BKM@gtemp
}
\renewcommand*{\Hy@writebookmark}[5]{%
- \ifnum#4>\Hy@bookmarksdepth\relax
+ \ifnum#4>\BKM@depth\relax
\else
\def\BKM@type{#5}%
\ifx\BKM@type\Hy@bookmarkstype
\begingroup
- \ifHy@bookmarksnumbered
+ \ifBKM@numbered
\let\numberline\Hy@numberline
\let\partnumberline\Hy@numberline
\let\chapternumberline\Hy@numberline