format.tex

来自「latex数学文档编辑手册。。 。。 。。。」· TEX 代码 · 共 455 行 · 第 1/2 页

TEX
455
字号
\fancyfoot{}                                    % clear all footer fields
\fancyfoot[CE,CO]{\thepage}
}
\fi%--------------------------------------------%

%=== 配合前面的ntheorem宏包产生各种定理结构,重定义一些正文相关标题 ===%
\theoremstyle{plain}
\theoremheaderfont{\normalfont\rmfamily\CJKfamily{hei}}
\theorembodyfont{\normalfont\rm\CJKfamily{song}} \theoremindent0em
\theoremseparator{\hspace{1em}} \theoremnumbering{arabic}
%\theoremsymbol{}          %定理结束时自动添加的标志
\newtheorem{definition}{\hspace{2em}定义}[chapter]
%\newtheorem{definition}{\hei 定义}[section] %!!!注意当section为中国数字时,[sction]不可用!
\newtheorem{proposition}{\hspace{2em}命题}[chapter]
\newtheorem{property}{\hspace{2em}性质}[chapter]
\newtheorem{lemma}{\hspace{2em}引理}[chapter]
%\newtheorem{lemma}[definition]{引理}
\newtheorem{theorem}{\hspace{2em}定理}[chapter]
\newtheorem{axiom}{\hspace{2em}公理}[chapter]
\newtheorem{corollary}{\hspace{2em}推论}[chapter]
\newtheorem{exercise}{\hspace{2em}习题}[chapter]
\theoremsymbol{$\blacksquare$}
\newtheorem{example}{\hspace{2em}例}[chapter]

\theoremstyle{nonumberplain}
\theoremheaderfont{\CJKfamily{hei}\rmfamily}
\theorembodyfont{\normalfont \rm \CJKfamily{song}}
\theoremindent0em \theoremseparator{\hspace{1em}}
\theoremsymbol{$\blacksquare$}
\newtheorem{proof}{\hspace{2em}证明}

%=========================== 修改引用的格式 ==============================%
% 第一行在引用处数字两边加方框
% 第二行去除参考文献里数字两边的方框
%\makeatletter
%\def\@cite#1{\mbox{$\m@th^{\hbox{\@ove@rcfont[#1]}}$}}
%\renewcommand\@biblabel[1]{#1}
%\makeatother
% 增加 \upcite 命令使显示的引用为上标形式
%\newcommand{\upcite}[1]{$^{\mbox{\scriptsize \cite{#1}}}$}             % 方法1
\newcommand{\upcite}[1]{\textsuperscript{\textsuperscript{\cite{#1}}}}  % 方法2


%=============================== 脚注 =============================%
\renewcommand{\thefootnote}{\arabic{footnote}}
%detcounter{footnote}{0}

%==================== 定义题头格言的格式 ==========================%
% 用法 \begin{Aphorism}{author}
%         aphorism
%      \end{Aphorism}
\newsavebox{\AphorismAuthor}
\newenvironment{Aphorism}[1]
{\vspace{0.5cm}\begin{sloppypar} \slshape
\sbox{\AphorismAuthor}{#1}
\begin{quote}\small\itshape }
{\\ \hspace*{\fill}------\hspace{0.2cm} \usebox{\AphorismAuthor}
\end{quote}
\end{sloppypar}\vspace{0.5cm}}

%============================== 控制表格线宽 ==========================%
% 更改横线(\hline)线宽:定义如下命令\hlinewd代替\hline。
% 更改垂直线(\vline)线宽:使用\usapackage{array},则可以在指定垂直线的地方用
% “!{\vrule width 3.5pt}”代替“|”,如“|c!{\vrule width 5pt}p{5cm}|r|”

\makeatletter
\def\hlinewd#1{%
  \noalign{\ifnum0=`}\fi\hrule \@height #1 \futurelet
   \reserved@a\@xhline}
\makeatother
\newcommand\vlinewd[1][1pt]{\vrule width #1}

% 不过上面的命令\hlinewd不能与longtable正常工作(reported by %钟圣俊老师),
% 只能使用下面的方法实现线宽控制:
%
%\setlength{\arrayrulewidth}{0.5pt}
%\setlength{\doublerulesep}{\arrayrulewidth}
%\newcommand{\dhline}{\hline\hline}
%\newcommand{\thline}{\hline\hline\hline}
%(类似的可以定义更多不同宽度的\hline)


%========================== 其它自定义 ==============================%
%====================================================================%
% 下面定义的命令(\alpheqn \reseteqn)可以使公式编号变为 4-a,4-b
% 使用说明:\alpheqn 为开始产生处,\reseteqn为恢复原来公式编号形式处
% 这两个命令为自定义,使用时应注意:不可放于 数学环境中!!!
% 在公式开始前和结束后使用!!!
%====================================================================%
\newcounter{saveeqn}%

\newcommand{\alpheqn}{%
\setcounter{saveeqn}{\value{equation}}%
\stepcounter{saveeqn}%
\setcounter{equation}{0}%
%\renewcommand{\theequation}{\arabic{saveeqn}-\alph{equation}}}%%article 中的定义
\renewcommand{\theequation}{\arabic{chapter}-\arabic{saveeqn}\alph{equation}}}%book %中的定义
%{\mbox{\arabic{equation}-\alph{equation}}}}%

\newcommand{\reseteqn}{%
\setcounter{equation}{\value{saveeqn}}%
%%\renewcommand{\theequation}{\arabic{equation}}}    %article 中的定义
\renewcommand{\theequation}{\arabic{chapter}-\arabic{equation}}}  %book 中的定义

%====================================================================%
% 下面定义的命令(\alphfig \resetfig)可以使插图编号变为 4-a,4-b
% 使用说明:\alphfig 为开始产生处,\resetfig为恢复原来插图编号形式处
% 这两个命令为自定义,使用时应注意:不可放于 数学环境中!!!
% 在插图开始前和结束后使用!!!
%====================================================================%
\newcounter{savefig}%

\newcommand{\alphfig}{%
\setcounter{savefig}{\value{figure}}%
\stepcounter{savefig}%
\setcounter{figure}{0}%
%%\renewcommand{\thefigure}{\arabic{savefig}-\alph{figure}}}%%article 中的定义
\renewcommand{\thefigure}{\arabic{chapter}-\arabic{savefig}\alph{figure}}}%book 中的定义
%{\mbox{\arabic{figure}-\alph{figure}}}}%

\newcommand{\resetfig}{%
\setcounter{figure}{\value{savefig}}%
%%\renewcommand{\thefigure}{\arabic{figure}}}    %article 中的定义
\renewcommand{\thefigure}{\arabic{chapter}-\arabic{figure}}}  %book 中的定义

%====================================================================%
% 下面定义的命令(\alphtab \resettab)可以使表格编号变为 4-a,4-b
% 使用说明:\alphtab 为开始产生处,\resettab为恢复原来表格编号形式处
% 这两个命令为自定义,使用时应注意:不可放于 数学环境中!!!
% 在表格开始前和结束后使用!!!
%====================================================================%
\newcounter{savetab}%

\newcommand{\alphtab}{%
\setcounter{savetab}{\value{table}}%
\stepcounter{savetab}%
\setcounter{table}{0}%
%%\renewcommand{\thetable}{\arabic{savetab}-\alph{table}}}%%article 中的定义
\renewcommand{\thetable}{\arabic{chapter}-\arabic{savetab}\alph{table}}}%%book 中的定义
%{\mbox{\arabic{table}-\alph{table}}}}%

\newcommand{\resettab}{%
\setcounter{table}{\value{savetab}}%
%%\renewcommand{\thetable}{\arabic{table}}}    %article 中的定义
\renewcommand{\thetable}{\arabic{chapter}-\arabic{table}}}  %book 中的定义

%====================================================================%
% 自定义项目列表标签及格式 \begin{mylist} 列表项 \end{mylist}
%====================================================================%
\newcounter{newlist} %自定义新计数器
\newenvironment{mylist}[1][可改变的列表题目]{%%%%%定义新环境
\begin{list}{\textbf{\hei #1} \arabic{newlist}:} %%标签格式
    {
    \usecounter{newlist}
     \setlength{\labelwidth}{22pt} %标签盒子宽度
     \setlength{\labelsep}{0cm} %标签与列表文本距离
     \setlength{\leftmargin}{0cm} %左右边界
     \setlength{\rightmargin}{0cm}
     \setlength{\parsep}{0.5ex plus0.2ex minus0.1ex} %段落间距
     \setlength{\itemsep}{0ex plus0.2ex} %标签间距
     \setlength{\itemindent}{44pt} %标签缩进量
     \setlength{\listparindent}{22pt} %段落缩进量
    }}
{\end{list}}%%%%%
%=================================源代码设置===============================%
\renewcommand{\lstlistlistingname}{源代码目录}
\renewcommand{\lstlistingname}{源代码}
%\lstlistoflistings
\lstset{language=Matlab}
\lstset{xleftmargin=1em,xrightmargin=1em}
%\lstset{frame=TBLR} %双线方框
\lstset{frame=tblr}  %单线方框
%\lstset{commentstyle=\color{blue},keywordstyle=\color{red},caption=\lstname,breaklines=true,columns=flexible,mathescape=true}
\lstset{caption=\lstname,breaklines=true,columns=flexible,mathescape=true}
%\lstset{framexleftmargin=2em,framexrightmargin=1em,framextopmargin=1em,framexbottommargin=1em}
\lstset{framexleftmargin=1em,framexrightmargin=1em,framextopmargin=0.3em,framexbottommargin=0.3em}
\lstdefinestyle{numbers}{numbers=left,stepnumber=1,numberstyle=\small,numbersep=1em}

%============================定制目录格式===================================%
%注意:1pc=12pt
%\contentsmargin{2.55em}
\titlecontents{chapter}[0em]{\sihao \hei}
{\contentslabel{0em}}{\hspace*{0em}}
{\dotfill \contentspage}

\titlecontents{section}[4.7pc]{}
{\contentslabel{2.8pc}}{\hspace*{-2.8pc}}
{\dotfill \contentspage}

\titlecontents{subsection}[7.5pc]{} % note that 3.8 = 1.5 + 2.3
{\contentslabel{2.9pc}}{\hspace*{3.2pc}}
{\dotfill \contentspage}
%{\titlerule*[0.6pc]{.}\contentspage}

%%=================以下内容为改变参考文献条目间距的代码====================%%
%%%Thanks for gongxiaohua
%\makeatletter
%\renewenvironment{thebibliography}[1]
%    {\section*{\refname
%%org        \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
%       \@mkboth{\refname}{\refname}}%                                  !!!
%%%%%%list环境
%     \list{\@biblabel{\@arabic\c@enumiv}}%
%          {\settowidth\labelwidth{\@biblabel{#1}}%
%           \leftmargin\labelwidth
%           \advance\leftmargin\labelsep
%%%%%%环境的要素:改变\itemsep后的数字,可以改变参考文献条目的间距
%%\itemsep\z@\topsep\z@\partopsep\z@\parskip\z@
%\itemsep-4pt\topsep\z@\partopsep\z@\parskip\z@
%%%%%%%
%           \@openbib@code
%           \usecounter{enumiv}%
%           \let\p@enumiv\@empty
%           \renewcommand\theenumiv{\@arabic\c@enumiv}}%
%     \sloppy
%%%%%%%文字的尺寸和间距只有\small 的要素
%     \small%                                                    !!!
%     \clubpenalty4000
%     \@clubpenalty \clubpenalty
%     \widowpenalty4000%
%     \sfcode`\.\@m}
%    {\def\@noitemerr
%      {\@latex@warning{Empty `thebibliography' environment}}%
%     \endlist}
%\makeatother
%%=================以上内容为改变参考文献条目间距的代码====================%%

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?