summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hyperref/bmhydoc.sty
blob: d25c4d6bf816291be412f0af61553a5004f75cb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
%% Copyright
%% 1995-2015 Heiko Oberdiek
%% 2016-2019 Oberdiek Package Support Group
%% 2019-2020 LaTeX3 Project
%%      https://github.com/latex3/hyperref/issues
%%
%% This file is part of the `Hyperref Bundle'.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bmhydoc}
  [2020/01/14 Bookmark section with hyperref documentation (HO)]

% This package adds bookmark entries that are added at the end
% and lists and links the PDF files of the hyperref documentation.
% Only pdfTeX in PDF mode is supported by this package.
%
% History
%
%   2005/08/27
%     * First version
%   2006/02/08
%     * Comments added
%     * \HyperrefOverview
%   2007/03/19
%     * Use package bookmark that also support other drivers
%       than pdfTeX.
%   2009/11/22
%     * Bug fix: correction of "this file".

\RequirePackage{pifont}
\RequirePackage[atend]{bookmark}[2007/04/04]

\BookmarkAtEnd{%
  \bookmarksetup{%
    startatroot,%
    open,%
    openlevel=2%
  }%
}

\newcommand*{\@bmhydoc}[4][]{%
  \BookmarkAtEnd{%
    \bookmark[%
      gotor={#3},%
      color={[rgb]{0,0,1}},%
      level={#2},%
      view={XYZ null null null},%
      #1,%
    ]{#4}%
  }%
}
\AtEndDocument{%
  \@bmhydoc[open=false]{0}{manual.pdf}{Hyperref manual}
  \@bmhydoc{1}{slides.pdf}{Bookmark talk, slides}
  \@bmhydoc{2}{paper.pdf}{Bookmark talk, paper}
  \@bmhydoc{1}{hyperref.pdf}{Sources: hyperref.dtx}
  \@bmhydoc{2}{backref.pdf}{backref.dtx}
  \@bmhydoc{2}{nameref.pdf}{nameref.dtx}
}

\newcommand*{\HyperrefOverview}{%
  \def\bmhydoc@title{Documentation overview for \texttt{hyperref}}%
  \@ifstar{%
    % \phantomsection
    % \addcontentsline{toc}{section}{\bmhydoc@title}%
    \section*{\bmhydoc@title}%
    \@HyperrefOverview
  }{%
    \section{\bmhydoc@title}%
    \@HyperrefOverview
  }%
}
\def\@HyperrefOverview{%
  The documentation for package \texttt{hyperref} consists
  of several files:
  \begingroup
    \newcommand*{\entry}[2]{%
      \item[\href{file:##1}{##2}]%
      \ignorespaces
    }%
    \begin{description}
      \entry{manual.pdf}{\textbf{Manual}}
        The \textbf{USER MANUAL} (also available as HTML).
      \entry{ChangeLog.txt}{ChangeLog}
        This file records the version history.
      \entry{slides.pdf}{Bookmark talk, slides}
        Slides for the talk ``PDF information and navigation elements with
        hyperref, pdfTeX and thumbpdf'' at Euro\TeX~1999.
      \entry{paper.pdf}{Bookmark talk, paper}
        The paper version of the talk.
    \end{description}
    Source code documentation:
    \begin{description}
      \entry{hyperref.pdf}{hyperref.dtx}
        This is the source code documentation for hyperref%
        \@thisfile{hyperref}.
      \entry{backref.pdf}{backref.dtx}
        ``Back referencing from bibliographical citations''%
        \@thisfile{backref}
      \entry{nameref.pdf}{nameref.dtx}
        ``Section name references in \LaTeX''%
        \@thisfile{nameref}%
    \end{description}
  \endgroup
}
\edef\@jobname{\jobname}
\def\@thisfile#1{%
  \begingroup
    \edef\x{#1}%
    \@onelevel@sanitize\x
    \ifx\x\@jobname
      \marginpar{\hfill\ding{43}}%
      \space(this file)%
    \fi
  \endgroup
}
\endinput