summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/simurgh/simurgh-doc.cls
blob: 934204bf4a8a53a3a0807586f4b34b5cef461e3c (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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{simurgh-doc}
         [2013/09/18 v0.01a simurgh documentation class]
\DeclareOption*{%
    \PassOptionsToClass  {\CurrentOption}{ltxdoc}}
\ProcessOptions
\LoadClass{ltxdoc}
\RequirePackage{xcolor}
\RequirePackage{minted}
\RequirePackage{graphicx}
\RequirePackage{fontspec}
\RequirePackage[pdfborder={0 0 0},bookmarksnumbered]{hyperref}
\RequirePackage[left=4cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
\RequirePackage{makeidx}
\RequirePackage{microtype}

\def\simurgh{\textsc{simurgh}}

\newbox\simurghlogobox
\sbox\simurghlogobox{\includegraphics[height=0.5in,keepaspectratio=true]{simurgh-logo}}

\def\ps@docheadings{%
      \let\@oddhead\@empty
      \def\@oddfoot{\parbox{\textwidth}{\hfill\raisebox{0.2in}{\leftmark}\quad\raisebox{0.2in}{\thepage}\qquad\usebox\simurghlogobox}}%
      \let\@mkboth\markboth
    \def\sectionmark##1{%
      \markboth {%
        ##1}{}}}
        
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries\color{red!65!black}}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries\color{red!65!black}}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries\color{red!65!black}}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries\color{red!65!black}}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1em}%
                                      {\normalfont\normalsize\bfseries\color{red!65!black}}}        
                                      
                                      
\def\@undottedtocline#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#4}\nobreak
        \hfill
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
     \par}%
  \fi}
\renewcommand*\l@subsection{\@undottedtocline{2}{\z@}{2.3em}}
\renewcommand*\l@subsubsection{\@undottedtocline{3}{\z@}{3.2em}}
\renewcommand*\l@paragraph{\@undottedtocline{4}{\z@}{4.1em}}
\renewcommand*\l@subparagraph{\@undottedtocline{5}{\z@}{5em}}
\renewcommand*\l@figure{\@undottedtocline{1}{\z@}{2.3em}}
\let\l@table\l@figure

\renewcommand\tableofcontents{%
    \section*{\contentsname
        \@mkboth{%
           \contentsname}{\contentsname}}%
    \@starttoc{toc}%
    }

\providecommand\href[2]{\texttt{#1}}

\colorlet{examplefill}{yellow!80!black}
\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8}
\definecolor{codebackground}{rgb}{0.8,0.8,1}

\newcommand{\smplfile}[1]{\par\smallskip\noindent\llap{\color{blue!65!black}\vtop to0pt{\llap{\textbf{\textsc{sample}}}\vskip-3pt\llap{\texttt{#1}}\vss}\ \ }}
\newcommand{\defaultkeyval}{\llap{\color{orange!85!black}\textbf{\textsc{default}}\hskip\leftmargin}}

\newenvironment{simurghmanualentry}{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}}{\endlist}
\newcommand\simurghmanualentryheadline[1]{\itemsep=0pt\parskip=0pt\item\strut#1\par\topsep=0pt}
\newcommand\simurghmanualbody{\parskip3pt}

\newenvironment{command}[1]{
  \begin{simurghmanualentry}
    \extractcommand#1\@@
    \simurghmanualbody
}
{
  \end{simurghmanualentry}
}

\def\extractcommand#1#2\@@{%
  \simurghmanualentryheadline{\declare{\texttt{\string#1}}#2}%
  \removeats{#1}%
  \index{\strippedat @\protect\myprintocmmand{\strippedat}}}


\renewenvironment{environment}[1]{
  \begin{simurghmanualentry}
    \extractenvironement#1\@@
    \simurghmanualbody
}
{
  \end{simurghmanualentry}
}

\def\extractenvironement#1#2\@@{%
  \simurghmanualentryheadline{{\ttfamily\char`\\begin\char`\{\declare{#1}\char`\}}#2}%
  \simurghmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
  \simurghmanualentryheadline{{\ttfamily\char`\\end\char`\{\declare{#1}\char`\}}}%
  \index{#1@\protect\texttt{#1} environment}%
  \index{Environments!#1@\protect\texttt{#1}}}
  
\newenvironment{package}[1]{
  \begin{simurghmanualentry}
    \simurghmanualentryheadline{{\ttfamily\char`\\usepackage\opt{[\meta{options}]}\char`\{\declare{#1}\char`\}}}
    \index{#1@\protect\texttt{#1} package}%
    \index{Packages and files!#1@\protect\texttt{#1}}%
    \simurghmanualbody
}
{
  \end{simurghmanualentry}
}



\newenvironment{filedescription}[1]{
  \begin{simurghmanualentry}
    \simurghmanualentryheadline{File {\ttfamily\declare{#1}}}%
    \index{#1@\protect\texttt{#1} file}%
    \index{Packages and files!#1@\protect\texttt{#1}}%
    \simurghmanualbody
}
{
  \end{simurghmanualentry}
}


\newenvironment{packageoption}[1]{
  \begin{simurghmanualentry}
    \simurghmanualentryheadline{{\ttfamily\char`\\usepackage[\declare{#1}]\char`\{simurgh\char`\}}}
    \index{#1@\protect\texttt{#1} package option}%
    \index{Package options for \textsc{simurgh}!#1@\protect\texttt{#1}}%
    \simurghmanualbody
}
{
  \end{simurghmanualentry}
}



\newcommand\opt[1]{{\color{black!50!green}#1}}
\newcommand\ooarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}

\let\oarg\simurgh@undefined
\providecommand\oarg[1]{%
  {\color{black!50!green}{\ttfamily[}\meta{#1}{\ttfamily]}}}
  



\def\opt{\afterassignment\simurghmanualopt\let\next=}
\def\simurghmanualopt{\ifx\next\bgroup\bgroup\color{black!50!green}\else{\color{black!50!green}\next}\fi}




\def\pdf{\textsc{pdf}}


{
  \makeatletter
  \global\let\myempty=\@empty
  \global\let\mygobble=\@gobble
  \makeatother
  \gdef\getridofats#1@#2\relax{%
    \def\getridtest{#2}%
    \ifx\getridtest\myempty%
      \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1}
    \else%
      \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1\protect\printanat}
      \getridofats#2\relax%
    \fi%
  }

  \gdef\removeats#1{%
    \let\strippedat\myempty%
    \edef\strippedtext{\stripcommand#1}%
    \expandafter\getridofats\strippedtext @\relax%
  }
  
  \gdef\stripcommand#1{\expandafter\mygobble\string#1}
}

\def\printanat{\char`\@}

\def\declare{\afterassignment\simurghmanualdeclare\let\next=}
\def\simurghmanualdeclare{\ifx\next\bgroup\bgroup\color{red!75!black}\else{\color{red!75!black}\next}\fi}

\def\example{\par\smallskip\noindent\textit{Example: }}

\def\itemoption#1{\item \declare{\texttt{#1}}%
  \indexoption{#1}%
}

\def\indexoption#1{%
  \index{#1@\protect\texttt{#1} option}%
  \index{Options!#1@\protect\texttt{#1}}%
}

\let\textoken=\command
\let\endtextoken=\endcommand

\def\myprintocmmand#1{\texttt{\char`\\#1}}


\def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index}}
\c@IndexColumns=2
  \def\theindex{\@restonecoltrue
    \columnseprule \z@  \columnsep 35\p@
    \twocolumn[\index@prologue]%
     \@mkboth{\indexname}%
                     {\indexname}%
       \parindent -30pt
       \columnsep 15pt
       \parskip 0pt plus 1pt
       \leftskip 30pt
       \rightskip 0pt plus 2cm
       \small
       \def\@idxitem{\par}%
    \let\item\@idxitem \ignorespaces}
  \def\endtheindex{\onecolumn}
\def\noindexing{\let\index=\@gobble}
  

\endinput