LATEX排版
在剛開始學習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{}就可以寫正文了,
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/243643.html
標籤:其他
上一篇:websphere 類加載策略
下一篇:Linux下MySql安裝
