为WinEdt添加自制LaTeX模板
实际上, 写作过程中有些重复的东西。 为此, 我们可以将公共的部分提出来建一个模板文件。 然后将其添加到WinEdt中, 这样我们就可以直接在新建文档里面找到了。
详细过程如下:
- 假设你的tex安装目录为:
C:\CTEX, 首先是把你的模板文件copy到C:\CTEX\WinEdt\Templates\Doc下面, 这样WinEdt就可以在相应位置找到该文件了。 - 打开WinEdt, 单击
Options->Options Interface, 打开选项交互边侧栏。此时在该边侧栏找到Editor: Mouse,Modes,Defaults...下的Document Templates, 并单击打开Templates.ini - 在你希望显示新模板的位置(我这里是最后, 注意放在
[END]之前才有效)添加一条TEMPLATE, 我是首先copy一条AMSart的TEMPLATE然后修改成这个样子:
TEMPLATE="CTeX: Article" MODE="TeX" NAME="" EXTENSION=".tex" FILE_TEMPLATE="%B\Templates\Doc\Chinese_template.tex" BEFORE_MACRO="" AFTER_MACRO="[NextBullet;ScreenCenterLine;]"
其中只有两处需要对应修改, 一是TEMPLATE="CTeX: Article", 这里CTeX: Article可以修改在新建Document时的显示名字。二是FILE_TEMPLATE="%B\Templates\Doc\Chinese_template.tex" 这里Chinese_template.tex 是我的模板名,你可能需要更改成你在之前copy的到Doc下的模板文件名。
最后附上我的模板文件源码
\documentclass[12pt, hyperref]{ctexart}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%常用宏包%%
%%%%%%%%%%%%
%保留中英文之间的空格
\usepackage{CJKspace}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[a4paper, margin=1in, includeheadfoot]{geometry}
%%交换图
%\usepackage[all,cmtip]{xy}
%%列表
\usepackage{enumerate}
\usepackage{enumitem}
\setlist[enumerate,1]{label={\normalfont(\alph*)}}
\usepackage{graphicx}
\usepackage{caption}
%去掉图1:后冒号
\DeclareCaptionLabelSeparator{twospace}{\ ~}
\captionsetup{labelsep=twospace}
%%列出引用标签, final表示在最终版本中不显示
\usepackage[notref,notcite, final]{showkeys}
%%参考文献排序
\usepackage{cite}
%%参考文献合并到正文
\usepackage{filecontents}
%%超链接, ocgcolorlinks选项表示打印自动是黑白的
\usepackage[ocgcolorlinks]{hyperref}
%%设置书签
\hypersetup{%
pdfstartview=FitH,
bookmarksopen=false,
colorlinks=true,
linkcolor=blue,
pdfinfo={
Title={},%Input your title here
Subject={},%Input your subject
Author={},%Your name
Keywords={},%Your keywords%
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%常用设置%%
%%%%%%%%%%%%
\newtheorem{defn}{定义}[section]
\newtheorem{thm}[defn]{定理}
\newtheorem{lem}[defn]{引理}
\newtheorem{cor}[defn]{推论}
\newtheorem{prop}[defn]{命题}
\newtheorem*{rem}{注记}
%%以节编号
\numberwithin{equation}{section}
%%重定义公式写法
\newenvironment{eq}{\equation}{\endequation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%自定义命令%%
%%%%%%%%%%%%%%
%变小复合函数的圈
\newcommand{\comp}{\raisebox{1pt}{\scalebox{.7}{$\circ$}}}
%%集合
\newcommand{\set}[1]{\left\{#1\right\}}
%%偏导
\newcommand{\pt}{\partial}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%参考文献数据%%
%%%%%%%%%%%%%%%%
%%这里放入google导入的参考文献数据库, 编译需多用一次biblatex
\begin{filecontents}{\jobname.bib}
@book{lebesgue2003leccons,
title={Le{\c{c}}ons sur l'int{\'e}gration et la recherche des fonctions primitives},
author={Lebesgue, Henri},
volume={267},
year={2003},
publisher={AMS Bookstore}
}
@article{shoen1976harmonic,
title={Harmonic maps and the topology of stable hypersurfaces and manifolds with non-negative Ricci curvature},
author={Shoen, Richard and Yau, Shing Tung},
journal={Commentarii Mathematici Helvetici},
volume={51},
number={1},
pages={333--341},
year={1976},
publisher={Springer}
}
\end{filecontents}
\title{文章题目}
\author{你的名字\&合作者}
\date{\today}
%%合作者地址写法
\newcommand{\Addresses}{{% additional braces for segregating \footnotesize
\bigskip
\footnotesize
R.~Campbell, \textsc{Department of Mathematics, Pennsylvania State University,
Pittsburgh, Pennsylvania 13593}\par\nopagebreak
\textit{E-mail address}, R.~Campbell: \texttt{[email protected]}\\
\medskip
M.~Dane (Corresponding author), \textsc{Atmospheric Research Station,
Pala Lundi, Fiji}\par\nopagebreak
\textit{E-mail address}, M.~Dane: \texttt{DaneMark@@ffr.choice}
}}
\begin{document}
\maketitle
\section{如何使用Ctex写中文}
写中文最简单的办法就是使用 \verb|\documentclass{ctexart}| 了.
\subsection{定理环境使用}
\begin{thm}[勾股定理]
假设$a,b,c$是直角三角形的三边长, 且$c$为斜边长. 则
\begin{eq}\label{eq:1}
a^2+b^2=c^2.
\end{eq}
公式\eqref{eq:1}就称为勾股定理.
\end{thm}
\section{参考文献的示例}
这是引用\cite{shoen1976harmonic,lebesgue2003leccons}
%%参考文献
\bibliographystyle{plain}
\bibliography{\jobname}
%input “this file name.bib”
%%输出作者地址
\Addresses
\end{document}
本作品采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循署名-非商业用途-保持一致的创作共用协议.

发表回复