diff options
author | Marcel Ribeiro Dantas <ribeirodantasdm@gmail.com> | 2022-06-27 00:28:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 00:28:16 +0200 |
commit | 5d133e847846b4c8d436f7a567674c2e1df35a13 (patch) | |
tree | 7ebc7704f02ceef195a8896a80a06ed81cc12585 /latex.html.markdown | |
parent | 27f7f03401ff747a61a912fdf73549b1788b13e1 (diff) | |
parent | 8f28c8021b8ce3cb791861ad19c41e12228d8bcd (diff) |
Merge branch 'master' into patch-1
Diffstat (limited to 'latex.html.markdown')
-rw-r--r-- | latex.html.markdown | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/latex.html.markdown b/latex.html.markdown index 49200968..34c4b78d 100644 --- a/latex.html.markdown +++ b/latex.html.markdown @@ -2,7 +2,7 @@ language: latex contributors: - ["Chaitanya Krishna Ande", "http://icymist.github.io"] - - ["Colton Kohnke", "http://github.com/voltnor"] + - ["Colton Kohnke", "https://github.com/voltnor"] - ["Sricharan Chiruvolu", "http://sricharan.xyz"] - ["Ramanan Balakrishnan", "https://github.com/ramananbalakrishnan"] - ["Svetlana Golubeva", "https://attillax.github.io/"] @@ -95,8 +95,9 @@ to the source code. Separate paragraphs by empty lines. -You need to add a backslash after abbreviations (if not followed by a comma), because otherwise the spacing after the dot is too large: -E.g., i.e., etc.\ are are such abbreviations. +You need to add a tilde after abbreviations (if not followed by a comma) for a +non-breaking space, because otherwise the spacing after the dot is too large: +E.g., i.e., etc.~are are such abbreviations. \section{Lists} Lists are one of the easiest things to create in \LaTeX! I need to go shopping @@ -140,8 +141,7 @@ about! Operators are essential parts of a mathematical document: trigonometric functions ($\sin$, $\cos$, $\tan$), logarithms and exponentials ($\log$, $\exp$), -limits ($\lim$), etc.\ -have pre-defined LaTeX commands. +limits ($\lim$), etc.~have pre-defined LaTeX commands. Let's write an equation to see how it's done: $\cos(2\theta) = \cos^{2}(\theta) - \sin^{2}(\theta)$ @@ -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,16 +200,24 @@ 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} - Number & Last Name & First Name \\ % Column rows are separated by & + % The basics are simple: one letter for each column, to control alignment: + % basic options are: c, l, r and p for centered, left, right and paragraph + % optionally, 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 & First Name & Last 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 | First Name Last Name + % -------|--------------------------- % because of \hline + % 1 | Biggus Dickus + % 2 | Monty Python \end{table} -\section{Getting \LaTeX{} to not compile something (i.e.\ Source Code)} +\section{Getting \LaTeX{} to not compile something (i.e.~Source Code)} Let's say we want to include some code into our \LaTeX{} document, we would then need \LaTeX{} to not try and interpret that text and instead just print it to the document. We do this with a verbatim @@ -218,14 +228,15 @@ 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} By now you're probably wondering how to compile this fabulous document and look at the glorious glory that is a \LaTeX{} pdf. -(yes, this document actually does compile). +(Yes, this document actually does compile). Getting to the final document using \LaTeX{} consists of the following steps: @@ -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 @@ -262,9 +274,30 @@ There exists two main types of links: visible URL \\ % You can not add extra-spaces or special symbols into shadowing text since it % will cause mistakes during the compilation -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. +\section{Writing in ASCII or other encodings} + +By default, historically LaTeX accepts inputs which are pure ASCII (128), +but not extended ASCII, meaning without accents (à, è etc.) and non-Latin symbols. + +It is easy to insert 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} + +Since LuaTeX and XeLaTeX were designed with built-in support for UTF-8, making +life easier for writing in non-Latin alphabets. + \section{End} That's all for now! @@ -284,6 +317,6 @@ That's all for now! ## More on LaTeX -* The amazing LaTeX wikibook: [https://en.wikibooks.org/wiki/LaTeX](https://en.wikibooks.org/wiki/LaTeX) +* The amazing LaTeX Wikibook: [https://en.wikibooks.org/wiki/LaTeX](https://en.wikibooks.org/wiki/LaTeX) * An actual tutorial: [http://www.latex-tutorial.com/](http://www.latex-tutorial.com/) * A quick guide for learning LaTeX: [Learn LaTeX in 30 minutes](https://www.overleaf.com/learn/latex/Learn_LaTeX_in_30_minutes) |