现在的位置: 首页 > 综合 > 正文

数学模板 ctex

2013年08月12日 ⁄ 综合 ⁄ 共 6181字 ⁄ 字号 评论关闭

%bibx是参考文献数据库,编译顺序为latex、bibtex、latex、latex、pdflatex,
%不要用pdftexify,否则可能书签是乱码

/documentclass[cs4size,hyperref]{ctexart}               %加入hyperref是为了对中文的章、节题目进行处理
/usepackage{amsmath,amsthm,amssymb,amsfonts,bm}
/usepackage{graphicx}
/usepackage{verbatim}

/CTEXsetup[name={第,节}]{section}
/CTEXsetup[number={/Roman{section}}]{section}

/newtheorem{dingy}{定义}                                %
/newtheorem{dingl}[dingy]{定理}                         %[dingl]表示和定义共享编号
/newtheorem*{zhu}{注/hspace{.1mm}}                      %加*表示不编号
/newtheorem*{li}{/noindent {/heiti 例}/hspace{.1mm}}

/newcommand{/rd}{/mathrm{d}}
/newcommand{/rD}{/mathrm{D}}

/begin{document}
/title{/footnote{/cite{ctexc}ctex~宏文件.}{~~Ctex~中文模板}}
/author{van abel// {awj141@gmail.com}}
/maketitle

/tableofcontents
/part{文字处理}
  /subsection{字体}
/begin{center}
  /begin{tabular}{|l|c|}
  /hline
  $/backslash$ songti & {/songti 这是宋体}//
  /hline
  $/backslash$ heiti  & {/heiti 这是黑体}//
  /hline
  $/backslash$ fangsong&{/fangsong 这是仿宋}//
  /hline
  $/backslash$ kaishu & {/kaishu 这是楷书}//
  /hline
  $/backslash$ lishu  & {/lishu 这是隶书}//
  /hline
  $/backslash$ youyuan& {/youyuan 这是幼圆}//
  /hline
  /end{tabular}
/end{center}
If you'd like to use some English words in your article, please add a /$ between the code of Chinese and English characters. Such as:

就像我们知道的那样,中文之间的空格会被吞掉。例如/cite{ctexfaq}:
/begin{li}[空格吞掉]
假设 $x/in /bf R$, $y/in /bf{R}/setminus/bf Q$. 则 $x+y,xy,x/y/in /bf R/setminus /bf Q.$
/end{li}
/begin{zhu}[应该这样]
假设 ~$x/in /bf R$, $y/in /bf{R}/setminus/bf Q$. 则 ~$x+y,xy,x/y/in /bf R/setminus /bf Q.$
/end{zhu}
/part{数学模式}
/begin{dingl}[Stok/'es type theorem]
令~$/mathbf M/subset /bf R^2$ 是一个紧致二维带边流型。假设~$/alpha,/beta:/mathbf M/to /bf R$ 是可微的。则
/[
/int_{/partial /mathbf M}/alpha /rd x+/beta /rd y=/int_{/mathbf M} (/rD_1 /beta-/rD_2/alpha)/rd x/wedge/rd y=/iint_{/mathbf M}/left( /frac{/partial /beta}{/partial x}-/frac{/partial/alpha}{/partial y}/right)/rd x/rd y.
/]
/end{dingl}
这儿,$/mathbf M$ ~的定向为{/heiti 常定向}, 且~$/partial/mathbf M$ 的定向是{/heiti 导出定向},也即{/heiti 逆时针定向}。
/part{插图}
插图一直是一个问题,我采用的是~PNG~格式~$+$~pdflatex~的模式,注意为了使latex能够编译,需要运行~ebb ~ 图形文件名.png ~生成图形范围。
/begin{figure}[htbp]            %为了使插图正确引用,如果直接用的是pdflatex至少将它运行两次
/centering
/includegraphics[width=.8/textwidth]{fig4-3-a.png}
/caption{插图实例/label{fig43a}}
/end{figure}
可以这样引用,如图/ref{fig43a}所示。我们知道$/cdots$
/subsection{工作的简化}
注意在使用~PNG~或则~JPG~图形格式时,要利用命令/textrm{/DeclareGraphicsRule{.png}{eps}{.bb}{} /DeclareGraphicsRule{.jpg}{eps}{.bb}{} }申明。并且要运行~ebb~以获得图形范围文件~.bb~。这样才可以用~Latex~编译。

下面提供了上述方法的一个简化:
/verbatiminput{tuxingchuli.txt}
/part{源码}
/verbatiminput{code.txt}
%input "bibx.bib"
/bibliographystyle{amsplain}
/bibliography{bibx}
/end{document}

 

 

 

以上是主文件muban.tex

 

其中tuxingchuli.txt文件如下:

1、新建 txt 文件,输入:

@ECHO OFF
ebb.exe -b %1
pause

另存为"C:/CTeX/jpgebb.bat"

2、开始->运行:regedit, 找到
"HKEY_CLASSES_ROOT/jpegfile/shell/",
新建项“BoundingBox”, 再建一子项"command",
在默认字符串数值数据中 输入"C:/CTeX/jpgbb.bat %1"。

同样的方法修改注册表中的"pngfile", 然后按 F5 刷新注册表
3、在.tex 文件头中加入
/DeclareGraphicsRule{.jpg}{eps}{.bb}{}
/DeclareGraphicsRule{.png}{eps}{.bb}{}

4、例:
有两个文件:ctex-j.jpg 和 ctex-j.png, 选中ctex-j.jpg文件,
右键->BoundBox, 会自动生成 ctex-j.bb,
同样处理ctex-p.png
在WinEdit 中新建"test.tex", 输入如下代码:

/documentclass{article}
/usepackage{graphicx}
/DeclareGraphicsRule{.jpg}{eps}{.bb}{}
/DeclareGraphicsRule{.png}{eps}{.bb}{}
/begin{document}
/includegraphics{ctex-j.jpg}
/includegraphics{ctex-p.png}
/end{document}

然后用 latex 编译生成 test.dvi, 可以用 DVI Preview 查看,
图片显示正常

5、注意:
a、 用 pdflatex 直接生成的 .pdf 文件,图形无法显示.
所以想要.pdf就要用 dvitopdf
b、 无论是用 CCT&latex 直接生成的还是用 dvitops生成的.ps
 文件图形都是是黑白的.不知道如何解决
c、 在jpgbb.bat保存时存储类型选择"所有文件",否则会存为
"jpgbb.bat.txt"
d、在 jpgbb.bat 最后一行:pause 使得运行"ebb.exe"的
Dos窗口不会自动关闭,如果不喜欢可以去掉

 

 

其中code.txt文件如下:

 

%bibx是参考文献数据库,编译顺序为latex、bibtex、
%latex、latex、pdflatex,
%不要用pdftexify,否则可能书签是乱码

/documentclass[cs4size,hyperref]{ctexart}
%加入hyperref是为了对中文的章、节题目进行处理
/usepackage{amsmath,amsthm,amssymb,amsfonts,bm}
/usepackage{graphicx}
/hypersetup{
            colorlinks=true,
            linkcolor=blue
}
%如果这里不用hyperref宏包可能pdf书签是乱码
/DeclareGraphicsRule{.png}{eps}{.bb}{} %png支持
/CTEXsetup[name={第,节}]{section}
/CTEXsetup[number={/Roman{section}}]{section}

 

/newtheorem{dingy}{定义}
%[dingl]表示和定义共享编号
/newtheorem{dingl}[dingy]{定理}
%加*表示不编号
/newtheorem*{zhu}{注/hspace{.1mm}}
/newtheorem*{li}{/noindent {/heiti 例}/hspace{.1mm}}

/newcommand{/rd}{/mathrm{d}}
/newcommand{/rD}{/mathrm{D}}

/begin{document}
/title{/footnote{/cite{ctexc}ctex~宏文件.}{~~Ctex~中文模板}}
/author{van abel// /href{mailto:awj141@gmail.com}{awj141@gmail.com}}
/maketitle

/tableofcontents
/part{文字处理}
  /section{字体}
/begin{center}
  /begin{tabular}{|l|c|}
  /hline
  $/backslash$ songti & {/songti 这是宋体}//
  /hline
  $/backslash$ heiti  & {/heiti 这是黑体}//
  /hline
  $/backslash$ fangsong&{/fangsong 这是仿宋}//
  /hline
  $/backslash$ kaishu & {/kaishu 这是楷书}//
  /hline
  $/backslash$ lishu  & {/lishu 这是隶书}//
  /hline
  $/backslash$ youyuan& {/youyuan 这是幼圆}//
  /hline
  /end{tabular}
/end{center}
If you'd like to use some English words in your article,
 please add a /$ between the code of Chinese and
English characters. Such as:

就像我们知道的那样,中文之间的空格会被吞掉。
例如/cite{ctexfaq}:
/begin{li}[空格吞掉]
假设 $x/in /bf R$, $y/in /bf{R}/setminus/bf Q$.
则 $x+y,xy,x/y/in /bf R/setminus /bf Q.$
/end{li}
/begin{zhu}[应该这样]
假设 ~$x/in /bf R$, $y/in /bf{R}/setminus/bf Q$.
则 ~$x+y,xy,x/y/in /bf R/setminus /bf Q.$
/end{zhu}
/part{数学模式}
/begin{dingl}[Stok/'es type theorem]
令~$/mathbf M/subset /bf R^2$ 是一个紧致二维带边流型。
假设~$/alpha,/beta:/mathbf M/to /bf R$ 是可微的。则
/[
/int_{/partial /mathbf M}/alpha /rd x+/beta /rd y=
/int_{/mathbf M} (/rD_1 /beta-/rD_2/alpha)/rd x/wedge/rd
y=/iint_{/mathbf M}/left( /frac{/partial /beta}{/partial
 x}-/frac{/partial/alpha}{/partial y}/right)/rd
x/rd y.
/]
/end{dingl}
这儿,$/mathbf M$ ~的定向为{/heiti 常定向},
且~$/partial/mathbf M$ 的定向是{/heiti 导出定向},
也即{/heiti
逆时针定向}。
/part{插图}
插图一直是一个问题,我采用的是~PNG~格式~$+$~pdflatex~的
模式,注意为了使latex能够编译,需要运行~ebb ~
图形文件名.png ~生成图形范围。
/begin{figure}[htbp]            %为了使插图正确引用,
如果直接用的是pdflatex至少将它运行两次
/centering
/includegraphics[scale=.5]{fig4-3-a.png}
/caption{插图实例/label{fig43a}}
/end{figure}
可以这样引用,如图/ref{fig43a}所示。我们知道$/cdots$
/section{工作的简化}
注意在使用~PNG~或则~JPG~图形格式时,要利用命令
/textrm{/DeclareGraphicsRule{.png}{eps}{.bb}{}
/DeclareGraphicsRule{.jpg}{eps}{.bb}{}
}申明。并且要运行~ebb~以获得图形范围文件~.bb~。
这样才可以用~Latex~编译。

下面提供了上述方法的一个简化:
/verbatiminput{tuxingchuli.txt}
/part{源码}
/verbatiminput{code.txt} %input "bibx.bib"
/bibliographystyle{amsplain}
/bibliography{bibx}
/end{document}

其中bibx.bib文件如下;

@ARTICLE{ctexc,
  AUTHOR =       {CtexOrg},
  TITLE =        {ctex 宏包说明},
  YEAR =         {2009},
}
@ARTICLE{ctexfaq,
  AUTHOR =       {吴凌云},
  TITLE =        {CTEX FAQ(常见问题集)},
  JOURNAL =      {Version 0.4 beta (88)},
  YEAR =         {2005},
}

抱歉!评论已关闭.