在刚开始学习Latex的时候为了找到一个合适的中文模板费劲了心思,在这里给大家分享我现在在用的Latex模板。
\documentclass[a4paper,11pt,onecolumn,twoside]{
article}
\usepackage{
fancyhdr} %页眉页脚宏包
\usepackage{
ctex}
\usepackage{
xcolor}
\usepackage{
colortbl,booktabs}
\usepackage{
listings}
\usepackage{
multicol}
\usepackage{
picins}
\usepackage{
amsmath}
\usepackage{
indentfirst}
\usepackage{
subfig}
\usepackage{
appendix}
\usepackage{
amsthm}
\usepackage[left=1.7cm,right=1.7cm,top=1in,bottom=1in]{
geometry}
\definecolor{
light-gray}{
gray}{
0.92}
%\lstset{
language=C}%代码语言抄使用的是matlab
%\lstset{
breaklines}%自动将长的代码行换行排版
%\lstset{
extendedchars=false}%解决代码跨页时,章节标题,页眉等汉字不显示的问题
\lstset{
%
%alsolanguage=Java,
%language={
[ISO]C++}, %language为,还有{
[Visual]C++}
alsolanguage=[ANSI]C, %可以添加很多个alsolanguage,如alsolanguage=matlab,alsolanguage=VHDL等
%alsolanguage= tcl,
alsolanguage= XML,
tabsize=4, %
commentstyle=\color{
red!50!green!50!blue!50},%浅灰色的注释
showstringspaces=false,%不显示代码字符串中间的空格标记
stringstyle=\ttfamily, % 代码字符串的特殊格式
keepspaces=true, %
breakindent=22pt, %
numbers=none,%左侧显示行号 往左靠,还可以为right,或none,即不加行号
%numberstyle=\tiny, %行号字体用小号
numberstyle={
\color[RGB]{
0,192,192}\tiny}
basicstyle=\footnotesize, % 这句设置代码的大小
showspaces=false, %
flexiblecolumns=true, %
breaklines=true, %对过长的代码自动换行
breakautoindent=true,%
breakindent=4em, %
aboveskip=0.1em, %代码块边框
tabsize=1,
showstringspaces=false, %不显示字符串中的空格
backgroundcolor=\color[RGB]{
245,245,244}, %代码背景色
%backgroundcolor=\color[rgb]{
0.91,0.91,0.91} %添加背景色
escapeinside={
(*@}{
@*)}, %在``里显示中文
%% added by http://bbs.ctex.org/viewthread.php?tid=53451
fontadjust,
captionpos=t,
framextopmargin=2pt,framexbottommargin=2pt,abovecaptionskip=-3pt,belowcaptionskip=3pt,
texcl=true,
% 设定中文冲突,断行,列模式,数学环境输入,listing数字的样式
extendedchars=false,columns=flexible,mathescape=true
% numbersep=-1em
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% lengths
% 下面的命令重定义页面边距,使其符合中文刊物习惯。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\addtolength{
\topmargin}{
0pt}
\setlength{
\oddsidemargin}{
-0.9cm} % 3.17cm - 1 inch
\setlength{
\evensidemargin}{
\oddsidemargin}
\setlength{
\textwidth}{
17cm}
\setlength{
\textheight}{
24cm} % 24.62
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{
\baselinestretch}{
1.1} %定义行间距
\parindent 22pt %重新定义缩进长度
%定义题目和作者信息
\title{
\huge{
Latex模板实例}}
%这是脚注\thanks{
收稿日期:~XXXX$-$XX$-$XX. %基金项目:国家自然科学基金资助项目~(51685168)}}
\author{
goooooodream\\[2pt]
\normalsize
电子科学与工程学院 \\[2pt]}
\date{
} % 这一行用来去掉默认的日期显示
\fancypagestyle{
plain}{
\fancyhf{
}
\lhead{
2020~年~5~月~30~日} % 这是页眉的左边
%\scriptsize{
XXXX~年~XX~月}}
\chead{
\centering{
Latex~~设~~计~~报~~告
}} %可以通过\textbf命令来设置下方的英文字体(如果用英文的话)
\rhead{
Page:~~\thepage}
%\scriptsize{
October, 2004}}
\lfoot{
}
\cfoot{
}
\rfoot{
} %这应该是显示页脚的
}
\pagestyle{
fancy}
\fancyhf{
}
\fancyhead[OR,EL]{
Page:~~\thepage}
\fancyhead[OC]{
\centering{
Latex~~设~~计~~报~~告
}}
\fancyhead[EC]{
\centering{
《Latex设计报告》}}
\fancyhead[OL,ER]{
2020~年~12~月}
\lfoot{
}
\cfoot{
}
\rfoot{
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 正文两栏环境不允许float环境,比如 figure, table。所以重新定义
% figure,使之可以浮动到你想要的位置。table也同样,把figure改为
% table就可以。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newenvironment{
figurehere}
% {
\def\@captype{
figure}}
% {
}
%\makeatother 双栏排版会用到(图片)
\renewcommand{
\figurename}{
图}
\renewcommand{
\tablename}{
表}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 文章正文
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{
document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 此行使文献引用以上标形式显示
%\newcommand{
\supercite}[1]{
\textsuperscript{
\cite{
#1}}}
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 中文摘要
% 调整摘要、关键词,中图分类号的页边距
% 中英文同时调整
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{
\oddsidemargin}{
1cm} % 3.17cm - 1 inch
\setlength{
\textwidth}{
13.50cm}
\vspace{
-.8cm}
\begin{
center}
\parbox{
\textwidth}{
\heiti{
摘~~~要}\quad \kaishu{
~这是摘要摘要要要要~~~~~~}\\
\heiti{
关键词}\quad %quad命令是留出当前字体下的一个汉字的空格
\kaishu{
Latex;中文模板}\\
%\heiti{
中图分类号\quad TG9527}\qquad
%\heiti{
文献标识码}\quad A
}
\end{
center}
% 文章编号(左上角)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{
minipage}[c]{
10cm}
\vspace{
-35.5cm}
\end{
minipage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 恢复正文页边距
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{
\oddsidemargin}{
-.5cm} % 3.17cm - 1 inch
\setlength{
\evensidemargin}{
\oddsidemargin}
\setlength{
\textwidth}{
17.00cm}
% 正文由此开始-------------------------
将上述代码加入Latex中就可以添加\section{}就可以写正文了。