format.tex

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

TEX
455
字号
%=========================================================================%
%   LaTeX File for Ph.D thesis of Ncepubj University
%-------------------------------------------------------------------------%
%   Copyright 2002-2005  by  Wu Ying nian    (hdwyn@sohu.com)
%=========================================================================%

%=========================================================================%
%                          主文档 格式定义
%=========================================================================%

%============================ 自定义文字块 ================================%
\newcommand{\aaa}{这是科技文稿排版测试这是科技文稿排版测试}
\newcommand{\bbb}{\aaa \aaa \aaa

 \aaa \aaa \aaa }
\newcommand{\ccc}{\bbb \bbb \bbb \bbb \bbb

 \bbb \bbb \bbb \bbb \bbb }
\newcommand{\abc}{abcdefg1234567890}
\newcommand{\upabc}{ABCDEFG}

\newcommand{\cnbf}[1]{\CJKfamily{hei}#1\CJKfamily{}}

%===================== 重定义字体、字号命令 =============================%
% 注意win2000,没有 simsun, 最好到网上找一个。一些字体是office2000带的
\newcommand{\song}{\CJKfamily{song}}    % 宋体   (Windows自带simsun.ttf)
\newcommand{\fs}{\CJKfamily{fs}}        % 仿宋体 (Windows自带simfs.ttf)
\newcommand{\kai}{\CJKfamily{kai}}      % 楷体   (Windows自带simkai.ttf)
\newcommand{\hei}{\CJKfamily{hei}}      % 黑体   (Windows自带simhei.ttf)
\newcommand{\li}{\CJKfamily{li}}        % 隶书   (Windows自带simli.ttf)
\newcommand{\you}{\CJKfamily{you}}      % 幼圆   (Windows自带simyou.ttf)
\newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont}     % 字号设置
\newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont} % 字号设置
\newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont}      % 字号设置
\newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont}      % 字号设置
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}  % 字号设置
\newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont}  % 字号设置
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}      % 字号设置
%\newcommand{\xiaosihao}{\fontsize{12pt}{20pt}\selectfont}  % 字号设置
\newcommand{\xiaosihao}{\fontsize{12pt}{14pt}\selectfont}  % 字号设置
\newcommand{\wuhao}{\fontsize{10.5pt}{12.6pt}\selectfont}    % 字号设置
\newcommand{\xiaowuhao}{\fontsize{9pt}{11pt}{\baselineskip}\selectfont}   % 字号设置
\newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont}  % 字号设置
\newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}    % 字号设置

%===================================================================%
%                         各种距离与缩进
%===================================================================%

%-------------------- 用于中文段落缩进 和正文版式 ------------------%
\CJKcaption{GB_aloft14q}
\setlength{\parindent}{2em}                 % 首行两个汉字的缩进量
\setlength{\parskip}{3pt plus1pt minus1pt}  % 段落之间的竖直距离
\renewcommand{\baselinestretch}{1.2}        % 定义行距

%------------------------- 列表与图表距离设置 -----------------------%
\setlength{\topsep}{3pt plus1pt minus2pt}           % 第一个item和前面版落间的距离
\setlength{\partopsep}{3pt plus1pt minus2pt}        % 当在一个新页开始时加到
                                                    % \topsep的额外空间
\setlength{\itemsep}{3pt plus1pt minus2pt}          % 连续items之间的距离.
\setlength{\floatsep}{10pt plus 3pt minus 2pt}      % 图形之间或图形与正文之间的距离
\setlength{\abovecaptionskip}{2pt plus1pt minus1pt} % 图形中的图与标题之间的距离
\setlength{\belowcaptionskip}{3pt plus1pt minus2pt} % 表格中的表与标题之间的距离

%下面这组命令使浮动对象的缺省值稍微宽松一点,从而防止幅度
%对象占据过多的文本页面,也可以防止在很大空白的浮动页上放置
%很小的图形。
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}

%---------------------------- 数学公式设置 ------------------------------%
\setlength{\abovedisplayskip}{2pt plus1pt minus1pt}     %公式前的距离
\setlength{\belowdisplayskip}{6pt plus1pt minus1pt}     %公式后面的距离
\setlength{\arraycolsep}{2pt}   %在一个array中列之间的空白长度, 因为原来的太宽了

\allowdisplaybreaks[4]  % \eqnarray如果很长,影响分栏、换行和分页
                        %(整块挪动,造成页面空白),可以设置成为自动调整模式

\renewcommand{\mathbf}[1]{\boldsymbol{#1}}  %重新定义 \mathbold 为矢量黑斜体
                                            %用Mathtype生成的公式源码直接应用于程序中
                                            %(导出时请选择 TeX-AMS-LaTeX )

\newcommand{\me}{\mathrm{e}}  %定义 对数常数e,虚数符号i,j以及微分算子d为直立体。
\newcommand{\mi}{\mathrm{i}}
\newcommand{\mj}{\mathrm{j}}
\newcommand{\dif}{\mathrm{d}}

%===================================================================%
%                         各种标题样式
%===================================================================%
%======================= 标题名称中文化 ============================%
\renewcommand\contentsname{目\ \ 录}
\renewcommand\listfigurename{插\ 图\ 目\ 录}
\renewcommand\listtablename{表\ 格\ 目\ 录}
%\renewcommand\abstractname{摘\ 要} %err undefined
%\renewcommand\refname{参考文献}         %article类型
\renewcommand\bibname{参\ 考\ 文\ 献}    %book类型
\renewcommand\indexname{索\ 引}
\renewcommand\figurename{图}
\renewcommand\tablename{表}
\renewcommand\partname{第\CJKnumber{\value{part}}部分}
\renewcommand\chaptername{第\CJKnumber{\value{chapter}}章}

%======================= 定制章节的标题样式 =============================%
\setcounter{secnumdepth}{3}
%---------------------- 定义章节的编号格式 --------------------------%
%\renewcommand{\thesection}{\CJKnumber{\arabic{section}}、} % 定义 一、。九、十
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\renewcommand{\thesubsection}{\arabic{chapter}.\arabic{section}.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\arabic{subsubsection}.}
\let\oldtitle=\title
\def\title#1{\oldtitle{\cnbf{#1}}}

\CJKtilde   %用于解决英文字母和汉字的间距问题。例如:变量~$x$~的值。
            %这个命令重新定义~。等价于 \def~{\hspace{0.25em plus 0.125em minus 0.08em}}
            %若想恢复~,则用命令 \standardtilde 。

\renewcommand{\CJKglue}{\hskip 0pt plus 0.08\baselineskip}
%\CJKglue   %这个命令原始定义为
            %newcommand{\CJKglue}{\hskip 0pt plus 0.08\baselineskip}
            %它于必要时在汉字之间插入一个附加的空隙,以解决行的超长问题。
            %可以修改此命令,增加它的值,以加强其调节能力。
            %注意,使用这个命令可能导致出现空白页!!!

%----------------------- 定义章节标题格式 ----------------------------%
\titleformat{\chapter}[hang]{\normalfont\xiaoerhao \filcenter\CJKfamily{hei}}
    {\xiaoerhao {\chaptertitlename}}{20pt}{\xiaoerhao}
\titlespacing{\chapter}{0pt}{-3ex  plus .1ex minus .2ex}{2.5ex plus .1ex minus .2ex}

%\titleformat{\chapter}[hang]{\normalfont\huge\filcenter\CJKfamily{hei}}
%    {\huge{\chaptertitlename}}{20pt}{\huge}
%\titlespacing{\chapter}{0pt}{-3ex  plus .1ex minus .2ex}{2.5ex plus .1ex minus .2ex}

\titleformat{\section}[hang]{\CJKfamily{hei}\sihao}
    {\sihao \thesection}{1em}{}{}
\titlespacing{\section}
    {0pt}{1.5ex plus .1ex minus .2ex}{\wordsep}

%\titleformat{\section}[hang]{\CJKfamily{hei}\Large \centering} %标题居中
%\titleformat{\section}[hang]{\CJKfamily{hei}\Large}
%    {\Large \thesection}{1em}{}{}
%\titlespacing{\section}
%    {0pt}{1.5ex plus .1ex minus .2ex}{\wordsep}

\titleformat{\subsection}[hang]{\CJKfamily{hei}}
    {\thesubsection}{1em}{}{}
\titlespacing{\subsection}%
    {0pt}{1.5ex plus .1ex minus .2ex}{\wordsep}

%\titleformat{\subsection}[hang]{\CJKfamily{hei}\large}
%    {\large \thesubsection}{1em}{}{}
%\titlespacing{\subsection}%
%    {0pt}{1.5ex plus .1ex minus .2ex}{\wordsep}

\titleformat{\subsubsection}[hang]{\CJKfamily{hei}}
    {\thesubsubsection }{1em}{}{}
\titlespacing{\subsubsection}%
    {0pt}{1.2ex plus .1ex minus .2ex}{\wordsep}

%======================= 定义列表项目格式 ==========================%
%\renewcommand\labelenumi{\textcircled{\scriptsize \theenumi}}  %带圈的数字
\renewcommand\labelenumi{(\theenumi)}
\renewcommand\labelenumii{(\theenumii)}
\renewcommand\labelenumiii{\theenumiii.}
\renewcommand\labelenumiv{\theenumiv.}

%====================== 定制图形和表格标题样式 =====================%
%---------------------- 定制图形和表格标题格式 ---------------------%
\renewcommand{\captionlabeldelim}{} %定义如  "图(表)2: 示例" 中的间隔符号,如 ":" ,这里定义为空
\renewcommand{\captionlabelsep}{\hspace{1em}} %定义图表编号与标题间的间隔距离
\renewcommand{\captionlabelfont}{\small \CJKfamily{hei}\bf} %定义图表标签的字体
\renewcommand{\captionfont}{\small \CJKfamily{song}\rmfamily} %定义图表标题内容的字体
%% \scriptsize \footnotesize \small \large \Large  %图形标签字体大小

%--------------------- 定义图、表、公式的编号格式 -------------------%
\renewcommand{\thetable}{\arabic{chapter}-\arabic{table}}
\renewcommand{\theequation}{\arabic{chapter}-\arabic{equation}}
\renewcommand{\thefigure}{\arabic{chapter}-\arabic{figure}}


%=========================== 目录设置 ==================================%
\setcounter{tocdepth}{3} \setcounter{secnumdepth}{3}
% 可以用\section[abc]{abcdefg}形式的命令,这样abc就做为缩短标题出现
% 在目录表中和页眉上.另外,还可以利用\addtocounter{secnumdepth}{num}
% 来使得当前章节编号深度增加或减小,num可取正值或负值.

%============================= 页面设置 ================================%
%-------------------- 定义页眉和页脚 使用fancyhdr 宏包 -----------------%
% 定义页眉与正文间双隔线
\newcommand{\makeheadrule}{%
    \makebox[0pt][l]{\rule[.7\baselineskip]{\headwidth}{0.3pt}}%0.4
    \rule[0.85\baselineskip]{\headwidth}{1.5pt}\vskip-.8\baselineskip}%1.5 0.4->0.5
\makeatletter
\renewcommand{\headrule}{%
    {\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi
     \makeheadrule}}
\makeatother

%如果需要画单隔线,则需要
\iffalse%-------------------------------%
\renewcommand{\headrulewidth}{0.5pt}    %在页眉下画一个0.5pt宽的分隔线
\renewcommand{\footrulewidth}{0pt}      % 在页脚不画分隔线。
\fi%-------------------------------------%

\pagestyle{fancyplain}

\renewcommand{\chaptermark}[1]%
{\markboth{\chaptername \ #1}{}}            % \chaptermark 去掉章节标题中的数字
\renewcommand{\sectionmark}[1]%
{\markright{\thesection \ #1}{}}            % \sectionmark 去掉章节标题中的数字
\fancyhf{}  %清除以前对页眉页脚的设置

\fancyhead[LE]{\CJKfamily{song}\rightmark}     % 在book文件类别下,
\fancyhead[RO]{\CJKfamily{song}\leftmark}% \leftmark自动存录各章之章名,

\fancyfoot[C]%[RE][LO]
%{\CJKfamily{hei} 第\thepage页,共\pageref{LastPage}页}
{-\,\thepage\,-}

%如果要要改变封面和章首页的页眉和页脚,则需要
\iffalse%----------------------------------------%
\fancypagestyle{plain}
{
\fancyhead{}                                    % clear all header fields
\fancyhead[CE,CO]{这是章首页或封面的页眉}
\renewcommand{\headrulewidth}{0pt}

⌨️ 快捷键说明

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