1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-13 18:24:39 +02:00

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.
This commit is contained in:
Lilian Besson
2021-01-28 18:31:42 +01:00
committed by GitHub
parent e4d44a3771
commit 74b1f3332f

View File

@@ -181,7 +181,9 @@ Summations and Integrals are written with sum and int commands:
\section{Figures} \section{Figures}
Let's insert a figure. Figure placement can get a little tricky. 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. 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. \begin{figure}[H] % H here denoted the placement option.
\centering % centers the figure on the page \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] \begin{table}[H]
\caption{Caption for the Table.} \caption{Caption for the Table.}
% the {} arguments below describe how each row of the table is drawn. % the {} arguments below describe how each row of the table is drawn.
% Again, I have to look these up. Each. And. Every. Time. % The basic is simple: one letter for each columns, to control alignment:
\begin{tabular}{c|cc} % 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 & Number & Last Name & First Name \\ % Column rows are separated by &
\hline % a horizontal line \hline % a horizontal line
1 & Biggus & Dickus \\ 1 & Biggus & Dickus \\
2 & Monty & Python 2 & Monty & Python
\end{tabular} \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} \end{table}
\section{Getting \LaTeX{} to not compile something (i.e.\ Source Code)} \section{Getting \LaTeX{} to not compile something (i.e.\ Source Code)}
@@ -218,7 +228,8 @@ environment.
\begin{verbatim} \begin{verbatim}
print("Hello World!") print("Hello World!")
a%b; % look! We can use % signs in verbatim. 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} \end{verbatim}
\section{Compiling} \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 references (like Eqn.~\ref{eq:pythagoras}), you may need to run Step 2
multiple times, to generate an intermediary *.aux file.}. multiple times, to generate an intermediary *.aux file.}.
% Also, this is how you add footnotes to your document! % 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. 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 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 This package also produces list of thumbnails in the output pdf document and
active links in the table of contents. 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} \section{End}
That's all for now! That's all for now!