Debian Codegraph @

texmf-dist/doc/latex/thucoursework/dtx-style.sty

raw
1 %%
2 %% This is file `dtx-style.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% thucoursework.dtx (with options: `dtx-style')
8 %%
9 %% This is a generated file.
10 %%
11 %% Copyright (C) 2020 by zhaofeng-shu33 <[email protected]>
12 %%
13 %% This work may be distributed and/or modified under the
14 %% conditions of the LaTeX Project Public License, either version 1.3
15 %% of this license or (at your option) any later version.
16 %% The latest version of this license is in
17 %% http://www.latex-project.org/lppl.txt
18 %% and version 1.3 or later is part of all distributions of LaTeX
19 %% version 2005/12/01 or later.
20 %%
21 %% To produce the documentation run the original source files ending with `.dtx'
22 %% through LaTeX.
23 %%
24
25 \ProvidesPackage{dtx-style}
26 \RequirePackage{hypdoc}
27 \RequirePackage[UTF8,scheme=chinese]{ctex}
28 \RequirePackage{newpxtext}
29 \RequirePackage{newpxmath}
30 \RequirePackage[
31 top=2.5cm, bottom=2.5cm,
32 left=4cm, right=2cm,
33 headsep=3mm]{geometry}
34 \RequirePackage{array,longtable,booktabs}
35 \RequirePackage{listings}
36 \RequirePackage{fancyhdr}
37 \RequirePackage{xcolor}
38 \RequirePackage{enumitem}
39 \RequirePackage{etoolbox}
40 \RequirePackage{metalogo}
41
42 \colorlet{thu@macro}{blue!60!black}
43 \colorlet{thu@env}{blue!70!black}
44 \colorlet{thu@option}{purple}
45 \patchcmd{\PrintMacroName}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{}
46 \patchcmd{\PrintDescribeMacro}{\MacroFont}{\MacroFont\bfseries\color{thu@macro}}{}{}
47 \patchcmd{\PrintDescribeEnv}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{}
48 \patchcmd{\PrintEnvName}{\MacroFont}{\MacroFont\bfseries\color{thu@env}}{}{}
49
50 \def\DescribeOption{%
51 \leavevmode\@bsphack\begingroup\MakePrivateLetters%
52 \Describe@Option}
53 \def\Describe@Option#1{\endgroup
54 \marginpar{\raggedleft\PrintDescribeOption{#1}}%
55 \thu@special@index{option}{#1}\@esphack\ignorespaces}
56 \def\PrintDescribeOption#1{\strut \MacroFont\bfseries\sffamily\color{thu@option} #1\ }
57 \def\thu@special@index#1#2{\@bsphack
58 \begingroup
59 \HD@target
60 \let\HDorg@encapchar\encapchar
61 \edef\encapchar usage{%
62 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
63 }%
64 \index{#2\actualchar{\string\ttfamily\space#2}
65 (#1)\encapchar usage}%
66 \index{#1:\levelchar#2\actualchar
67 {\string\ttfamily\space#2}\encapchar usage}%
68 \endgroup
69 \@esphack}
70
71 \lstdefinestyle{lstStyleBase}{%
72 basicstyle=\small\ttfamily,
73 aboveskip=\medskipamount,
74 belowskip=\medskipamount,
75 lineskip=0pt,
76 boxpos=c,
77 showlines=false,
78 extendedchars=true,
79 upquote=true,
80 tabsize=2,
81 showtabs=false,
82 showspaces=false,
83 showstringspaces=false,
84 numbers=none,
85 linewidth=\linewidth,
86 xleftmargin=4pt,
87 xrightmargin=0pt,
88 resetmargins=false,
89 breaklines=true,
90 breakatwhitespace=false,
91 breakindent=0pt,
92 breakautoindent=true,
93 columns=flexible,
94 keepspaces=true,
95 gobble=2,
96 framesep=3pt,
97 rulesep=1pt,
98 framerule=1pt,
99 backgroundcolor=\color{gray!5},
100 stringstyle=\color{green!40!black!100},
101 keywordstyle=\bfseries\color{blue!50!black},
102 commentstyle=\slshape\color{black!60}}
103
104 \lstdefinestyle{lstStyleShell}{%
105 style=lstStyleBase,
106 frame=l,
107 rulecolor=\color{purple},
108 language=bash}
109
110 \lstdefinestyle{lstStyleLaTeX}{%
111 style=lstStyleBase,
112 frame=l,
113 rulecolor=\color{violet},
114 language=[LaTeX]TeX}
115
116 \lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{}
117 \lstnewenvironment{shell}{\lstset{style=lstStyleShell}}{}
118
119 \setlist{nosep}
120
121 \DeclareDocumentCommand{\option}{m}{\textsf{#1}}
122 \DeclareDocumentCommand{\env}{m}{\texttt{#1}}
123 \DeclareDocumentCommand{\pkg}{s m}{%
124 \texttt{#2}\IfBooleanF#1{\thu@special@index{package}{#2}}}
125 \DeclareDocumentCommand{\file}{s m}{%
126 \texttt{#2}\IfBooleanF#1{\thu@special@index{file}{#2}}}
127 \newcommand{\myentry}[1]{%
128 \marginpar{\raggedleft\color{purple}\bfseries\strut #1}}
129 \newcommand{\note}[2][Note]{{%
130 \color{magenta}{\bfseries #1}\emph{#2}}}
131
132 \def\thucoursework{\textsc{Thu}\-\textsc{Coursework}}