Skip to content

Instantly share code, notes, and snippets.

@jwt625
Created November 16, 2016 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwt625/1c3eead541fb76be7a89c5a749fb92a3 to your computer and use it in GitHub Desktop.
Save jwt625/1c3eead541fb76be7a89c5a749fb92a3 to your computer and use it in GitHub Desktop.
personal LaTeX command collection
%%
%% By Jacob (wtjiangthu@gmail.com)
% Department of Physics, THU
% First edited January 1, 2016
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%frequently used head template:
%%%%CTEX:
%!TEX program = xelatex
\documentclass[hyperref, UTF8,
bookmarksnumbered=true]{ctexart}
\hypersetup{
%pdfstartview=FitH,
bookmarksnumbered=true,
bookmarksopen=true,
%colorlinks=false,
pdfborder=001,
%menucolor=green,%uunknown
linktocpage=true,%make the link of the content on the number of page
linkcolor=blue,
anchorcolor=blue,
citecolor=blue}
\usepackage{geometry}
\usepackage{tocbibind}
\usepackage{graphicx,floatrow}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{subfigure}
\usepackage{bm}
%\usepackage{staves} %package for peculiar symbols
\newcommand{\beqt}{ \begin{equation} }
\newcommand{\eeqt}{\end{equation}}
\newcommand{\toprule}{\hline}
\newcommand{\midrule}{\hline\hline}
\newcommand{\bottomrule}{\hline}
\CTEXsetup[number={\chinese{section}}]{section}
\geometry{a4paper,centering,scale=0.8}
\title{}
%\subtitle{}
\author{基科物理32\phantom{ha}蒋文韬\footnote{\href{mailto:jwt13@mails.tsinghua.edu.cn}{jwt13@mails.tsinghua.edu.cn}} \phantom{ha}2013011717
\\ ({ }清华大学 \phantom{ha}物理系,\phantom{ha}北京\phantom{ha}100084 ) }
\bibliographystyle{unsrt}
\begin{document}
\maketitle
\begin{abstract}
\end{abstract}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%command before \begin{doocument}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%packages
%%%%%%%%%
%usually included:
\usepackage{graphicx}
\usepackage{geometry}
%for indexing biblio and adding to content
\usepackage{tocbibind}
%%%math related
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%bold
\usepackage{bm}
%hyperref
\usepackage{hyperref}
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%set hyperlink color to dark-blue
\usepackage{xcolor}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\hypersetup{colorlinks,linkcolor={dark-blue},citecolor={dark-blue},urlcolor={dark-blue}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%if figures or graphs are too many, you can put them in a folder and use
\graphicspath{{folder_name/}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%new command and renew command
%%%%math related
%short for a equation environment
\newcommand{\beqt}{\begin{equation}}
\newcommand{\eeqt}{\end{equation}}
%
%short for a degree symbol
\newcommand{\degree}{$^{\circ}$}
\newcommand{\edeg}{^{\circ}}
%
%%%%
%for tabular generated by excel2latex
\newcommand{\toprule}{\hline}
\newcommand{\midrule}{\hline\hline}
\newcommand{\bottomrule}{\hline}
%
%for small dot before item in environment itemize
\renewcommand{\labelitemi}{$\vcenter{\hbox{\tiny$\bullet$}}$}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%set CTEX style of chapter(for ctexbook)/section/... title
\CTEXsetup[name={(,)}]{chapter}
\CTEXsetup[number={\chinese{section}}]{section}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%set geometry, package geometry needed
\geometry{a4paper,centering,scale=0.8}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%set biblio style
\bibliographystyle{unsrt}
%options: unsrt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%in-text codes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%include pdf
\includepdf{filename.pdf}
%another template
\includepdf[addtotoc={1,section,1,title in toc,cc},pages=1-7,offset=0cm 0.5cm]{*.pdf}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%set line skip
\setlength{\baselineskip}{17pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%输入大写罗马数字20
\uppercase\expandafter{\romannumeral20}
%输入小写罗马数字20
\romannumeral20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%modify length between items
\setlength{\itemsep}{1pt}
\setlength{\parsep}{2pt}
\setlength{\parskip}{2pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%add graph
\begin{figure}[!h]
\centering
%width can be changed
\includegraphics[width=4in]{fileName.fileFormat}
\caption{some caption}
\label{pic:some_label}
\end{figure}
%
%add two or more graphs side by side
\begin{figure}[!h]
\begin{minipage}[b]{0.45\textwidth}
\centering
\includegraphics[width=3in]{fileName.fileFormat}
\caption{some caption}
\label{pic:some_label}
\end{minipage}%
\hspace{0.1\textwidth}%
\begin{minipage}[b]{0.45\textwidth}
\centering
\includegraphics[width=3in]{fileName2.fileFormat}
\caption{some caption2}
\label{pic:some_label2}
\end{minipage}
\end{figure}
%
%add two sub graph side by side
%please search for subfigure
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%add table
\begin{table}[!h]
\centering
\caption{caption}
\begin{tabular}{|c|...}
%data here
\end{tabular}%
\label{tab:label}%
\end{table}%
%
%add two table side by side
\begin{table}[!h]
\begin{floatrow}
\ttabbox{\caption{caption1}}{%
\begin{tabular}{|c|...}
%data here
\end{tabular}%
\label{tab:label1}%
}
%\hspace{0.2\textwidth}%
\ttabbox{\caption{caption2}}{%
\begin{tabular}{|c|...}
%data here
\end{tabular}%
\label{tab:label2}%
}
\end{floatrow}
\end{table}%
%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment