发布时间:2009-12-10 23:05:32
文章类别:TeX介绍
原文地址:http://blog.sina.com.cn/s/blog_5e16f1770100gdi7.html

QQ群:91940767/145316219/141877998/80300084/194770436
淘宝店:http://latexstudio.taobao.com
技巧续篇:http://latexstudio.net/
常见数学公式问题集下载

% 下面定义的命令(\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 中的定义
%重新定义enumerat环境的标签形式,一般不推荐这样改
%\renewcommand{\labelenumi}{(\arabic{enumi})~}
%\renewcommand{\labelenumii}{\textcircled{\arabic{enumii}}~}
%\renewcommand{\labelenumiii}{(\alph{enumiii})~}
%\renewcommand{\labelenumiv}{\textcircled{\alph{enumiii}~}}
%To reduce the linespacing in a bibliography
\let\oldthebibliography=\thebibliography
\let\endoldthebibliography=\endthebibliography
\renewenvironment{thebibliography}[1]{%
\begin{oldthebibliography}{#1}%
\setlength{\parskip}{0ex}%
\setlength{\itemsep}{0ex}%
}%
{%
\end{oldthebibliography}%
}
%字号设置
\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}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont}
\newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}
%更改脚注设置
\renewcommand{\thefootnote}{\textcircled{{\tiny\arabic{footnote}}}}
% Use a small font for the verbatim environment
\makeatletter % makes '@' an ordinary character
\renewcommand{\verbatim@font}{%
\ttfamily\small\catcode`\<=\active\catcode`\>=\active%
}
\makeatother % makes '@' a special symbol again
%常用特殊字符的输入
%罗马数字的输入
\def\BigRoman{\uppercase\expandafter{\romannumeral\number\count 255 }}
\def\Romannumeral{\afterassignment\BigRoman\count255=}
%例如 \romannumeral35产生xxxv, \Romannumeral35产生XXXV
%度的输入
\newcommand{\grad}{\ensuremath{^{\circ}}}
%破折号等的输入, 以下三个命令用在\section中时应在前面加上\protect才行.
\renewcommand{\textemdash}{~\ensuremath{\raisebox{1pt}{---\!---}}}%让破折号在行中完全居中
\renewcommand{\textendash}{~\ensuremath{\raisebox{1pt}{--}}}%
\newcommand{\noexistdash}{~\ensuremath{\raisebox{1pt}{--\!--}}}%公式等中的不存在符号
%\hypersetup{pdfpagemode={FullScreen}} %make the pdf start in full-screen mode
%\newcommand{\mtilde}{\raisebox{-1.5pt}{\makebox[1ex][c]{$\tilde{}$}}}%产生起止符号~
\newcommand{\mtilde}{\ensuremath{\sim}}%产生起止符号~

%重新定义封面的形式
\renewcommand{\maketitle}
{\begin{titlepage}%
\begin{center} {\title} \vspace{1em} {\author} \vfill { \date}
\end{center}
\vspace*{28mm}%距下切口28mm.
\end{titlepage}%
}
\includeonly{}
\iffalse
DMDtoc,DMD-PR,DMD-SE,DMD-GR,DMD-DA,DMD-NA,DMD-LP,DMD-IP,DMD-NP,DMD-GP,DMD-DY,
DMD-GN,DMD-GT,DMD-IT,DMD-QT,DMD-RE,DMD-DF,DMD-SM,DMD-CA,DMD-OR
处理长文档的最佳方式,{}中文件全为*.tex 文件, 本文件和所有 *.tex
文件最好放在同一目录下.\fi
\begin{document}%正文开始
\phantomsection%可以避免PDF标签超级链接不正确的现象
\sloppy\CJKspace\CJKtilde%在中英文之间用~符号隔开,
%CJK 就能自动换行,同时避免英文和中文不能很好地分开的现象
\begin{CJK*}{GBK}{song}%{CJK*}表示中文之间的空格是被忽略的;可用\ 或用{CJK}选项来产生这种空格
%字体定义
\newcommand{\song}[1] {\begin{CJK*}{GBK}{song} #1 \end{CJK*}}
\newcommand{\fs}[1] {\begin{CJK*}{GBK}{fs} #1 \end{CJK*}}
\newcommand{\kai}[1] {\begin{CJK*}{GBK}{kai} #1 \end{CJK*}}
\newcommand{\hei}[1] {\begin{CJK*}{GBK}{hei} #1 \end{CJK*}}
\newcommand{\li}[1] {\begin{CJK*}{GBK}{li} #1 \end{CJK*}}
\newcommand{\you}[1] {\begin{CJK*}{GBK}{you} #1 \end{CJK*}}

%重新定义文档的显示形式
%\renewcommand\abstractname{摘\ \ 要} %article类型
\renewcommand\contentsname{目\ \ 录}
\renewcommand\listfigurename{正文插图目录}
\renewcommand\listtablename{正文表格目录}
%\renewcommand\refname{参考文献} %article类型
\renewcommand\bibname{参考文献} %book类型
\renewcommand\indexname{索\ \ 引}
\renewcommand\figurename{图}
\renewcommand\tablename{表}
\renewcommand\partname{部分}
\renewcommand\appendixname{附\ \ 录}

%配合前面的ntheorem宏包产生各种定理结构

%\theoremstyle{plain} \theoremseparator{}
%\theoremindent0cm\theoremnumbering{arabic} \theoremsymbol{}%以上是latex的默认设置
\iffalse%以下的定义是王磊对changebreak的修改, 推荐选用一个!
\newcommand\pretheorem{【}
\newcommand\posttheorem{】}
\makeatletter
\newtheoremstyle{mytheorem}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
\pretheorem ##1\ ##2\posttheorem\theorem@separator}\hbox{\strut}}}]}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
\pretheorem ##1\ ##2\posttheorem \theorem@separator\ (##3)}\hbox{\strut}}}]}
\makeatletter \theoremstyle{mytheorem} \fi%

\setlength{\theorempreskipamount}{0.5pt plus0.5pt minus0.5pt}
\setlength{\theorempostskipamount}{0.5pt plus0.5pt minus0.5pt}

\newcommand\pretheorem{\hspace{-3ex}\Coffeecup~}
\newcommand\posttheorem{}
\makeatletter
\newtheoremstyle{myplain}%
{\item[\hskip\labelsep \theorem@headerfont\pretheorem ##1\ ##2\posttheorem\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont\pretheorem ##1\ ##2\posttheorem\ (##3)\theorem@separator]}
\makeatother \theoremstyle{myplain}
\theoremheaderfont{\normalfont\CJKfamily{hei}}%表明定理标题结构中的内容为加粗的宋体
\theorembodyfont{\normalfont\rm\CJKfamily{kai}}%使以下定理结构中的内容为正的楷体
\theoremseparator{\hspace*{0.75em}}%这里是半个字的空格
\newtheorem{theorem}{定理}[chapter]
%\newtheorem{proof}{证明}[chapter]
\newtheorem{lemma}{引理}[chapter]
\newtheorem{corollary}{推论}[chapter]
\newtheorem{property}{性质}[chapter]

\newcommand\pretheorema{\hspace{-3ex}\phone~}
\newcommand\posttheorema{}
\makeatletter
\newtheoremstyle{myplain_1}%
{\item[\hskip\labelsep \theorem@headerfont\pretheorema ##1\ ##2\posttheorema\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont\pretheorema ##1\ ##2\posttheorema\ (##3)\theorem@separator]}
\makeatother \theoremstyle{myplain_1}
\newtheorem{definition}{定义}[chapter]

\newcommand\pretheoremb{\hspace{-3ex}\HandRight~}
\newcommand\posttheoremb{}
\makeatletter
\newtheoremstyle{myplain_2}%
{\item[\hskip\labelsep \theorem@headerfont\pretheoremb ##1\ ##2\posttheoremb\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont\pretheoremb ##1\ ##2\posttheoremb\ (##3)\theorem@separator]}
\makeatother \theoremstyle{myplain_2}
\newtheorem{example}{例}[chapter]

\newcommand\pretheoremc{\hspace{-3ex}\Yinyang~}
\newcommand\posttheoremc{}
\makeatletter
\newtheoremstyle{myplain_3}%
{\item[\hskip\labelsep \theorem@headerfont\pretheoremc ##1\ ##2\posttheoremc\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont\pretheoremc ##1\ ##2\posttheoremc\ (##3)\theorem@separator]}
\makeatother \theoremstyle{myplain_3}
\theorembodyfont{\normalfont\rm\CJKfamily{song}}
\newtheorem{casexuhao}{案例}[chapter]%可产生案例的序号

\newcommand\pretheoremd{\hspace{-3.1ex}\EightStarTaper}
\newcommand\posttheoremd{}
\makeatletter
\newtheoremstyle{myplain_4}%
{\item[\hskip\labelsep \theorem@headerfont\pretheoremd ##1\ ##2\posttheoremd\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont\pretheoremd ##1\ ##2\posttheoremd\ (##3)\theorem@separator]}
\makeatother \theoremstyle{myplain_4}
\theorembodyfont{\normalfont\rm\CJKfamily{song}}
\setlength{\theorempreskipamount}{0.5pt plus0.5pt minus0.5pt}
\setlength{\theorempostskipamount}{0.5pt plus0.5pt minus0.5pt}
\theoremseparator{} \theoremheaderfont{\normalfont\CJKfamily{hei}}
\newtheorem{xuhao}{}[chapter]%可产生习题的序号
%例如在正文中使用时可用命令\begin{definition}[定义标题] 定义的具体内容\end{definition}
%解和证明的输入
\newcommand{\mysolution}{{\CJKfamily{hei}{\noindent\hspace{-3ex}\Writinghand~分析\hspace*{0.5em}\,}}}
\newcommand{\computersolution}{{\CJKfamily{hei}{\noindent\hspace{-3ex}\Keyboard~软件实现\hspace*{0.5em}\,}}}
\newcommand{\myproof}{{\noindent\hspace{-3ex}{\footnotesize\manerrarrow}\CJKfamily{hei}{证明\hspace*{0.5em}}}}
\newcommand{\myproofend}{{\CJKfamily{hei}{证毕.}}}

%配合前面的宏包\usepackage{titlesec},对章的格式定义
\iffalse \makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
%\vspace*{50\p@}%
\vspace*{40\p@}%
{\parindent \z@ \centering \reset@font
\thickhrulefill\quad
\scshape %\@chapapp{} \thechapter
第~\thechapter~章\secmark
\quad \thickhrulefill
\par\nobreak
\vspace*{10\p@}%
\interlinepenalty\@M
\hrule
\vspace*{10\p@}%
\Huge \CJKfamily{li} #1\par\nobreak
\par
\vspace*{10\p@}%
\hrule
%\vskip 40\p@
\vskip 70\p@
}}
\def\@makeschapterhead#1{%
%\vspace*{50\p@}%
\vspace*{40\p@}%
{\parindent \z@ \centering \reset@font
\thickhrulefill
\par\nobreak
\vspace*{10\p@}%
\interlinepenalty\@M
\hrule
\vspace*{10\p@}%
\Huge \CJKfamily{li} #1\par\nobreak
\par
\vspace*{10\p@}%
\hrule
%\vskip 40\p@
\vskip 70\p@
}}
\fi

\renewcommand{\chaptername}{章}
\renewcommand{\chaptermark}[1]{\markboth{第~\thechapter~\chaptername\ \ #1}{}}
\titleformat{\chapter}[hang]
{\normalfont\Huge\filcenter\CJKfamily{li}}
{第~\thechapter~章\secmark}
{20pt}{\Huge}
\titlecontents{chapter}[4em]{}
{\CJKfamily{hei}\contentslabel[第~\thecontentslabel~章\secmark]{4em}}{}
{\titlerule*[0.5pc]{.}\hspace*{.1em}\contentspage}
\iffalse
%节的定义
\makeatletter
\def\section{\@ifstar\unnumberedsection\numberedsection}
\def\numberedsection{\@ifnextchar[%]
\numberedsectionwithtwoarguments\numberedsectionwithoneargument}
\def\unnumberedsection{\@ifnextchar[%]
\unnumberedsectionwithtwoarguments\unnumberedsectionwithoneargument}
\def\numberedsectionwithoneargument#1{\numberedsectionwithtwoarguments[#1]{#1}}
\def\unnumberedsectionwithoneargument#1{\unnumberedsectionwithtwoarguments[#1]{#1}}
\def\numberedsectionwithtwoarguments[#1]#2{%
\ifhmode\par\fi
\removelastskip
\vskip 5ex\goodbreak
\refstepcounter{section}%
\hbox to \hsize{\hss\vbox{\advance\hsize by 0cm
\noindent
\leavevmode\Large\CJKfamily{kai}\raggedright
\thesection\secmark\hspace*{0.75em}
#2\par
\vskip -2ex
\noindent\hrulefill
}}\nobreak
\vskip 2ex\nobreak\@nobreaktrue
\addcontentsline{toc}{section}{%
\protect\numberline{\thesection}%
#1}%
}
\def\unnumberedsectionwithtwoarguments[#1]#2{%
\ifhmode\par\fi
\removelastskip
\vskip 5ex\goodbreak
% \refstepcounter{section}%
\hbox to \hsize{\hss\vbox{\advance\hsize by 0cm
\noindent
\leavevmode\Large\CJKfamily{kai}\raggedright
% \thesection\
#2\par
\vskip -2ex
\noindent\hrulefill
}}\nobreak
\vskip 2ex\nobreak\@nobreaktrue
\addcontentsline{toc}{section}{%
% \protect\numberline{\thesection}%
#1}%
}
\makeatother \fi
%重新定义Section的编号格式, 这是Texguru的CCTLatex和Latex模版中的编号格式设置
%\renewcommand{\thesection}{你要求的 Section 编号格式}
%\renewcommand{\chaptermark}[1]{\markboth{ \thechapter\ #1}{}}
%\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
%\renewcommand{\theequation}{\arabic{chapter}.\arabic{section}.\arabic{equation}}
%\makeatletter % '@' is now a normal "letter" for TeX
%\@addtoreset{equation}{section}
%\makeatother % '@' is restored as a "non-letter" character for TeX
%可以借助于seceqn.sty 和apeqnum.sty宏包实现上述操作,
%seceqn.sty实现按节对公式进行编号, apeqnum.sty则对附录中的公式进行单独编号
%或者是article形式时
%\renewcommand{\theequation}{\arabic{section}.\arabic{subsection}.\arabic{equation}}

%参考文献编号的样式
%在\makeatletter ... \makeatother命令内部, 插入如下命令:
% \renewcommand\@biblabel[1]{#1.} % Arabic numbers, no brackets
%或者
% \renewcommand\@biblabel[1]{$^{#1}$} % Superscripts
%题目开始
\renewcommand{\title} {{\noindent\normalfont\CJKfamily{kai}
{\Large 中国科学院规划教材\hphantom{-----------------------------}}\\[1em]
教育部高等学校优秀青年教师教学科研奖励计划资助\\}
\vspace{2cm}{\yihao\CJKfamily{li} 运\qquad 筹\qquad 学~{\sanhao(\Romannumeral2~类)}}\\[1em] }
\renewcommand{\author}{\large\CJKfamily{fs}
{\xiaoerhao\CJKfamily{li} (第一版)}\\[1em]
徐玖平\qquad 胡知能\qquad
李\hspace*{1em}军\quad 编著\\ }%Specify the authors here
\renewcommand{\date}{\Large 科学出版社\\[1em]
{\large 北\quad 京}}
%题目结束
\newcommand{\booktitle}{运筹学~(\Romannumeral2~类)}%自定义书名代号,页眉中需要用时就不用重新输入.
\frontmatter%正文开始,下面的顺序决定书的章节顺序
\maketitle%产生题目
\include{DMDtoc} %版权声明
\setcounter{page}{1}
\fancyhead[CO]{\footnotesize\CJKfamily{kai}\sf 序}%
\include{DMD-PR}%序
\fancyhead[CO]{\footnotesize\CJKfamily{kai}\sf 常用符号说明}%
\include{DMD-SE}%符号说明
\fancyhead[CO]{\footnotesize\CJKfamily{kai}\sf\leftmark}
\fancyhead[CE]{\footnotesize\CJKfamily{kai}\sf \booktitle}
\tableofcontents%\listoftables\listoffigures%目录和前面是连续编号的,但要保证是从奇数页开始的
\newpage\pagestyle{empty}%清除最后一页可能出现的空白页的页眉,在下面第一个\include{}文章中的章节命令后要恢复标准设置
\mainmatter
%\setcounter{chapter}{num} %在文档中, 改变章节的初始值
%%%%%%%%%两分析
\include{DMD-GR}%概论
%%%%%%%%%五规划
\include{DMD-LP}%线性规划
\include{DMD-SM}%数据模拟
\clearpage
\appendix %the following "chapters" are really appendices
%附录开始,以下代码要放在第一个附录(源文件的格式和前面的章节完全一样)之中才会全部显示正常
\iffalse\renewcommand{\chaptername}{附录~\Alph{chapter}}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \ #1}{}}
\fancyhead[CO]{\footnotesize\CJKfamily{kai}\sf\leftmark}%让页眉恢复正常
\titleformat{\chapter}[hang]
{\normalfont\Huge\filcenter\CJKfamily{li}}
{附录~\thechapter}
{20pt}{\Huge}
\titlecontents{chapter}[4em]{}
{\CJKfamily{hei}\contentslabel[附录~\thecontentslabel]{4em}}{}
{\titlerule*[0.5pc]{.}\hspace*{.1em}\contentspage}
\fi
%%%%%%%%%其他
\include{DMD-CA}%案例分析
\clearpage %mainmatter 结束后用 \clearpage 来换页可解决链接不正确的问题.
\backmatter
\small
\bibliographystyle{ORbst}%指定参考文献形式,对custom-bib宏包中的makebst.tex用latex命令生成的.
%所须的.bst文件要放在E:\..\MiKTeX\TeXMF\bibtex\bst下或当前tex的同一文件夹下才行.
%\nocite{*}%若用这个选项,则文献中的顺序为输入时的顺序
\fancyhead[CO]{\footnotesize\CJKfamily{kai}\sf\leftmark}%让页眉恢复正常
\fancyhead[CE]{\footnotesize\CJKfamily{kai}\sf \booktitle}
\addcontentsline{toc}{chapter}{\CJKfamily{hei}\hspace*{-4em}参考文献}
\bibliography{OR-bib}\clearpage%让目录中的索引正确标识
\iffalse\makeatletter %\RequirePackage{multicol}%重新定义索引为出版社要求的三栏
\renewenvironment{theindex}{%
\columnseprule 0pt\relax
\columnsep 35pt\relax
\chapter*{\indexname}%
\begin{multicols}{3}%
\@mkboth{\MakeUppercase \indexname}{\MakeUppercase \indexname}%
\thispagestyle{plain}%
\parindent 0pt\relax
\parskip 0pt \@plus .3pt\relax
\let\item\@idxitem}%
{\end{multicols}} \makeatother\fi
\addcontentsline{toc}{chapter}{\CJKfamily{hei}\hspace*{-4em}索\quad
引}
\balance\printindex\nobalance%打印索引,并使最后一页的两列平衡
\include{DMD-OR}%教材系列介绍
\newpage %避免 LaTeX 尝试在 CJK 环境以外排版 header/footer 的中文字
\end{CJK*}
\end{document}%正文结束


点赞(0)

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部