summaryrefslogtreecommitdiffhomepage
path: root/latex.html.markdown
diff options
context:
space:
mode:
authorLilian Besson <Naereen@users.noreply.github.com>2021-01-28 18:31:42 +0100
committerGitHub <noreply@github.com>2021-01-28 18:31:42 +0100
commit74b1f3332f476d1898d85e2c1fa723c0c7a63d1f (patch)
tree850203f62540b3250107e74d0429840a4244fbc9 /latex.html.markdown
parente4d44a37712bfde3862b0afc59bff7e1594ef60e (diff)
Add some explanations for: floats, tables, and non-ASCII input
It bothered me that the document contained - I definitely have to lookup the placement options each time. - % Again, I have to look these up. Each. And. Every. Time. So I added a few lines to explain the most basic options of float positions and tables layout. It's really not that magical, at least for the basic options (and they are enough, [I wrote a 300 page thesis](https://perso.crans.org/besson/phd.pdf) with almost no need for any other options except the one introduced here) I also added a last short section about using LaTeX to display non-ASCII symbols (like French ç with \,c) or writing in non-ASCII input. I think it's mandatory to include this, as most LaTeX users are *not* native English speakers. I mentioned LuaTeX and XeLaTeX, just to give their names.
Diffstat (limited to 'latex.html.markdown')
-rw-r--r--latex.html.markdown39
1 files changed, 36 insertions, 3 deletions
diff --git a/latex.html.markdown b/latex.html.markdown
index 49200968..98abc5a1 100644
--- a/latex.html.markdown
+++ b/latex.html.markdown
@@ -181,7 +181,9 @@ Summations and Integrals are written with sum and int commands:
\section{Figures}
Let's insert a figure. Figure placement can get a little tricky.
+Basic options are [t] for top, [b] for bottom, [h] for here (approximately).
I definitely have to lookup the placement options each time.
+% See https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions for more details
\begin{figure}[H] % H here denoted the placement option.
\centering % centers the figure on the page
@@ -198,13 +200,21 @@ We can also insert Tables in the same way as figures.
\begin{table}[H]
\caption{Caption for the Table.}
% the {} arguments below describe how each row of the table is drawn.
- % Again, I have to look these up. Each. And. Every. Time.
- \begin{tabular}{c|cc}
+ % The basic is simple: one letter for each columns, to control alignment:
+ % basic options are: c, l, r and p for centered, left, right and paragraph
+ % optionnally, you can add a | for a vertical line
+ % See https://en.wikibooks.org/wiki/LaTeX/Tables for more details
+ \begin{tabular}{c|cc} % here it means "centered | vertical line, centered centered"
Number & Last Name & First Name \\ % Column rows are separated by &
\hline % a horizontal line
1 & Biggus & Dickus \\
2 & Monty & Python
\end{tabular}
+ % it will approximately be displayed like this
+ % Number | Last Name First Name
+ % -------|--------------------------- % because of \hline
+ % 1 | Biggus Dickus
+ % 2 | Monty Python
\end{table}
\section{Getting \LaTeX{} to not compile something (i.e.\ Source Code)}
@@ -218,7 +228,8 @@ environment.
\begin{verbatim}
print("Hello World!")
a%b; % look! We can use % signs in verbatim.
- random = 4; #decided by fair random dice roll
+ random = 4; #decided by fair random dice roll, https://www.xkcd.com/221/
+ See https://www.explainxkcd.com/wiki/index.php/221:_Random_Number
\end{verbatim}
\section{Compiling}
@@ -244,6 +255,7 @@ Step 2 is still happening behind the scenes\footnote{In cases, where you use
references (like Eqn.~\ref{eq:pythagoras}), you may need to run Step 2
multiple times, to generate an intermediary *.aux file.}.
% Also, this is how you add footnotes to your document!
+% with a simple \footnote{...} command. They are numbered ¹, ², ... by default.
You write all your formatting information in plain text in Step 1.
The compilation part in Step 2 takes care of producing the document in the
@@ -265,6 +277,27 @@ There exists two main types of links: visible URL \\
This package also produces list of thumbnails in the output pdf document and
active links in the table of contents.
+\section{Writing in ASCII or other encodings}
+
+By default, historically LaTeX accepts input which are pure ASCII,
+meaning without accents (à, è etc) and non-latin symbols.
+
+It is easy to incert accents and basic latin symbols, with backslash shortcuts
+Like \,c, \'e, \`A, \ae and \oe etc. % for ç, é, À, etc
+% See https://en.wikibooks.org/wiki/LaTeX/Special_Characters#Escaped_codes for more
+
+To write directly in UTF-8, when compiling with pdflatex, use
+\begin{verbatim}
+ \usepackage[utf8]{inputenc}
+\end{verbatim}
+The selected font has to support the glyphs used for your document, you have to add
+\begin{verbatim}
+ \usepackage[T1]{fontenc}
+\end{verbatim}
+
+Not that there also exists LuaTeX and XeLaTeX that were designed to have builtin
+support for UTF-8 and case ease your life if you don't write in a latin alphabet.
+
\section{End}
That's all for now!