Latex basic
LaTeX basic usages. takeaways from Luke Smith’s Latex tutorial
Basic Structure
\documentclass{article}
\author{Emmanuel Blyatstein}
\title{This is a title}
\begin{document}
\section{section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\section{section 2}
\end{document}
Numbered Lists
\begin{enumerate}
\item item1
\item item2
\item item3
\end{enumerate}
No-number
\begin{itemize}
\item item1
\item item2
\item item3
\end{itemize}
Fonts and Quotations
This is normal.
\textbf{this is bold}
\textit{this is italic.}
\emph{this is emphatic.}
\underline{this is underline}
``This is a quot''
`this is a single quot'
Labels and references:
\section{something \label{som}}
I'm using ref to \ref{som}
the numbering of \ref and \label will match when the article structure changes.
Images & Figures
\usepackage{graphicx}
Basic usage
\includegraphics[paras]{test.png}
Figures figures are numbered. can add captions
\begin{figure}
\centering
\includegraphics[width=0.7\textwidth]{fig/LeNet.png}
\caption{this is a figure}
\end{figure}
Figure Positioning:
by default latex put figures where it’s most space-efficient
-
\begin{figure}[h]
puts the figure exactly where this line of source code is. -
\begin{figure}[t]
puts the figure on page top. -
\begin{figure}[b]
puts the figure on page bottom.
paras e.g.
\begin{center}
\includegraphics[width=3in,height=5in,keepaspectratio]{fig/aaa.png}
\end{center}
\begin{center}
\includegraphics[width=\textwidth]{fig/xxx.png}
\end{center}
Wrapping package:
usepackage{wrapfig}
Usage:
\begin{wrapfigure}{r}{3in}
\includegraphics[width=2.5in]{fig/ActivationMap.png}
\end{wrapfigure}
Paras:
{r}
place on the right{3in}
width of the wrap area (not the figure width)
Figure Label and Refs
\begin{figure}
\centering
\includegraphics{fig/LeNet.png}
\caption{this is a figure \label{t1}}
\end{figure}
please refer to figure \ref{t1}
Bibliographies managements
in file library.bib
@book{test,
author = "LASTNAME, FirstName",
title = "A book",
year = "2021",
publisher = "XXX Verlag"
}
note: test
is the reference id
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{library.bib}
\begin{document}
\textcite{test} says fuck
this is a parencite \parencite{test}
\printbibliography
\end{document}
TWO-Column Articles:
\documentclass[twocolumn]{article}
\usepackage{blindtext}
\begin{document}
\twocolumn
\blindtext
\blindtext
\blindtext
\onecolumn
\blindtext
\end{document}
Macro
\newcommand{\commandName}[Paras]{what to do}