summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/interfaces/interfaces-hypbmsec.sty
blob: 9838e5972a585fba6553a9ecfd41b745e7137c39 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
%%
%% This is file `interfaces-hypbmsec.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% interfaces.dtx  (with options: `hypbmsec')
%% 
%% This is a generated file.
%% 
%% interfaces : 2011/02/19 v3.1 - 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-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: interfaces with keys for other packages (FC)
%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%% 
\ProvidesPackage{interfaces-hypbmsec}
   [2011/02/19 v3.1 lastsection,title,anchor, etc. (FC)]
\RequirePackage{interfaces-base}
\RequirePackage{gettitlestring}
\itf@Check@Package{hypbmsec}
\def\itf@hbs@do#1{%
   \xdef\itf@hbs@currentname{\expandafter\itf@strip@at\string#1}%
   \let\hbs@tocstring\relax % <for starred sections>
   \let\hbs@bmstring\relax  % <for starred sections>
   \@ifstar
      {\itf@hbs@ssect#1}%
      {\let\hbs@seccmd=#1\hbs@checkarg}%
}% \itf@hbs@do
\let\hbs@do\itf@hbs@do
\itf@patch\pretocmd\hbs@process{%
   \itf@hbs@process{#1}%
   }%
   {\@PackageInfoNoLine{interfaces-hypbmsec}
      {\string\hbs@process\space successfully patched}}
   {\@PackageWarningNoLine{interfaces-hypbmsec}
      {Command \string\hbs@process\space could not be patched
      \MessageBreak loading of `interfaces-hypbmsec` aborted
      \MessageBreak \string\lastsection\space will not work}%
      \endinput}%
\long\def\itf@hbs@ssect#1#2{% starred section
   \itf@Not@titlesec#1
      {\expandafter\itf@hbs@last@starred\expandafter{\itf@hbs@currentname}{#2}}
      {\let\itf@hbs@last\itf@hbs@last@starred@ttl}% <expanded at \ttl@finmarks>
   #1*{#2}%
}% \itf@hbs@ssect
\long\def\itf@hbs@process#1{% not starred
   \itf@Not@titlesec \hbs@seccmd
      {%
      \ifdefined\hyper@anchor
         \expandafter\itf@hbs@last@nostar@nottl@Hy\expandafter{\itf@hbs@currentname}{#1}%
      \else
         \expandafter\itf@hbs@last@nostar@nottl\expandafter{\itf@hbs@currentname}{#1}%
      \fi
      }%
      {\let\itf@hbs@last \itf@hbs@last@nostar@ttl}% <expanded at \ttl@finmarks>
}% \itf@hbs@process
\long\def\itf@hbs@last@starred#1#2{% <expanded immediately>
   \GetTitleString{#2}\let\itf@hbs@currenttitle\GetTitleStringResult
   \begingroup
      \let\@elt \itf@resetlastsections
      \globaldefs \@ne
      \expandafter\let\csname last#1title\endcsname\itf@hbs@currenttitle
      \expandafter\let\csname last#1toc\endcsname\@empty
      \expandafter\let\csname last#1bookmark\endcsname\@empty
      \expandafter\let\csname last#1anchor\endcsname\relax
      \let\lastsectionname \itf@hbs@currentname
      \csname cl@#1\endcsname
   \endgroup
}% \itf@hbs@last@starred
\def\itf@hbs@last@starred@ttl{% <expanded at \ttl@finmarks>
   \global\let\itf@hbs@last \@empty
   \expandafter\itf@hbs@last@starred
      \expandafter\itf@hbs@currentname \expandafter{\ttl@savetitle}%
}% \itf@hbs@last@starred@ttl
\long\def\itf@hbs@last@nostar#1#2{%
   \GetTitleString{#2}\let\itf@hbs@currenttitle\GetTitleStringResult
   \begingroup
      \let\@elt \itf@resetlastsections
      \globaldefs \@ne
      \expandafter\let\csname last#1title\endcsname\itf@hbs@currenttitle
      \expandafter\let\csname last#1toc\expandafter\endcsname
         \csname \ifx\hbs@tocstring\relax
               itf@hbs@currenttitle\else hbs@tocstring\fi \endcsname
      \expandafter\let\csname last#1bookmark\expandafter\endcsname
         \csname \ifx\hbs@bmstring\relax
                           last#1toc\else hbs@bmstring\fi \endcsname
      \expandafter\let\csname last#1anchor\endcsname\HyperLocalCurrentHref
      \let\lastsectionname \itf@hbs@currentname
      \csname cl@#1\endcsname
   \endgroup
}% \itf@hbs@last@starred
\def\itf@hbs@last@nostar@ttl{% <expanded at \ttl@finmarks>
   \global\let\itf@hbs@last \@empty
   \expandafter\itf@hbs@last@nostar
         \expandafter\itf@hbs@currentname \expandafter{\ttl@savetitle}%
}% \itf@hbs@last@nostar@ttl
\long\def\itf@hbs@last@nostar@nottl#1#2{% <expanded at \cl@section>
   \expandafter\let\expandafter\itf@hbs@cl@ORI\csname cl@#1\endcsname
   \expandafter\def\csname cl@#1\endcsname{%
      \expandafter\let\csname cl@#1\endcsname\itf@hbs@cl@ORI
      \itf@hbs@cl@ORI
      \itf@hbs@last@nostar {#1}{#2}}%
}% \itf@hbs@last@nostar@nottl
\long\def\itf@hbs@last@nostar@nottl@Hy#1#2{% <expanded at \hyper@anchorend>
   \begingroup
   \toks@\expandafter{%
      \expandafter\def\expandafter\hyper@anchorend
                     \expandafter{\hyper@anchorend}%
      \itf@hbs@last@nostar{#1}{#2}}%
   \edef\x{\endgroup
      \def\noexpand\hyper@anchorend{\the\toks@}%
   }\x
}% \itf@hbs@last@nostar@nottl@Hy
\def\itf@Not@titlesec#1{\@firstoftwo}
\AfterPackage*{titlesec}{%
\def\itf@Not@titlesec#1{\begingroup
   \@onelevel@sanitize#1%
   \edef\@tempa{\noexpand\in@
      {\noexpand\@nil \string\ttl@}
      {\noexpand\@nil #1}%
   }\@tempa
   \expandafter\endgroup
   \ifin@ \expandafter\@secondoftwo
   \else  \expandafter\@firstoftwo
   \fi
}% \itf@Not@titlesec
}% AfterPackage titlesec
\AfterPackage*{titlesec}{%
\expandafter\def\expandafter\ttl@finmarks\expandafter{%
   \expandafter\itf@hbs@last \ttl@finmarks}%
\let\itf@hbs@last \@empty
}% AfterPackage
\def\itf@resetlastsections#1{%
   \expandafter\let\csname last#1title\endcsname\relax
   \expandafter\let\csname last#1toc\endcsname\relax
   \expandafter\let\csname last#1bookmark\endcsname\relax
   \expandafter\let\csname last#1anchor\endcsname\relax
   \csname cl@#1\endcsname
}% \itf@resetlastsections
\let\lastsectionname\relax
\@for\itf@tp:=part,section,subsection,subsubsection,paragraph,subparagraph%
  \do{\expandafter\let\csname last\itf@tp title\endcsname\relax
      \expandafter\let\csname last\itf@tp toc\endcsname\relax
      \expandafter\let\csname last\itf@tp bookmark\endcsname\relax
      \expandafter\let\csname last\itf@tp anchor\endcsname\relax
   }%
\AtBeginDocument{\ifundef\chapter{}
   {\let\lastchaptertitle\relax
    \let\lastchaptertoc\relax
    \let\lastchapterbookmark\relax
    \let\lastchapteranchor\relax}%
}%
\endinput
%%
%% End of file `interfaces-hypbmsec.sty'.