diff options
author | Karl Berry <karl@freefriends.org> | 2010-10-25 23:12:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-10-25 23:12:18 +0000 |
commit | d74b95d250c7632cb73e7420db04e2e38adc3827 (patch) | |
tree | fbc6763253fbb9d309da7b613857d782ee5feccb /Master/texmf-dist/tex/latex/interfaces/interfaces-bookmark.sty | |
parent | ec47c1b7880fd4f626f8aa8377e576e03d72c24f (diff) |
new latex package interfaces (25oct10)
git-svn-id: svn://tug.org/texlive/trunk@20206 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/interfaces/interfaces-bookmark.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/interfaces/interfaces-bookmark.sty | 217 |
1 files changed, 217 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/interfaces/interfaces-bookmark.sty b/Master/texmf-dist/tex/latex/interfaces/interfaces-bookmark.sty new file mode 100644 index 00000000000..1fbbe49e829 --- /dev/null +++ b/Master/texmf-dist/tex/latex/interfaces/interfaces-bookmark.sty @@ -0,0 +1,217 @@ +%% +%% This is file `interfaces-bookmark.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% interfaces.dtx (with options: `bookmark') +%% +%% This is a generated file. +%% +%% interfaces : 2010/10/20 v1.0 - interfaces : interfaces with keys for other packages (FC) +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file interfaces.dtx +%% and the derived files +%% interfaces.sty, interfaces.pdf, interfaces.ins, +%% interfaces-base.sty, +%% interfaces-LaTeX.sty, +%% interfaces-tikz.sty, +%% interfaces-titlesec.sty, +%% interfaces-hyperref.sty, +%% interfaces-bookmark.sty, +%% interfaces-hypbmsec.sty,interfaces-hypbmsec.code.tex, +%% interfaces-fancyhdr.sty, +%% interfaces-marks.sty, +%% interfaces-tocloft.sty, +%% interfaces-makecell.sty, +%% interfaces-enumitem.sty, +%% interfaces-truncate.sty, +%% interfaces-appendix.sty, +%% interfaces-embedfile.sty, +%% interfaces-environ.sty, +%% interfaces-umrand.sty, +%% interfaces-scrlfile.sty, +%% interfaces-pgfkeys.sty, +%% interfaces-etoolbox.sty, +%% interfaces-fancyvrb.sty +%% +%% interfaces: interfaces with keys for other packages (FC) +%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr> +%% +\ProvidesPackage{interfaces-bookmark} + [2010/09/08 v1.0 more control on bookmarks (FC)] +\RequirePackage{interfaces-base} +\RequirePackage{interfaces-hyperref} +\RequirePackage{refcount} +\itf@Check@Package{bookmark} +\itf@pgfkeys +\expandafter\itf@patch\expandafter\patchcmd\csname\string\bookmark\endcsname + {\immediate\write\@mainaux}{\itf@BKM@write} + {\PackageInfo{interfaces-bookmark} + {Command \expandafter\string\csname\string\bookmark\endcsname\space + successfully patched!}} + {\PackageWarning{interfaces-bookmark} + {Command \expandafter\string\csname\string\bookmark\endcsname\space + could not be patched\MessageBreak + Loading of interfaces-bookmark is canceled}% + \endinput} +\global\let\itf@BKM@enable\@ne % 0 = disable*, 1=enable, \@M = disable +\pgfqkeys{/itf/bookmark}{% + disable/.true=\global\let\itf@BKM@enable\@M,% + disable/.false=\global\let\itf@BKM@enable\@ne,% + disable*/.true=\global\let\itf@BKM@enable\z@,% + disable*/.false=\global\let\itf@BKM@enable\@ne,% + atend/.true=\ifnum\itf@BKM@enable>0\edef\itf@BKM@enable{\number-\itf@BKM@enable}\fi,% + atend/.false=\ifnum\itf@BKM@enable<0\edef\itf@BKM@enable{\number-\itf@BKM@enable}\fi,% + bold*/.true=\pgfqkeys{/itf/bookmark}{@save={bold=true}},% + bold*/.false=\pgfqkeys{/itf/bookmark}{@save={bold=false}},% + bold*/@blank/.code=\pgfqkeys{/itf/bookmark/@restore}{bold},% + bold*/.blank=@blank,% + italic*/.true=\pgfqkeys{/itf/bookmark}{@save={italic=true}},% + italic*/.false=\pgfkeys{/itf/bookmark}{@save={italic=false}},% + italic*/@blank/.code=\pgfqkeys{/itf/bookmark/@restore}{italic},% + italic*/.blank=@blank,% + color*/.code={\ifblank{#1} + {\pgfqkeys{/itf/bookmark/@restore}{color}} + {\pgfqkeys{/itf/bookmark}{@save={color={#1}}}}% + },% + @save/.code={% + \pgfkeysifdefined{/itf/bookmark/@save/color}{} + {\pgfkeyslet{/itf/bookmark/@save/color}\BKM@color}% + \pgfkeysifdefined{/itf/bookmark/@save/FontStyle}{} + {\pgfkeyslet{/itf/bookmark/@save/FontStyle}\BS@BKM@FontStyle}% + \pgfkeysifdefined{/itf/bookmark/@save/grouplevel}{} + {\pgfkeysEsetvalue{/itf/bookmark/@save/grouplevel}{\the\currentgrouplevel}}% + \pgfkeysaddvalue{/itf/bookmark/*}{}{,#1}% + \bookmarksetup{#1}% + },% + @restore/color/.code=% + \pgfkeysifdefined{/itf/bookmark/@save/color} + {\pgfkeysgetvalue{/itf/bookmark/@save/color}\BKM@color} + {},% + @restore/FontStyle/.code=% + \pgfkeysifdefined{/itf/bookmark/@save/FontStyle} + {\pgfkeysgetvalue{/itf/bookmark/@save/FontStyle}\BS@BKM@FontStyle} + {},% + @restore/.code={% +%% \pgfqkeys{/itf/bookmark/@restore}{color,FontStyle}% repeating the following lines + \pgfkeysifdefined{/itf/bookmark/@save/color}% is quicker than setting a /.style ... + {\pgfkeysgetvalue{/itf/bookmark/@save/color}\BKM@color} + {}% + \pgfkeysifdefined{/itf/bookmark/@save/FontStyle} + {\pgfkeysgetvalue{/itf/bookmark/@save/FontStyle}\BS@BKM@FontStyle} + {}% + \pgfkeysifdefined{/itf/bookmark/@save/grouplevel} + {% shortcut: \bookmarksetup{bold*} called inside main group (level 0) + \ifnum\pgfkeysvalueof{/itf/bookmark/@save/grouplevel}=\z@ + \global\pgfkeyslet{/itf/bookmark/@save/FontStyle}\@undefined + \global\pgfkeyslet{/itf/bookmark/@save/color}\@undefined + \global\pgfkeyslet{/itf/bookmark/@save/grouplevel}\@undefined + \global\pgfkeyslet{/itf/bookmark/*}\@undefined + \global\let\BKM@color\BKM@color + \global\let\BS@BKM@FontStyle\BS@BKM@FontStyle + \else % restore after each group as needed + \pgfkeyslet{/itf/bookmark/@save/FontStyle}\@undefined + \pgfkeyslet{/itf/bookmark/@save/color}\@undefined + \pgfkeyslet{/itf/bookmark/*}\@undefined + \ifnum\currentgrouplevel>\z@ + \aftergroup\itf@BKM@restore + \else + \pgfkeyslet{/itf/bookmark/@save/grouplevel}\@undefined + \fi\fi + } + {}% + },% + @restore/bold/.code={% bold is "hidden" in \BS@BKM@FontStyle + \begingroup + \edef\itf@tp{\bookmarkget{bold}}% + \pgfqkeys{/itf/bookmark/@restore}{FontStyle}% + \count@=\bookmarkget{bold}% + \edef\itf@tp{\endgroup + \ifnum\itf@tp=\count@ + \else \noexpand\bookmarksetup{% + bold\ifcase\count@ =false\fi}\fi + }\itf@tp},% + @restore/italic/.code={% italic is "hidden" in \BS@BKM@FontStyle + \begingroup + \edef\itf@tp{\bookmarkget{italic}}% + \pgfqkeys{/itf/bookmark/@restore}{FontStyle}% + \count@=\bookmarkget{italic}% + \edef\itf@tp{\endgroup + \ifnum\itf@tp=\count@ + \else \noexpand\bookmarksetup{% + italic\ifcase\count@ =false\fi}\fi + }\itf@tp},% +} +\def\itf@BKM@restore{% + \pgfkeysifdefined{/itf/bookmark/@save/grouplevel} + {\pgfkeysalso{/itf/bookmark/@restore}} + {}% +}% \itf@BKM@restore +%% Plug the BKM keys in the interfaces pgfkeys (not efficient but quickly written...) +\define@key{BKM}{disable}[true]{\itf@pgfkeys\pgfkeysalso{/itf/bookmark/disable={#1}}} +\define@key{BKM}{disable*}[true]{\itf@pgfkeys\pgfkeysalso{/itf/bookmark/disable*={#1}}} +\define@key{BKM}{bold*}[true]{\itf@pgfkeys\pgfkeysalso{/itf/bookmark/bold*={#1}}} +\define@key{BKM}{italic*}[true]{\itf@pgfkeys\pgfkeysalso{/itf/bookmark/italic*={#1}}} +\define@key{BKM}{color*}[]{\itf@pgfkeys\pgfkeysalso{/itf/bookmark/color*={#1}}} +\define@key{BKM}{atend}[true]{\itf@pgfkeys\pgfkeysalso{/itf/bookmark/atend={#1}}}% +\def\itf@BKM@write#1{% + \aftergroup\itf@BKM@restore + \ifcase\itf@BKM@enable + \global\let\itf@BKM@enable\@ne + \or + \immediate\write\@mainaux{#1}% + \else + \ifcase -\itf@BKM@enable % (case -0 = 0 tested before) + \or % (case -1 = enable but At End) + \let\itf@BKM@enable\@ne + \edef\itf@tp{\immediate\write\@mainaux{#1}}% + \expandafter\BookmarkAtEnd\expandafter{\itf@tp}% + \fi + \fi +}% \itf@BKM@write +%% pageref= key for \bookmark (using refcount : \getpagerefnumber) +\def\itf@BKM@pageref[#1]{% + \expandafter\itf@BKM@@pageref + \csname r@#1\endcsname{#1}% +}% \itf@BKM@pageref +\def\itf@BKM@@pageref#1#2{% + \ifx#1\relax + \protect\G@refundefinedtrue + \@latex@warning{% + Hyper reference `#2' on page \thepage \space undefined + \MessageBreak for bookmark destination page + }% + \fi + \edef\BKM@page{\getrefbykeydefault{#2}{page}{1}}% +}% \itf@BKM@@pageref +\define@key{BKM}{pageref}{% + \Hy@babelnormalise\itf@BKM@pageref[{#1}]} +%% ref= key for \bookmark +\def\itf@BKM@ref[#1]{% + \expandafter\itf@BKM@@ref + \csname r@#1\endcsname{#1}% +}% \itf@BKM@ref +\def\itf@BKM@@ref#1#2{% + \ifx#1\relax + \protect\G@refundefinedtrue + \@latex@warning{% + Hyper reference `#2' on page \thepage \space undefined + \MessageBreak for bookmark destination + }% + \def\BKM@dest{??}% + \else + \edef\BKM@dest{\expandafter\@fourthoffive#1\@empty\@empty}% + \fi +}% \BKM@@ref +\define@key{BKM}{ref}{% + \Hy@babelnormalise\itf@BKM@ref[{#1}]} +\endinput +%% +%% End of file `interfaces-bookmark.sty'. |