魔改《自动化学报》Latex模板

魔改《自动化学报》Latex模板想用latex写一个中文文档,看上了《自动化学报》的模板,感觉不错,下载下来在本地的texlive上编译,报了一大串错;上传到overleaf,还是报错;原来是这个模板太老了,居然还在用CTex,正经人谁还用已经淘汰了的CTex啊。而且,模板给的老版CTex下载地址http://www.aas.net.cn/UserFiles/File/CTeX-2.4.6-Full.exe根本为空啊,老同志不讲武德啊。这个年轻人CTeX-2.4.6-Full给的ftp也下不了。那咋整呢,我一个latex小白,翻来覆去

魔改《自动化学报》Latex模板"

想用latex写一个中文文档,看上了《自动化学报》的模板,感觉不错,下载下来在本地的tex live上编译,报了一大串错;上传到overleaf,还是报错;原来是这个模板太老了,居然还在用CTex,正经人谁还用已经淘汰了的CTex啊。而且,模板给的老版CTex下载地址http://www.aas.net.cn/UserFiles/File/CTeX-2.4.6-Full.exe根本为空啊,老同志不讲武德啊。这个年轻人CTeX-2.4.6-Full给的ftp也下不了。

那咋整呢,我一个latex小白,翻来覆去思想斗争了一个月,做出了一个违背祖宗的决定,我要魔改这个模板,把模板迁到tex live上来。总的来说,这个模板的问题在于用的CJKpicins等包太落后了,统统改成tex live上的包!
主要改ass.clsass.cfgtemplate.tex三个文件,然后其他的文件统统都可以删了,岂不美哉~

魔改结果:
ass.cls

%%
%%
%%  作者: 自动化所自由软件协会 尚书林 左年明
%%
%% Copyright (C) 2006 by SHANG Shulin<shangsl@gmail.com>, 
%%                       ZUO Nianming<nianming@gmail.com>
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3a
%% of this license or (at your option) any later version.
%% The latest version of this license is in:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3a or later is part of all distributions of LaTeX
%% version 2004/10/01 or later.
%%  
%% Here we say thanks to cwang.ustc@gmail.com for telling us and fix the bug that
%% AAS can display fangsong font correctly

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{aas}[2006/04/24 v0.3 AAS CJK LaTeX template class] % Need to be changed with new release
%
\LoadClass[a4paper, 10pt,twocolumn,twoside,final]{article}
\RequirePackage{ifthen}
\usepackage{flushend}
\usepackage{ctex}
\usepackage{picinpar}
\usepackage{ccaption}
\RequirePackage{calc}
%
%
%%--------PAGE FORMAT---------%%
\setlength{\topmargin}{0mm}
\setlength{\headsep}{15pt}  % 页眉底 与正文上面之间的距离
\setlength{\headheight}{6mm}
\setlength{\oddsidemargin}{-7mm}
\setlength{\evensidemargin}{-7mm}
\setlength{\voffset}{-0.40in}   % one inch + \voffset 页眉顶到页顶的距离
\setlength{\hoffset}{0mm}
\setlength{\footskip}{3.5em}
\setlength{\columnsep}{6mm} % 设置两栏之间的间距

\textwidth \paperwidth%
\textheight \paperheight%
\addtolength\textwidth{-38mm} 
\addtolength\textheight{-62mm} 
% extra vertical space between paragraphs normally
\setlength{\parskip}{0mm}
% extra vertical space between paragraphs within a list item
%\setlength{\parsep}{0mm}

%% 下面两条命令设定displaymath与上下文的间距
\setlength{\abovedisplayskip}{8pt plus 2pt minus 2.5pt}
\setlength{\belowdisplayskip}{8pt plus 2pt minus 2.5pt}

\setlength{\doublerulesep}{0.5pt}

%% 行距
\renewcommand{\baselinestretch}{1.15} % 1.22 --- 1.25倍行距
\renewcommand{\arraystretch}{1.16}
%
%%------------ Define font -----------------%%
\newcommand{\song}{\CJKfamily{zhsong}}    % 宋体
\newcommand{\fs}{\CJKfamily{zhfs}}    % 仿宋体
\newcommand{\kai}{\CJKfamily{zhkai}}      % 楷体
\newcommand{\hei}{\CJKfamily{zhhei}}      % 黑体
\newcommand{\li}{\CJKfamily{zhli}}        % 隶书
\newcommand{\you}{\CJKfamily{zhyou}}      % 幼圆
\let\songti\song
\let\fangsong\fs
\let\kaishu\kai
\let\heiti\hei
\let\lishu\li
\let\youyuan\you
%
\newlength\aas@linespace
\newcommand{\aas@choosefont}[3]{%
   \setlength{\aas@linespace}{#1*\real{\baselinestretch}}%
   \fontsize{#1}{\aas@linespace plus#2 minus #3}\selectfont}

\renewcommand\zihao[1]{%
\ifthenelse{\equal{#1}{0}}{%
    \aas@choosefont{42bp}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{0-}}{%
    \aas@choosefont{36bp}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{1}}{%
    \aas@choosefont{26bp}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{1-}}{%
    \aas@choosefont{24bp}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{2}}{%
    \aas@choosefont{22bp}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{2-}}{%
    \aas@choosefont{18bp}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{3}}{%
    \aas@choosefont{16bp}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{3-}}{%
    \aas@choosefont{15bp}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{4}}{%
    \aas@choosefont{14bp}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{4-}}{%
    \aas@choosefont{12bp}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{5}}{%
    \aas@choosefont{10.5bp}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{5-}}{%
    \aas@choosefont{9bp}{.2pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{6}}{%
    \aas@choosefont{7.5bp}{.2pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{-6}}{%
    \aas@choosefont{6.5bp}{.2pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{7}}{%
    \aas@choosefont{5.5bp}{.1pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{8}}{%
    \aas@choosefont{5bp}{.1pt}{.1pt}}{}}

%%----- Redefine \tiny \scriptsize \footnotesize\small ----------%%
%%-------------------------\normalsize --------------------------%%
%%---------------\large \Large \LARGE \huge \Huge ---------------%%
%% Refer to ctex
\def\tiny{\zihao{7}}
\def\scriptsize{\zihao{6-}}
\def\footnotesize{\zihao{6}}
\def\small{\zihao{5-}}
\def\normalsize{\zihao{5}}%
\def\large{\zihao{4-}}%
\def\Large{\zihao{3-}}%
\def\LARGE{\zihao{2-}}%
\def\huge{\zihao{2}}%
\def\Huge{\zihao{1}}%
\normalsize % make \baselinestretch take affect
% 改文献的序号[1]为 1
\renewcommand{\@biblabel}[1]{#1}
% 使整篇文章的首段都有缩进
\let\@afterindentfalse\@afterindenttrue\@afterindenttrue
% 参考文献号上标显示
\def\@cite#1#2{\textsuperscript{[{#1\if@tempswa, #2\fi}]}}
%
% 两脚注间的竖直距离
\setlength{\footnotesep}{0pt}
% 重新定义 脚注条
\def\footnoterule{\kern-3\p@ \hrule width .7\columnwidth height 0.4pt \kern 2.6\p@}
%
%%-------- maketitle --------%%
%
\newcommand{\cntitle}[1]{\gdef\aas@cntitle{
  
  {\zihao{2-}\hei #1}}}
\newcommand{\cnauthor}[1]{\gdef\aas@cnauthor{\zihao{4-} \fs #1}}
\newcommand{\doi}[1]{\gdef\aas@doi{
  
  {\noindent\small {\bf DOI}\quad #1}}}
%
\newcommand{\entitle}[1]{\gdef\aas@entitle{
  
  {\large\bf #1}}}
\newcommand{\enauthor}[1]{\gdef\aas@enauthor{\small #1}}
\newcommand{\enaddress}[1]{\gdef\aas@enaddress{
  
  {\noindent\small {\bf Citation}\quad #1}}}
\newcommand{\email}[1]{\gdef\aas@email{
  
  {\centering\footnotesize (E-mail: #1)}}}
\newcommand{\enabstract}[1]{\gdef\aas@enabstract{
  
  {\noindent\small {\bf Abstract}\quad #1}}}
\newcommand{\enkeyword}[1]{\gdef\aas@enkeyword{
  
  {\noindent\small {\bf Key words}\quad #1}}}
%
\renewcommand{\refname}{\centering \normalsize\bf References}
%
\renewcommand{\maketitle}{\par
 \begingroup
  \def\thefootnote{}%  the \thanks{} mark type is empty
  \def\footnotemark{}% and kill space from \thanks within author
   \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
   \long\def\@makefntext##1{\parindent 1em\noindent
           \hb@xt@0.5em{%
               \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
   \twocolumn[\@maketitle]%
   \thispagestyle{aas@firstheadings}%ssl
   \@thanks%
 \endgroup%
 \setcounter{footnote}{0}%
 \global\let\thanks\relax%
 \global\let\maketitle\relax%
 \global\let\@maketitle\relax%
 \global\let\@thanks\@empty%
 \global\let\@author\@empty%
 \global\let\@title\@empty%
 \global\let\title\relax%
 \global\let\author\relax%
 \global\let\and\relax%
%
 \global\let\aas@cntitle\relax%
 \global\let\aas@cnauthor\relax%
 \global\let\aas@cnaddress\relax%
 \global\let\aas@cnabstract\relax%
 \global\let\aas@cnkeyword\relax%
 \global\let\aas@doi\relax%
%
 \global\let\cntitle\relax%
 \global\let\cnauthor\relax%
 \global\let\cnaddress\relax%
 \global\let\cnabstract\relax%
 \global\let\cnkeyword\relax%
 \global\let\cncl\relax%
 \global\let\email\relax%
 \global\let\doi\relax%
%
 \global\let\aas@entitle\relax%
 \global\let\aas@enauthor\relax%
 \global\let\aas@enaddress\relax%
 \global\let\aas@enabstract\relax%
 \global\let\aas@enkeyword\relax%
%
 \global\let\entitle\relax%
 \global\let\enauthor\relax%
 \global\let\enaddress\relax%
 \global\let\enabstract\relax%
 \global\let\enkeyword\relax%
}
%
\def\@maketitle{%
    \let\footnote\thanks%
    \newpage\null% an empty hbox
    \vskip 1.0\baselineskip%
    {\centering%
    {\aas@cntitle\par}%
    {\title\par}%
    {%\vskip 0.8em%
    \vskip 0.8\baselineskip%
     \begin{tabular}[t]{c}%
     \aas@cnauthor%
     \end{tabular}%
     \vskip 0.3em%
     \par%
     }%
     \vskip 0.2\baselineskip
     }%
    {\linespread{1.0}\selectfont\cabstract\par%
    \vskip 0.2\baselineskip%
    \ckeyword\par%
    \vskip 0.2\baselineskip%
    \caddress\par%  
    \vskip 0.2\baselineskip% 
    \aas@doi\par
    }%
    \vskip 0.7\baselineskip%
    {\centering%
    {\aas@entitle\par}%
    {%\vskip 1.2em%
    \vskip 0.5\baselineskip%
    \begin{tabular}[t]{c}%
    \aas@enauthor%
    \end{tabular}%
    \vskip 0.3em%
    \par%
    }%
    \vskip 0.2\baselineskip}%
    {\linespread{1.0}\selectfont\aas@enabstract\par%
    \vskip 0.2\baselineskip%
    \aas@enkeyword\par%
    \vskip 0.2\baselineskip%
    \aas@enaddress\par%    
    }%
    \vskip 1.5\baselineskip%
}
%---------------- Define biography ----------------%%
\newenvironment{biography}[1][]{
\vskip 0.4\baselineskip%
\zihao{5-}
\begin{window}[1,c, \includegraphics[
    height=3.0cm,width=2.4cm, keepaspectratio]{#1},{}]\end{window}
}{\vskip 0.4\baselineskip\par}


%% For author who has no photo
\newenvironment{biographynophoto}{\vskip 0.4\baselineskip\zihao{5-}}{\vskip 0.4\baselineskip\par}

%%---------------- Redefine section -----------------%%
\setcounter{secnumdepth}{3}

\renewcommand\thesection {\@arabic\c@section}
\renewcommand\thesubsection   {\thesection.\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection .\@arabic\c@subsubsection}

\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-1.5ex \@plus -.2ex \@minus -.2ex}%
                                   {1.5ex \@plus.2ex}%
                                   {\zihao{4-}\hei}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-1.0ex \@plus -.2ex \@minus -.2ex}%
                                     {1.0ex \@plus .2ex}%                
                                     {\zihao{5}\hei}}
 
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-0.5ex \@plus -.2ex \@minus -.2ex}%
                                     {0.5ex \@plus .2ex}%                
                                     {\normalsize\hei}}
\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
    \endgroup
  \fi}

% \newenvironment{sloppypar}{\par\sloppy}{\par}

\AtBeginDocument{%
   \flushend
   \begin{sloppypar}
   \input{aas.cfg}%
   \captiondelim{ }
   \captionnamefont{\small}
   \captiontitlefont{\small}
   }
\AtEndDocument{\clearpage\end{sloppypar}}

\endinput

ass.cfg:

%%
%%
%%  作者: 中科院自动化所自由软件协会 尚书林 左年明
%%
%% Copyright (C) 2006 by SHANG Shulin<shangsl@gmail.com>, ZUO Nianming
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3a
%% of this license or (at your option) any later version.
%% The latest version of this license is in:
%% 
%% http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3a or later is part of all distributions of LaTeX
%% version 2004/10/01 or later.
%%
\newcommand*{\cnabstract}[1]{\gdef\cabstract{\noindent{\zihao{6}{\hei 摘{\quad}要}\quad #1}}}
\newcommand*{\cnkeyword}[1]{\gdef\ckeyword{\noindent{\zihao{6}{\hei 关键词}\quad #1}}}
\newcommand*{\cnaddress}[1]{\gdef\caddress{\noindent{\zihao{6}{\hei 引用格式}\quad #1}}}
%
\renewcommand{\figurename}{\song 图}
\renewcommand{\tablename}{\song 表}
%
\makeatletter
%%------------------aas@firstheadings begin------------------------------------%%
\def\ps@aas@firstheadings{
   \let\@evenhead\@empty\let\@evenfoot\@empty
   \let\@oddhead\@empty\let\@oddfoot\@empty
   \def\@evenhead{%
       \vbox{%
           \hbox to \textwidth{\zihao{5-}\quad{\zihao{5-}\song 第}\hskip 0.35em XX\hskip 0.35em{\zihao{5-}\song 卷\hskip 0.8em第}\hskip 0.35em X\hskip 0.35em{\zihao{5-}\song 期}\hfill {\zihao{5-} X\hskip 0.79em X\hskip 0.79em X\hskip 0.79em期\hskip 0.79em刊}\hfill Vol.\hskip 0.18em XX, No.\hskip 0.18em X\quad}%
           \vskip 2.13mm%
           \hbox to \textwidth{\zihao{5-}\quad2021{\zihao{5-}\song\hskip 0.35em年\hskip 0.35em}4\hskip 0.35em{\zihao{5-}\song 月}\hskip 8mm\hfill xxx Journal\hfill April, 2021\quad}%
           \vskip 1.35mm%
           \hrule width\textwidth height0.63pt\vskip0.85pt \hrule width\textwidth height0.63pt%
       }
   }
   %\def\@evenfoot{
   %\hbox{}%\zihao{5-}$\copyright$ 200X by {\sl Acta Automatica Sinica}. All rights reserved.
   % }
   \let\@oddhead\@evenhead%
   \let\@oddfoot\@evenfoot%
}

%%-----------------aas@firstheadings end--------------------------------------%%

%%-------------------aasheadings begin----------------------------------------%%
\def\ps@aasheadings{
    \let\@evenhead\@empty\let\@evenfoot\@empty
    \let\@oddhead\@empty\let\@oddfoot\@empty
    \def\@evenhead{%
        \vbox{%
            \vskip 3.2mm%
            \hbox to \textwidth {\hbox{\zihao{5-}\thepage} \hfill \hbox{\zihao{5-}\song X\hskip 2.30em X\hskip 2.30em X\hskip 2.30em期\hskip 2.30em刊} \hfill \hbox{\zihao{5-} XX\hskip 0.18em{\zihao{5-}\song 卷\ }}}%
            \vskip 2.0mm%
            \hbox to \textwidth{\noindent\rule[2mm]{\textwidth}{0.5pt}}%
        }%
    }
    \def\@oddhead{%
        \vbox{%
            \vskip 3.2mm%
            \hbox to \textwidth {\quad {\zihao{5-} X\hskip 0.18em}{\zihao{5-}\song 期}\hfill{\zihao{5-}\song这是一个模板}\hfill {\zihao{5-}\thepage}}%
            \vskip 2.0mm%
            \hbox to \textwidth{\noindent\rule[2mm]{\textwidth}{0.5pt}}%  
        }
    }%
}
%---------------------headings end------------------------------------------%%
\makeatother


template.tex:

\documentclass{aas}
\usepackage{multicol}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{url}
\usepackage{ccaption}
\usepackage{booktabs} % 做三线表的上下两条粗线用

\setcounter{page}{1}

\begin{document}

\cntitle{
  
  {\hei\qquad 这是一个模板}

    % \thanks{收稿日期\
    %     XXXX-XX-XX
    %     \quad
    %     录用日期\
    %     XXXX-XX-XX}

    % \thanks{Manuscript received
    %     Month Date, Year;
    %     accepted
    %     Month Date, Year}

    \thanks{国家自然科学基金(xxxxxx)资助}

    \thanks{Supported by National Natural Science Foundation of China (xxxx)}

    % \thanks{本文责任编委\ XXX}

    % \thanks{Recommended by Associate Editor BIAN Wei}

    \thanks{1. 华清大学雷系 \ 北京\ 100084}

    \thanks{1. Department of Thunder, Huatsing University, Beijing 100084
    }}

\cnauthor{大爷$^{\scriptscriptstyle 1}$
    \hspace{1em}
    二大爷$^{\scriptscriptstyle 1}$
    \hspace{1em}
    三大爷$^{\scriptscriptstyle 1}$
}

\cnabstract{本文魔改了自动化学报的模板.}

\cnkeyword{Latex,模板}

\doi{xxxxxxxxxxxxxxxxxxxxxx}

\entitle{This Is a Template}

\enauthor{Father$^1$
    \qquad
    Second Father$^1$
    \qquad
    Third Father$^1$
}

\enabstract{This is a template.}

\enkeyword{latex, template}

\cnaddress{大爷,二大爷,三大爷. 这是一个模板. xxx期刊, 2021,
    \textbf{XX}(X): X$-$X}

\enaddress{Father, Second Father, Third Father. This Is a Template.
    \textsl{xxx Journal}, 2021, \textbf{XX}(X): X$-$X}

\maketitle

\pagestyle{aasheadings}

%这一章为引言,无需写标题.

本文是魔改《自动化学报》的中文稿件\LaTeX
模版的一个样例和使用说明.模版的中文支持Tex Live.这一章为引言,无需写标题.

\section{准备稿件}

\end{document}

最后,记得用xelatex编译哦,用pdflatex编译不出来。

结果看起来就跟《自动化学报》差不多啦,咦等等,字号好像差亿点点,我也没改字体大小呀,不过也没关系啦,反正我也不是要投稿,就算要投稿也是格式不限的,接收的时候才要排版吧,到那时候,交给编委的工具人去排版它不香吗,打工人何必为难打工人呢。

今天的文章魔改《自动化学报》Latex模板分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/30692.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注