-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tex
More file actions
160 lines (119 loc) · 4.09 KB
/
main.tex
File metadata and controls
160 lines (119 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
\documentclass{article}
% replace this with your conference style file
\usepackage{fullpage}
% to increase the number of fonts can be used
\newcommand\hmmax{0}
\newcommand\bmmax{0}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{nicefrac} % compact symbols for 1/2, etc.
% for proofs
\usepackage[conf={normal}]{proof-at-the-end}
\newtheorem{thm}{Theorem}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
% use biblatex; it's 21 century!
% feel free to change some options
\usepackage[backend=biber,maxbibnames=5,style=numeric,maxcitenames=2,backref=false,uniquelist=false,uniquename=false,sorting=none,defernumbers=true,noerroretextools=true]{biblatex}
\usepackage{csquotes}
% change this to your bibfile
\addbibresource{main.bib}
% in case someone is used to natbib
\newcommand{\citep}{\parencite}
\newcommand{\citet}{\textcite}
\usepackage{xcolor}
\usepackage[colorlinks,linkcolor=black,citecolor=black,urlcolor=magenta,bookmarks=true]{hyperref}
% for easy cross-reference
\usepackage{cleveref}
% for better tables
\usepackage{booktabs}
% for controlling margins in enumerate/itemize
\usepackage{enumitem}
\usepackage{xspace}
\usepackage{graphicx,multirow}
% all figures go to the dedicated folder "figs"
\graphicspath{{figs/}}
% to draw pretty figures
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,shadows,positioning,fadings,calc,shapes,fit}
\usepackage{pgfplots}
% allow equations to be numbered only when necessary
% it is actually a good practice to number every equation (for the reader's sake)
\let\etoolboxforlistloop\forlistloop % save the good meaning of \forlistloop
\usepackage{autonum}
\let\forlistloop\etoolboxforlistloop % restore the good meaning of \forlistloop
% algorithm
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\crefname{algocf}{algorithm}{algorithms}
\Crefname{algocf}{Algorithm}{Algorithms}
% if do not wish to number algorithms
%\renewcommand{\thealgocf}{}
% use todonotes for comments
\usepackage{todonotes}
\newcommand{\todoy}[2][]{\todo[size=\tiny,color=green!20!white,#1]{YY: #2}\xspace}
% define your own commands
\newcommand{\lb}{\mathtt{lb}}
\newcommand{\ub}{\mathtt{ub}}
\newcommand{\med}{\mathtt{med}}
\newcommand{\mi}{\mathtt{maxiter}}
\newcommand{\tol}{\mathtt{tol}}
\newcommand{\Fsf}{\mathsf{F}}
\title{How to write a \LaTeX\ draft}
\author{Yaoliang Yu}
\date{July 2020}
\begin{document}
\maketitle
\begin{abstract}
This is a sample \LaTeX\ file.
\end{abstract}
\section{Conventions}
\begin{itemize}[itemsep=0pt,topsep=0pt,leftmargin=*]
\item Figures and tables usually are placed at the top of each page. Ocassionally at the bottom.
\item Figure captions placed under the figure.
\item Table captions placed above the table. Some conferences do the opposite.
\end{itemize}
% change the option to [t] to place alg on top
\begin{algorithm}[H]
\DontPrintSemicolon
\KwIn{$u\in(0,1), \lb \leq \ub, \mi, \tol$}
\KwOut{$x$ such that $|\Fsf(x) - u| \leq \tol$}
\While{$\Fsf(\lb) > u$}{
$\ub \gets \lb$
$\lb \gets \lb /2$
}
\While{$\Fsf(\ub) < u$}{
$\lb \gets \ub$
$\ub \gets \ub * 2$
}
\For{$i=1, \ldots, \mi$ }{
$x \gets \tfrac{\lb+\ub}{2}$
$t \gets \Fsf(x)$
\If{ $t > u$}{$\ub \gets x$}
\Else{$\lb \gets x$}
\If{$ |t - u| \leq \tol $}{\textbf{break}}
}
\caption{Binary search for solving a monotonic nonlinear equation $\Fsf(x) = u$.}
\label{alg:bs}
\end{algorithm}
Let's cite the above algorithm using \verb|cleveref|: \Cref{alg:bs}.
Let's cite a paper: \parencite{Yu13}.
For writing a longer paper, need to split the main file into:
\begin{verbatim}
\input{introduction}
\input{background}
\input{main results}
\input{experiments}
\input{discussion}
\input{conclusion}
\input{appendix}
\end{verbatim}
To use \verb|proof-at-the-end|,
\begin{theoremEnd}{thm}[Yes I can have a title]
\label{thm:ilikelabels}
Creating a new theorem is easy
\end{theoremEnd}
\begin{proofEnd}
You want a proof? Here is it!
\end{proofEnd}
See the \href{http://ctan.mirror.globo.tech/macros/latex/contrib/proof-at-the-end/proof-at-the-end.pdf}{documentation} about how to toggle proofs (appearing in the main text or appendix).
\printbibliography[title={References}]
\end{document}