summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cybercic/cybercic.sty
blob: 3435f12bc468a7bc238f274d9bb011a6b4385bff (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
%%
%% This is file `cybercic.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% cybercic.dtx  (with options: `package')
%% --- BEGIN DISCLAIMER ---
%% Those who use this do so at their own risk;
%% AFSEO does not provide maintenance nor support.
%% --- END DISCLAIMER ---
%% --- BEGIN AFSEO_DATA_RIGHTS ---
%% This is a work of the U.S. Government and is placed
%% into the public domain in accordance with 17 USC Sec.
%% 105. Those who redistribute or derive from this work
%% are requested to include a reference to the original,
%% at <https://github.com/afseo/cmits>, for example by
%% including this notice in its entirety in derived works.
%% --- END AFSEO_DATA_RIGHTS ---
%% 
%% This is a generated file.
%% 
%% Copyright and distribution license not yet determined.
%% Made in 2012 by Jared Jennings <jared.jennings.ctr@us.af.mil> at the (U.S.) Air
%% Force SEEK EAGLE Office.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cybercic}
   [2015/06/24 Fixed packaging issues]
\makeatletter
\newif\ifCybercontrolsincontentsenabled
\Cybercontrolsincontentsenabledtrue
\newcommand \alphpart          {pt\Roman{part}}
\ifdefined\chapter
\newcommand \alphchapter       {\alphpart ch\Roman{chapter}}
\newcommand \alphsection       {\alphchapter se\Roman{section}}
\else
\newcommand \alphsection       {\alphpart se\Roman{section}}
\fi
\newcommand \alphsubsection    {\alphsection su\Roman{subsection}}
\newcommand \alphsubsubsection {\alphsubsection ss\Roman{subsubsection}}
\newcommand \alphparagraph     {\alphsubsubsection p\Roman{paragraph}}
\newcommand \alphsubparagraph  {\alphparagraph sp\Roman{subparagraph}}

\let\skia@orig@sect\@sect
\gdef\@sect#1#2#3#4#5#6[#7]#8{%
    \ifCybercontrolsincontentsenabled
    \ifnum #2>\c@tocdepth
      \skia@orig@sect{#1}{#2}{#3}{#4}{#5}{#6}[#7]{#8}
    \else
      \edef\last@division{#1\csname alph#1\endcsname}
      \edef\last@divtitle{\csname titleof\last@division \endcsname}
      \edef\last@divaddedto{\csname addedto\last@division \endcsname}
      \expandafter\def\last@divtitle{#7}
      \skia@orig@sect{#1}{#2}{#3}{#4}{#5}{#6}[\noexpand\csname titleof\last@division\endcsname]{#8}
    \fi
    \else
      \skia@orig@sect{#1}{#2}{#3}{#4}{#5}{#6}[#7]{#8}
    \fi}
\ifdefined\@chapter
\let\skia@orig@chapter\@chapter
\gdef\@chapter[#1]#2{%
    \ifCybercontrolsincontentsenabled
    \edef\last@division{chapter\alphchapter}
    \edef\last@divtitle{\csname titleof\last@division \endcsname}
    \edef\last@divaddedto{\csname addedto\last@division \endcsname}
    \expandafter\def\last@divtitle{#1}
    \skia@orig@chapter[\noexpand\csname titleof\last@division\endcsname]{#2}
    \else
    \skia@orig@chapter[#1]{#2}
    \fi}
\fi % defined @chapter
\@ifpackageloaded{hyperref}{%
    \gdef\addcontentsline#1#2#3{% toc extension, type, tag
      \begingroup
        \let\label\@gobble
        \let\textlatin\@firstofone
        \ifx\@currentHref\@empty
          \Hy@Warning{%
            No destination for bookmark of \string\addcontentsline,%
            \MessageBreak destination is added%
          }%
          \phantomsection
        \fi
        \expandafter\ifx\csname toclevel@#2\endcsname\relax
          \begingroup
            \def\Hy@tempa{#1}%
            \ifx\Hy@tempa\Hy@bookmarkstype
              \Hy@WarningNoLine{bookmark level for unknown #2 defaults to 0}%
            \else
              \Hy@Info{bookmark level for unknown #2 defaults to 0}%
            \fi
          \endgroup
          \expandafter\gdef\csname toclevel@#2\endcsname{0}%
        \fi
        \edef\Hy@toclevel{\csname toclevel@#2\endcsname}%
        \let\saved@numberline\numberline
        \ifHy@bookmarksnumbered
          \let\numberline\Hy@numberline
        \else
          \let\numberline\@gobble
        \fi
        \edef\Hy@expandedtag{#3}
        \let\numberline\saved@numberline
    \Hy@writebookmark{\csname the#2\endcsname}%
          {\Hy@expandedtag}%
          {\@currentHref}%
          {\Hy@toclevel}%
          {#1}%
        \ifHy@verbose
          \typeout{pdftex: bookmark at \the\inputlineno:
            {\csname the#2\endcsname}
            {\Hy@expandedtag}
            {\@currentHref}%
            {\Hy@toclevel}%
            {#1}%
          }%
        \fi
        \addtocontents{#1}{%
          \protect\contentsline{#2}{#3}{\thepage}{\@currentHref}%
        }%
      \endgroup
    }
}

\newcommand\su@ExpandTwoArgs[3]{%
  \protected@edef\su@SubString{#1}%
  \protected@edef\su@String{#2}%
  \expandafter\expandafter\expandafter#3%
  \expandafter\expandafter\expandafter{%
    \expandafter\su@SubString\expandafter
  }\expandafter{\su@String}%
}
\newcommand*\IfSubStringInString[2]{%
  \su@ExpandTwoArgs{#1}{#2}\su@IfSubStringInString
}
\newcommand*\su@IfSubStringInString[2]{%
  \def\su@compare##1#1##2\@nil{%
    \def\su@param{##2}%
    \ifx\su@param\@empty
      \expandafter\@secondoftwo
    \else
      \expandafter\@firstoftwo
    \fi
  }%
  \su@compare#2\@nnil#1\@nil
}
\def\addtosectionname#1{%
    \def\skia@yes{yes}
    \expandafter\ifx\last@divaddedto\skia@yes
      \IfSubStringInString{#1}{\last@divtitle}{}{%
        \expandafter\edef\last@divtitle{\last@divtitle , #1}%
      }
    \else
      \expandafter\edef\last@divtitle{\last@divtitle ---#1}
    \fi
    \expandafter\def\last@divaddedto{yes}}

\makeatother
\endinput
%%
%% End of file `cybercic.sty'.