Created
October 29, 2024 16:59
-
-
Save pmuens/be4095cec1d47fce35ca32d4242e8557 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% Code written while following https://www.overleaf.com/learn/latex/Learn_LaTeX_in_30_minutes | |
% | |
\documentclass[12pt, letterpaper]{article} | |
\title{My first LaTex document} | |
\author{Philipp Muens\thanks{Funded by X.}} | |
\date{\today} | |
\usepackage{amsmath} | |
\usepackage{graphicx} | |
\graphicspath{{images/}} | |
\begin{document} | |
\maketitle | |
\tableofcontents | |
\begin{abstract} | |
This is a simple paragraph at the beginning of the document. A brief introduction about the main subject. | |
\end{abstract} | |
\section{Introduction} | |
This is the first section. | |
Lorem ipsum dolor sit amet, consectetuer adipiscing | |
elit. Etiam lobortisfacilisis sem. Nullam nec mi et | |
neque pharetra sollicitudin. Praesent imperdietmi nec ante. | |
Donec ullamcorper, felis non sodales... | |
\section{Second Section} | |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. | |
Etiam lobortis facilisissem. Nullam nec mi et neque pharetra | |
sollicitudin. Praesent imperdiet mi necante... | |
\subsection{First Subsection} | |
Praesent imperdietmi nec ante. Donec ullamcorper, felis non sodales... | |
\section*{Unnumbered Section} | |
\addcontentsline{toc}{section}{Unnumbered Section} | |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. | |
Etiam lobortis facilisissem... | |
After our abstract we can begin the first paragraph, then press ``enter'' twice to start the second one. | |
This line will start a second paragraph. | |
I will start the third paragraph and then add \\ a manual line break which causes this text to start on a new line but remains part of the same paragraph. Alternatively, I can use the \verb|\newline|\newline command to start a new line, which is also part of the same paragraph. | |
We have now added a title, author and date to our first \LaTeX{} document! | |
% This line here is a comment. It will not be typeset in the document. | |
Some of the \textbf{greatest} discoveries in \underline{science} were made by \textbf{\textit{accident}}. | |
Some of the greatest \emph{discoveries} in science were mad by accident. | |
\textit{Some of the greatest \emph{discoveries} in science were made by accident.} | |
\textbf{Some of the greatest \emph{discoveries} in science were made by accident.} | |
The universe is immense and it seems to be homogenous, on a large scale, everywhere we look. | |
\begin{figure}[h] | |
\centering | |
\includegraphics[width=0.75\textwidth]{universe} | |
\caption{The universe.} | |
\label{fig:universe1} | |
\end{figure} | |
There's a picture of a galaxy above. | |
As you can see in figure \ref{fig:universe1}, there's a universe. This example is on page \pageref{fig:universe1}. | |
\begin{itemize} | |
\item The individual entries are indicated with a black dot, so-called bullet. | |
\item The next in the entries may be of any length. | |
\end{itemize} | |
\begin{enumerate} | |
\item This is the first entry in our list. | |
\item The list numbers increase with each entry we add. | |
\end{enumerate} | |
In physics, the mass-energy equivalence is stated by the equation $E=mc^2$, discovered in 1905 by Albert Einstein. | |
\begin{math} | |
E=mc^2 | |
\end{math} is typeset in a paragraph using inline math mode ---as is $E=mc^2$, and so too is \(E=mc^2\). | |
The mass-energy equivalence is described by the famous equation \[ E=mc^2 \] discovered in 1905 by Albert Einstein. | |
In natural units ($c = 1$), the formula expresses the identity | |
\begin{equation} | |
E=m | |
\end{equation} | |
Subscripts in math mode are written as $a_b$ and superscripts are written as $a^b$. These can be combined and nested to write expressions such as | |
\[ T^{i_1 i_2 \dots i_p}_{j_1 j_2 \dots j_q} = T(x^{i_1},\dots,x^{i_p},e_{j_1},\dots,e_{j_q}) \] | |
We write integrals using $\int$ and fractions using $\frac{a}{b}$. Limits are placed on integrals using superscripts and subscripts: | |
\[ \int_0^1 \frac{dx}{e^x} = \frac{e-1}{e} \] | |
Lower case Greek letters are written as $\omega$ $\delta$ etc. while upper case Greek letters are written as $\Omega$ $\Delta$. | |
Mathematical operators are prefixed with a backslash as $\sin(\beta)$, $\cos(\alpha)$, $\log(x)$ etc. | |
\section{First example} | |
The well-known Pythagorean theorem \(x^2 + y^2 = z^2\) was proved to be invalid for other exponents, meaning the next equation has no integer solutions for \(n>2\): | |
\[ x^n + y^n = z^n \] | |
\section{Second example} | |
This is a simple math expression \(\sqrt{x^2+1}\) inside text. | |
And this is also the same: | |
\begin{math} | |
\sqrt{x^2+1} | |
\end{math} | |
but by using another command. | |
This is a simple math expression without numbering | |
\[\sqrt{x^2+1}\] | |
separated from text. | |
This is also the same: | |
\begin{displaymath} | |
\sqrt{x^2+1} | |
\end{displaymath} | |
\ldots and this: | |
\begin{equation*} | |
\sqrt{x^2+1} | |
\end{equation*} | |
\begin{center} | |
\begin{tabular}{c c c} | |
cell1 & cell2 & cell3 \\ | |
cell4 & cell5 & cell6 \\ | |
cell7 & cell8 & cell9 | |
\end{tabular} | |
\end{center} | |
\begin{center} | |
\begin{tabular}{|c|c|c|} | |
\hline | |
cell1 & cell2 & cell3 \\ | |
cell4 & cell5 & cell6 \\ | |
cell7 & cell8 & cell9 \\ | |
\hline | |
\end{tabular} | |
\end{center} | |
\begin{center} | |
\begin{tabular}{||c c c c||} | |
\hline | |
Col1 & Col2 & Col2 & Col3 \\ [0.5ex] | |
\hline\hline | |
1 & 6 & 87837 & 787 \\ | |
\hline | |
2 & 7 & 78 & 5415 \\ | |
\hline | |
3 & 545 & 778 & 7507 \\ | |
\hline | |
4 & 545 & 18744 & 7560 \\ | |
\hline | |
5 & 88 & 788 & 6344 \\ [1ex] | |
\hline | |
\end{tabular} | |
\end{center} | |
Table \ref{table:data} shows how to add a table caption and reference a table. | |
\begin{table}[h!] | |
\centering | |
\begin{tabular}{||c c c c||} | |
\hline | |
Col1 & Col2 & Col2 & Col3 \\ [0.5ex] | |
\hline\hline | |
1 & 6 & 87837 & 787 \\ | |
2 & 7 & 78 & 5415 \\ | |
3 & 545 & 778 & 7507 \\ | |
4 & 545 & 18744 & 7560 \\ | |
5 & 88 & 788 & 6344 \\ [1ex] | |
\hline | |
\end{tabular} | |
\caption{Table to test captions and labels.} | |
\label{table:data} | |
\end{table} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment