Latex basic

LaTeX basic usages. takeaways from Luke Smith’s Latex tutorial

Basic Structure

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
\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

1
2
3
4
5
\begin{enumerate}
    \item item1
    \item item2 
    \item item3
\end{enumerate}

No-number

1
2
3
4
5
\begin{itemize}
    \item item1
    \item item2 
    \item item3
\end{itemize}

Fonts and Quotations

1
2
3
4
5
6
7
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

1
\usepackage{graphicx}

Basic usage

1
\includegraphics[paras]{test.png}

Figures figures are numbered. can add captions

1
2
3
4
5
\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.

1
2
3
4
5
6
7
\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:

1
2
3
\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

1
2
3
4
5
6
7
\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

1
2
3
4
5
6
@book{test,
        author = "LASTNAME, FirstName",
        title  = "A book",
        year   = "2021",
        publisher = "XXX Verlag"
      }

note: test is the reference id

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
\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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17

\documentclass[twocolumn]{article}

\usepackage{blindtext}
\begin{document}
\twocolumn

\blindtext

\blindtext

\blindtext

\onecolumn
\blindtext

\end{document}

Macro

1
\newcommand{\commandName}[Paras]{what to do}
May 4, 2021


[+] click to leave a comment [+]
the comment system on this blog works via email. The button
below will generate a mailto: link based on this page's url 
and invoke your email client - please edit the comment there!

[optional] even better, encrypt the email with my public key

- don't modify the subject field
- specify a nickname, otherwise your comment will be shown as   
  anonymous
- your email address will not be disclosed
- you agree that the comment is to be made public.
- to take down a comment, send the request via email.

>> SEND COMMENT <<




Fun with Image Maps and SVGs via benji February 20, 2024

Over the past few weeks I've been playing around with making some images on my website interactive. My "informatics" class in high school taught us some basic HTML. By basic I mean in notepad and writing everything by hand, saving to a...

Goblin Week 2024 via Helvetica Blanc January 26, 2024

It snuck up on me, but I managed to draw my little goblins to celebrate the week! I love my children - they're like awful Pikmin. I've uploaded the whole parade as a print, as well as individual prints for each goblin. There's something very fu…

How to trust gpg keys via Travis Shears Personal Site October 27, 2023

After moving some GPG keys to a new computer I kept getting these trust warnings. It is NOT certain that the key belongs to the person named in the user ID.If you * really * know what you are doing, you may answer the next question with yes. Use this key a…

Generated by openring from webring