How to write latex:

First go to sharelatex.com. Create an account and start doing yo thang.

Do not download the thing to your computer. Nightmare.

Quick mathjax syntax for markdown.

Inside text

$$

Free centerpiece

$$

Nice simple snippets.

Index

  1. General functions
  2. \something
  3. something

No indent

\noindent

or

\setlength\parindent{0pt}

Today Set title to:

\title{\today}

So if you’r working on a project for a long time you don’t have to update the date everyday.

legend

legend(c("bottomright"),legend=c("Group1","Group2","Group3"),lwd=c(2.5,2.5),col=c("red","green","blue"))

Distribution sign in latex

$X \sim N(\mu,\sigma^2)$

\sim

<a name”matrix”>Matrix</a>

\left[\begin{array}[ccc]
  0 & 1 & 2 \\
  3 & 4 & 5 \\
  6 & 7 & 8
\end{array}\right]

\(\left[\begin{array}[cc]\\ 2 & 2 \\ 3 & 4\\ 6 & 7 \end{array}\right]\)

$\frac{1}{2}$

Code code

\begin{lstlisting}[language = R]
[1] "mean error test:" "1.46934685949842"
[1] "mean error train:" "2.38344678143766"
[1] "mean error test:" "1.44979433585936"
[1] "mean error train:" "2.47167748969558"
\end{lstlisting}

Really nice way to include code in you latex document

Include images

\begin{figure}[H]
\centering
\title{}
\includegraphics[scale= 0.5]{filename}
\end{figure}

Conditional function

    X=
\begin{cases}
    1,& \text{if happy} \\
    0,& \text{if super happy}
\end{cases}

\(X= \begin{cases} 1,& \text{if happy} \\ 0, & \text{if super happy} \end{cases}\)

Tabels

\begin{table}[H]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{lll}
  & 0  & 1  \\
0 & 40 & 10 \\
1 & 12 & 18
\end{tabular}
\end{table}

Note: change the number of “l” to the number of columns in your table. \(\begin{table}[H] \centering \caption{My caption} \label{my-label} \begin{tabular}{lll} 0 & 0 & 1 \\ 0 & 40 & 10 \\ 1 & 12 & 18 \end{tabular} \end{table}\)

Arrows

$\leftarrow \rightarrow \leftrightarrow$

\rightarrow
\leftarrow
\leftrightarrow