-
Notifications
You must be signed in to change notification settings - Fork 3
/
mychd.sty
153 lines (145 loc) · 4.74 KB
/
mychd.sty
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
\ProvidesPackage{mychd}[2009/08/20 by you]
% 这里添加你的论文中专门使用的宏包
% 原先preamble中的\usepackage{...}用\RequirePackage{...}代替
% 算法以及列表环境'
\RequirePackage{enumitem}
\RequirePackage{cases,listings}
\RequirePackage{fancyvrb}
\RequirePackage[chapter]{algorithm}
\RequirePackage{algorithmic}
\RequirePackage{tikzpagenodes}
%% 输入各种 TeX names
\RequirePackage{xltxtra}
\newcounter{ListCounter}
% 调整罗列环境的布局
\setitemize{leftmargin=3em,itemsep=0em,partopsep=0em,parsep=0em,topsep=-0em}
\setenumerate{leftmargin=3em,itemsep=0em,partopsep=0em,parsep=0em,topsep=0em}
% 配置Lstlisting
\lstset{
columns=flexible,sensitive=true,lineskip=-3pt,
basicstyle=\small\ttfamily,
keywordstyle=\color{blue}\bfseries,
stringstyle=\ttfamily,
commentstyle=\color{red!50!green!50!blue!50},
numbers=left,numberstyle=\tiny,
xleftmargin=0.5em,xrightmargin=0.5em,aboveskip=0.5em,
showstringspaces=false,breaklines=true,extendedchars=true,escapeinside=``,
frame=shadowbox,rulesepcolor=\color{red!20!green!20!blue!20},
numberbychapter=false}
% 配置算法包
\algsetup{indent=3em}
\floatname{algorithm}{算法}
\renewcommand{\algorithmicrequire}{\textbf{已知:}}
\renewcommand{\algorithmicensure}{\textbf{求:}}
\DefineVerbatimEnvironment{code}{Verbatim}%
{frame=lines,framerule=0.5mm,rulecolor=\color{black},%
fontseries=tt,xleftmargin=4mm,numbers=left,numbersep=1.5mm}
% gobble=2,numbers=left,xleftmargin=5mm}
% 自定义其他命令
\newcommand{\mychd}{我的导言}
\newcommand{\ve}[1]{\ensuremath{\bm #1}}
%通栏公式命令,使用时用\leftsep和\rightsep将公式包含在其中
\newlength{\halfpagewidth}
\setlength{\halfpagewidth}{\linewidth}
\divide\halfpagewidth by 2
\newcommand{\leftsep}{%
\noindent\raisebox{4mm}[0ex][0ex]{%
\makebox[\halfpagewidth]{\hrulefill}\hbox{\vrule height 3pt}}%
\vspace*{-2mm}%
}
\newcommand{\rightsep}{%
\noindent\hspace*{\halfpagewidth}%
\rlap{\raisebox{-3pt}[0ex][0ex]{\hbox{\vrule height 3pt}}}%
\makebox[\halfpagewidth]{\hrulefill}%
}
\newenvironment
%自定义列表环境,修正原\item行距过大
{myList}
{\begin{list}
{(\arabic{ListCounter})}%\arabic,\roman,\Roman,\alph,and\Alph
{\usecounter{ListCounter}
\setlength{\rightmargin}{0cm}
\setlength{\itemsep}{0cm}
\setlength{\parsep}{0cm}
\setlength{\parskip}{0cm}
\setlength{\topsep}{0cm}
\setlength{\leftmargin}{1.7cm}}}
{\end{list}}
%自定义bibList列表环境
\newenvironment
{bibList}
{\begin{list}
{[\arabic{ListCounter}]}%\arabic,\roman,\Roman,\alph,and\Alph
{\usecounter{ListCounter}
\setlength{\rightmargin}{0cm}
\setlength{\itemsep}{0cm}
\setlength{\parsep}{0cm}
\setlength{\parskip}{0cm}
\setlength{\topsep}{0cm}
\setlength{\leftmargin}{1cm}}}
{\end{list}}
%自定义偏导符号
\font\ursymbol=psyr at 10pt % 可以改为其他字体大小
\def\urpartial{\mbox{\ursymbol\char"B6}}
%自定义计数器
\newcounter{shuzi}
\usecounter{shuzi}
\setcounter{shuzi}{1}
%newcommand{Luolie{}}
% tabularx 中的 Z 环境,居中自动调整
\newcolumntype{Z}{>{\centering\arraybackslash}X}
% 0. 符号表
\RequirePackage[intoc,norefeq,refpage]{nomencl}
\renewcommand{\nomname}{重要符号表}
\renewcommand{\nomgroup}[1]{}%
\renewcommand\figureautorefname{图}
% 1. 定制nom条目
\def\pagedeclaration#1{\nobreakspace#1}%
\def\@@nomenclature[#1]#2#3#4{\endgroup\@esphack}
\def\@@@nomenclature[#1]#2#3#4{%
\def\@tempa{#2}\def\@tempb{#3}%
\protected@write\@nomenclaturefile{}%
{\string\nomenclatureentry{#1\nom@verb\@tempa @{\nom@verb\@tempa}&%
\begingroup\nom@verb\@tempb\endgroup &\begingroup#4\endgroup&%
\begingroup\protect%
|nompageref}{\thepage}}%
\endgroup%
\@esphack}
% 2. 定制nom表格
\def\thenomenclature{%
\@ifundefined{chapter}%
{
\section*{\nomname}
\if@intoc\addcontentsline{toc}{section}{\nomname}\fi%
}%
{
\chapter*{\nomname}
\if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi%
}%
\nompreamble%
\begin{longtable}[c]{@{}lp{23em}ll@{}}%
{\hei 符~号} & {\hei 定~义} & {\hei 单~位} & {\hei 页~码} \\
}
\def\endthenomenclature{%
\end{longtable}%
\nompostamble%
}
\newcommand{\Matlab}{\textsc{Matlab}}
%定义名言引用
\newcommand\zuozhe[1]{\begin{flushright}\pozhehao{\hei #1}\end{flushright}}
\newcommand\mingyan[2]{\hspace{2em}\begin{minipage}[t]{0.8\textwidth}#1\vspace{0.1ex}\zuozhe{#2}\end{minipage}\vspace{3mm}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%任务书加边框%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\myoverlay}{\tikz[remember picture,overlay]{%
\draw[black]
(current page text area.south west)
rectangle
(current page text area.north east)
;
}}
\newcommand{\myhline}{\noindent\underline{\hspace{\textwidth}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%自定义颜色
\definecolor{myellow}{RGB}{149,106,28}
\definecolor{mblue}{RGB}{1,9,72}
\endinput