【LaTeX技巧2】一个CJK完整更加实用的模板V1.0

2012-11-04 02:46 阅读 670 次 评论关闭

近来,帮助许多朋友修改文章的错误。尤其是遇到刚上手的朋友,入门的时候遇到很多问题,关于CCT,CTEX宏包等等,他们也只好乱投医,盲从网络。

仅个人的浅见:如果您要投稿的杂志是需要源文件的,建议使用CJK宏包来支持中文,不建议使用CCT,CTEX,因为国外杂志是在线编译的,根本不支持CCT汉字接口,也一般不提供CTeX(请查阅相关网站的说明)。如果该杂志只需要提交PDF或者PS文件,那就没有这些限制了。

我写了一个较为完备基于CJK的模板,可以实现基本的文章的功能,目录可以超级链接,可以做出中文不乱码的书签。也对目录,章节,参考文献进行了汉化预定义。希望对您有所帮助,我随后会陆续更新,高级版本中会有如:中文,英文两个标题并存,关键字,中英文目录并存,正文的一些结构上的调整等等.

\documentclass[a4paper,12pt]{article}
% define the title
\usepackage{graphicx}
\usepackage{graphicx}
\usepackage{array}
\usepackage{amsmath}
\usepackage{natbib}
\usepackage{CJK}
\usepackage{titlesec%设置标题
\usepackage{titletoc}
\usepackage[dvipdfm,
           pdfstartview=FitH,
           CJKbookmarks=true,
           bookmarksnumbered=true,
           bookmarksopen=true,
           colorlinks, %注释掉此项则交叉引用为彩色边框(将colorlinks和pdfborder同时注释掉)
           pdfborder=001, %注释掉此项则交叉引用为彩色边框
           linkcolor=blue,
           anchorcolor=blue,
           citecolor=blue
           ]{hyperref}

%===================== 重定义字体、字号命令 =====================%
\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{\chaoda}{\fontsize{55pt}{\baselineskip}\selectfont}
\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{\xiaosanhao}{\fontsize{15pt}{\baselineskip}\selectfont} % 字号设置
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\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}    % 字号设置

%=============================================================================%
\renewcommand\listfigurename{图 目 录}
\renewcommand\listtablename{表 目 录}

\renewcommand\figurename{图}
\renewcommand\tablename{表}

\begin{CJK}{GBK}{st}\end{CJK}
\titleformat{\chapter}[hang]
  % {\normalfont\bfseries\huge\filcenter\CJKfamily{hei}}
   {\normalfont\bfseries\yihao\filcenter\CJKfamily{hei}}
   %{\huge{\chaptertitlename}}
   {第~\CJKnumber{\thechapter}~章}
   %{第~{\thechapter}~章}
   {20pt}{\yihao}
\titleformat{\section}[hang]{}% add \bfseries if you want to use bold fonts
   {\sihao 第 \thesection 节}{1em}{}{}
\titlespacing{\section}%
   {0pt}{1.5ex plus .1ex minus .2ex}{\wordsep}%{1ex plus .1ex minus .2ex}
   \titlecontents{chapter}
         [3mm]
         {\addvspace{.1pc}}%
         { 第\CJKnumber{\thecontentslabel}章 \enspace}%
         {}
         {\titlerule*{$\cdots$}\contentspage}
\titlecontents{section}
             [10mm]
             {\vspace{.2\baselineskip}}
             {第\thecontentslabel 节\enspace}
             {}
             {\titlerule*{$\cdots$}\contentspage}
\titlecontents{subsection}
         [16mm]
         {\addvspace{.1pc}}%
         { \thecontentslabel \enspace}%
         {}
         {\titlerule*{$\cdots$}\contentspage}

%====================定义图,公式标编号等格式=============
\numberwithin{figure}{section} \numberwithin{table}{section}
\numberwithin{equation}{section}

\renewcommand{\theequation}{\thesection.\arabic{equation}}
\renewcommand{\thefigure}{\arabic{section}-\arabic{figure}}
\renewcommand{\thetable}{\arabic{section}-\arabic{table}}
%==========================================================
%==================================================================
%==================================================================
%==================================================================
%==================================================================
%==================================================================
%==================================================================

\begin{CJK*}{GBK}{song}
\author{作者姓名:XXXXX}
\title{文章题名:XXXXX}
\date{\today}
\begin{document}
% generates the title\textbf{插入标题}
\maketitle
\thispagestyle{empty}
% insert the table of contents插入目录
\setcounter{page}{1}

\renewcommand\contentsname{\centerline{\hei\sanhao 目\quad\quad\quad
录}}
\tableofcontents
\newpage
\renewcommand{\abstractname}{\sanhao 摘\quad 要}
\begin{abstract}
\thispagestyle{empty} 摘要:
\end{abstract}
\newpage
\setcounter{page}{1}
\section{殷商时代}\label{zhaiyao}正文
\subsection{周朝}
简单快乐撒接啊快乐手机噶
\subsection{春秋战国}

%\begin{figure}
%\centering
%\includegraphics{t1}
%\caption{tower001.}
%\end{figure}

表格的插入。\\\
\begin{center}
% Table generated by Excel2LaTeX from sheet '质量、体积、密度'
\begin{table}
\caption{密度} \centering
\begin{tabular}[!hbp]{|c|c|c|}
\hline
       质量 &         体积 &         密度 \\
\hline
        m &          V &        rho \\
\hline`
        g &         ml &       g/ml \\
\hline
        2 &          1 &          2 \\
\hline
        3 &       0.75 &          4 \\
\hline
        5 &          6 &   0.833333 \\
\hline
\end{tabular}
\end{table}
\end{center}

图形的插入
%\begin{figure}
%\centering
%\includegraphics{t2}
%\caption{tower002.}
%\end{figure}

\begin{displaymath}
\ a^x  + y \ne a^{x + y}
\end{displaymath}

 

 $a^x  + y \ne a^{x + y} $

\setlength{\unitlength}{5cm}
\begin{picture}(1,1)
\put(0,0){\line(0,1){1}}

\end{picture}
表格的插入。\\\
\begin{center}
% Table generated by Excel2LaTeX from sheet '质量、体积、密度'
\begin{table}
\caption{计算} \centering
\begin{tabular}[!hbp]{|c|c|c|}
\hline
       质量 &         体积 &         密度 \\
\hline
        m &          V &        rho \\
\hline`
        g &         ml &       g/ml \\
\hline
        2 &          1 &          2 \\
\hline
        3 &       0.75 &          4 \\
\hline
        5 &          6 &   0.833333 \\
\hline
\end{tabular}
\end{table}
\end{center}

\section{历史是什么玩意儿}
\subsection{哈哈 }

 

\subsection{呵呵}
\ldots when Einstein introduced his formula
\begin{equation}
e = m \cdot c^2 \; ,
\end{equation}
which is at the same time the most widely known and the least well
understood physical formula.

% Example 2
\ldots from which follows Kirchhoff’s current law:
\begin{equation}
\sum_{k=1}^{n} I_k = 0 \; .
\end{equation}
Kirchhoff’s voltage law can be derived \ldots
% Example 3
\ldots which has several advantages.
\begin{equation}
I_D = I_F - I_R\;.
\end{equation}
is the core of a very different transistor model. \ldots ;

\renewcommand\refname{\centerline{\hei \sanhao 参考文献}}

\begin{thebibliography}{99}
\bibitem{K}   张三丰 ~~~论太极剑与独孤九剑的联系\quad XXXX大学出版社,\quad  2009
\bibitem{h}   黄蓉  \quad 江浙菜系的若干讨论 \quad    XXXX书局\quad  2008
\bibitem{l} 王重阳 and 黄药师 and 欧阳峰 and 洪七公 and 段皇帝\quad
武林高手从入门到精通 \quad 第~$N$~次华山论剑 \quad XXX商务书局 \quad
2009
\bibitem{e} 杨过\quad  论黯然销魂掌的第十七式 \quad 东方武侠学会会刊\quad 2009
\end{thebibliography}

 

\clearpage
\end{CJK*}
\end{document}

版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:【LaTeX技巧2】一个CJK完整更加实用的模板V1.0 | 猎微网

评论已关闭!