User Tools

Site Tools


techs:typesetting:latex-template

My $\LaTeX$ Template

:todo: 未完成,太麻烦了……

General writing preamble

% Page Margin
\usepackage[top=1in, bottom=1in, left=1.25in, right=1.25in]{geometry} % adjust default margins
% Page header and footer
\usepackage{fancyhdr} \pagestyle{fancy} \lhead{PENG, Hao } \chead{\reportNumber} \rhead{Rutgers Univ.} \lfoot{} \cfoot{\thepage} \rfoot{} % setting page header and footer
% Line space
\usepackage{setspace} %\doublespacing \onehalfspacing
 
%----------------------------------------------
 
% 其他常用(注意添加顺序)
\usepackage{graphicx} % incert figures
\usepackage{mathtools} % replacing `amsmath`
\usepackage{amssymb,bm}
\usepackage{color}
 
% break long URL properly
\usepackage[hyphens]{url} %\usepackage{url} \def\UrlBreaks{\do\/\do-}
 
% 超链接添加颜色,取消框
\usepackage[colorlinks=true,linkcolor=red,citecolor=blue,breaklinks=true]{hyperref} % color the hyperlink rather than box it
 
% 超链接到图片顶端 (must be loaded after hyperref)
\usepackage[all]{hypcap} % make the hyperlink to point at the upper border of a figure of table, rather than to point to its caption.
 
% 自动添加引用时的名称 % Eq.~\ref{fig:1} <==> \cref{fig:1}
\usepackage{cleveref} 
	\crefname{equation}{Eq.}{Eqs.} \Crefname{equation}{Equation}{Equations} 
	\crefname{figure}{Fig.}{Figs.} \Crefname{figure}{Figure}{Figures}  
	\crefname{table}{Table}{Tables} \Crefname{table}{Table}{Tables} 
	\crefname{section}{Sec.}{Secs.} \Crefname{section}{Section}{Sections}% allow refer to multiple equations and change cross-reference name
 
%----------------------------------------------
% 图片相关
 
% 控制编译时使用的图片文件位置
\graphicspath{ {./Figures/} }
 
% 自定义图片宽度,方便全局控制
\newlength{\myFigureWidth} \setlength{\myFigureWidth}{0.75\textwidth} % maximum width of all figures, easy to change when \textwidth is changed.
 
% 控制编译时使用的图片文件类型、顺序
\DeclareGraphicsExtensions{.pdf,.png,.eps} % to control the figures used when latex compiles
 
% ??
\usepackage{caption}
 
% 添加子图的几种方法
%\usepackage{subcaption} % 比较新的方法,但是和IEEE,Springer的某些模版存在兼容问题
\usepackage{subfigure} % 比较旧的添加方法,和一些旧的模版可以兼容
 
% 控制图片和表格位置
\usepackage{float} % 限制图片位置,用 \H 固定为当前位置 % 【不推荐】
 
% 控制浮动环境(figure, table, mimipage等)在文章中的位置
\usepackage[section]{placeins} % 使用 \FloatBarrier 可以控制图片在subsection中 % 不推荐使用 [section] 选项,推荐手动添加 \FloatBarrier 控制
 
% 横置图像
\usepackage{pdflscape}
 
%----------------------------------------------
% 表格相关
 
% 更美观的表格 % 用 \toprule \middlerule \bottomrule 代替了 \hline
\usepackage{booktabs}
 
%----------------------------------------------
% 其它
 
% ??
\usepackage[table,xcdraw]{xcolor}
 
% 自定义格式输出时间
\usepackage[yyyymmdd,hhmmss]{datetime}
 
% 自定义缩写时防止后面的空白被吃掉(不常用)
\usepackage{xspace} 
	\xspaceaddexceptions{\}} 
	\newcommand{\Rattle}[0]{\textsf{Rattle}} % 示例:消除后面的空白
 
% ??
\usepackage[open]{bookmark}
 
% 引用代码
\usepackage{listings} 
	\lstset{basicstyle=\small\ttfamily,breaklines=true} % include text as codes
 
%----------------------------------------------
% 不常用的特殊包
%
% insert straight quotation mark
%\usepackage[T1]{fontenc}  % access \textquotedbl
%\usepackage{textcomp}     % access \textquotesingle
%\textquotedbl Liyang\textquotedbl
%\textquotesingle Wang\textquotesingle
 
%%%%%%%%%%%%%%% end of packages collected by Hao Peng %%%%%%%%%%%%%%%
 
 
 
 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%
% 手动排版的一个示例
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% AMOS 2017 format
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 字体
%%\usepackage{mathptmx} % use times new roman for both text and math
%\renewcommand{\rmdefault}{ptm} % use times new roman for only text
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 页边距
%\usepackage[paper=letterpaper, margin=1in]{geometry} % adjust default margins
%%\usepackage{fancyhdr} \pagestyle{fancy} \lhead{}\chead{}\rhead{} \lfoot{}\cfoot{}\rfoot{} % setting page header and footer
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 各级标题
%\usepackage[explicit]{titlesec}
%\usepackage[normalem]{ulem} % this will no redefine em
%\titleformat{\section}{\centering\normalfont\fontsize{10}{0}\bfseries\uppercase}{\thesection.}{1em}{#1}
%\titlespacing*{\section}{0pt}{*2}{*1.5}
%\titleformat{\subsection}{\normalfont\fontsize{10}{0}\bfseries}{\thesubsection.}{0.5em}{\uline{#1}}
%\titlespacing*{\subsection}{0pt}{*2}{*0}
%\titleformat{\subsubsection}{\normalfont\fontsize{10}{0}\bfseries}{\thesubsubsection.}{0.5em}{{#1}}
%\titlespacing*{\subsubsection}{0pt}{*2}{*0}
%\usepackage[parfill]{parskip} % no intend but new line for new paragraph
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 页码
%\pagenumbering{gobble} % no page number
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 细节:参考文献,各种距离
%%\usepackage{etoolbox} \patchcmd{\thebibliography}{\section*{\refname}}{}{}{} % remove `References' % do not work with natbib, (do not know why)
%\usepackage{natbib} \setlength{\bibsep}{1ex} \renewcommand{\bibsection}{} % set line space of references
%\newlength{\myFigureWidth} \setlength{\myFigureWidth}{0.76\textwidth} % maximum width of all figures, easy to change when \textwidth is changed.
%\setlength{\textfloatsep}{12pt plus 2.0pt minus 2.0pt} % set float <-> text space; top or bottom
%\setlength{\intextsep}{12pt plus 2.0pt minus 2.0pt} % set float <-> text space; in-line
%\makeatletter
%\renewcommand{\@biblabel}[1]{#1.} % Change appearance of numeric labels in bibliography 
%\renewcommand{\fnum@figure}{Fig. \thefigure.} % change Figure 1 to Fig.1 in captions
%\renewcommand{\fnum@table}{Tab. \thetable.} % change Figure 1 to Fig.1 in captions
%\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
 
 
 
 
 
 
\begin{document}
 
\maketitle
 
{\footnotesize  [Compiled on \today{} at \currenttime] This line will be removed at the submission.}
 
See codes.
 
 
%\section{Subfigures}
%\begin{figure}[!ht]
%	\centering
%	\newcommand{\ph}[2]{\subfigure[#1]{\includegraphics[width=0.4\textwidth]{#2}}}
%	\makebox[\textwidth][c]{%
%		\ph{$f=0      $}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p0"}%
%		\ph{$f=0.25\pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p25"}%
%		\ph{$f=0.5 \pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p50"} }\\
%	\makebox[\textwidth][c]{%
%		\ph{$f=0.75\pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p75"}%
%		\ph{$f=    \pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p100"}%
%		\ph{$f=1.25\pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p125"} }\\
%	\makebox[\textwidth][c]{%
%		\ph{$f=1.5 \pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p150"}%
%		\ph{$f=1.75\pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p175"}%
%		\ph{$f=2   \pi$}{"Figures/N in 1/Plot_01_M7N3_N_in_1_f0p200"} }
%	\caption{Evolution of the formation configuration from $f=0$ to $2\pi$.}
%	\label{fig:m7n3 MEHalo evolution}
%\end{figure}
 
 
%\section{aaa}
 
 
%\bibliographystyle{}   % Number the references.
%\bibliography{}   % Use references.bib to resolve the labels.
 
\end{document}
techs/typesetting/latex-template.txt · Last modified: 2021/12/10 19:19 by foreverph