-
Notifications
You must be signed in to change notification settings - Fork 0
/
fi-pdflatex.tex
479 lines (429 loc) · 14.2 KB
/
fi-pdflatex.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% I, the copyright holder of this work, release this work into the
%% public domain. This applies worldwide. In some countries this may
%% not be legally possible; if so: I grant anyone the right to use
%% this work for any purpose, without any conditions, unless such
%% conditions are required by law.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{beamer}
\usetheme[faculty=fi,logo=otinanai]{fibeamer}
\usepackage[utf8]{inputenc}
\usepackage[main=english]{babel}
%% These macros specify information about the presentation
\title{Introduction to \LaTeX} %% that will be typeset on the
\subtitle{GEO2020 - 1/12/2017} %% title page.
\author{Stelios Vitalis, Hugo Ledoux}
%% These additional packages are used within the document:
\usepackage{ragged2e} % `\justifying` text
\usepackage{booktabs} % Tables
\usepackage{tabularx}
\usepackage{tikz} % Diagrams
\usetikzlibrary{calc, shapes, backgrounds, mindmap, trees}
\usepackage{smartdiagram}
\usepackage{amsmath, amssymb}
\usepackage{url} % `\url`s
\usepackage{listings} % Code listings
\lstset{language=[LaTeX]{TeX}}
\usepackage{minted}
\frenchspacing
\makeatletter
\renewcommand\fibeamer@includeLogo[1][]{}
\newcommand{\bftt}[1]{\textbf{\texttt{#1}}}
\newcommand{\comment}[1]{{\color[HTML]{008080}\textit{\textbf{\texttt{#1}}}}}
\newcommand{\cmd}[1]{{\color[HTML]{008000}\bftt{#1}}}
\newcommand{\bs}{\char`\\}
\newcommand{\cmdbs}[1]{\cmd{\bs#1}}
\newcommand{\lcb}{\char '173}
\newcommand{\rcb}{\char '175}
\newcommand{\cmdbegin}[1]{\cmdbs{begin\lcb}\bftt{#1}\cmd{\rcb}}
\newcommand{\cmdend}[1]{\cmdbs{end\lcb}\bftt{#1}\cmd{\rcb}}
\makeatother
\newcommand*\keystroke[1]{%
\tikz[baseline=(key.base)]
\node[%
draw,
fill=white,
drop shadow={shadow xshift=0.25ex,shadow yshift=-0.25ex,fill=black,opacity=0.75},
rectangle,
rounded corners=2pt,
inner sep=1pt,
line width=0.5pt,
font=\scriptsize\sffamily
](key) {#1\strut}
;
}
\newcommand{\keystrokebftt}[1]{\keystroke{\bftt{#1}}}
\newenvironment{exampletwoup}
{\VerbatimEnvironment
\begin{VerbatimOut}{example.out}}
{\end{VerbatimOut}
\setlength{\parindent}{0pt}
\fbox{\begin{tabular}{l|l}
\begin{minipage}{0.55\linewidth}
\inputminted[fontsize=\small,resetmargins]{latex}{example.out}
\end{minipage} &
\begin{minipage}{0.35\linewidth}
\input{example.out}
\end{minipage}
\end{tabular}}}
\newenvironment{exampletwouptiny}
{\VerbatimEnvironment
\begin{VerbatimOut}{example.out}}
{\end{VerbatimOut}
\setlength{\parindent}{0pt}
\fbox{\begin{tabular}{l|l}
\begin{minipage}{0.55\linewidth}
\inputminted[fontsize=\scriptsize,resetmargins]{latex}{example.out}
\end{minipage} &
\begin{minipage}{0.35\linewidth}
\setlength{\parskip}{6pt plus 1pt minus 1pt}%
\raggedright\scriptsize\input{example.out}
\end{minipage}
\end{tabular}}}
\newenvironment{exampletwouptinynoframe}
{\VerbatimEnvironment
\begin{VerbatimOut}{example.out}}
{\end{VerbatimOut}
\setlength{\parindent}{0pt}
\begin{tabular}{l|l}
\begin{minipage}{0.55\linewidth}
\inputminted[fontsize=\scriptsize,resetmargins]{latex}{example.out}
\end{minipage} &
\begin{minipage}{0.35\linewidth}
\setlength{\parskip}{6pt plus 1pt minus 1pt}%
\raggedright\scriptsize\input{example.out}
\end{minipage}
\end{tabular}}
\begin{document}
\frame{\maketitle}
\AtBeginSection[]{% Print an outline at the beginning of sections
\begin{frame}<beamer>
\frametitle{Outline for Section \thesection}
\tableofcontents[currentsection]
\end{frame}}
\section{Writing Documents}
\subsection{Good and Bad Practices}
\begin{frame}{Typical Word Processor}
\framesubtitle{Formatting Words}%
\centering That's bad...
\begin{figure}
\includegraphics[width=0.9\textwidth]{resources/bad-practice}
\end{figure}%
\end{frame}
\begin{frame}{Typical Word Processor}
\framesubtitle{Using Styles}%
\centering That's better...
\begin{figure}
\includegraphics[width=0.9\textwidth]{resources/good-practice}
\end{figure}%
\end{frame}
\subsection{Separating Content from Formatting}
\begin{frame}{Separating Content from Formatting}
\begin{tikzpicture}[scale=0.6, every node/.style={transform shape}]
\path[mindmap,concept color=black,text=white, level 1 concept/.append style={
sibling angle=180}, level 2 concept/.append style={sibling angle=60}, level 3 concept/.append style={sibling angle=45}]
node[concept] {Document}
[clockwise from=0]
child[concept color=green!50!black] {
node[concept] {content}
[clockwise from=90]
child { node[concept] {section 1}
[clockwise from=135]
child { node[concept] {1.1} }
child { node[concept] {1.2} }
child { node[concept] {1.3} }
}
child { node[concept] {section 2} }
child { node[concept] {section 3} }
child { node[concept] {section 4} }
}
child[concept color=blue] {
node[concept] {styles}
[clockwise from=210]
child { node[concept] {subsection} }
child { node[concept] {section} }
};
\end{tikzpicture}
\end{frame}
\begin{frame}{Attitude adjustment}{A new approach}
\begin{itemize}
\item Use commands to describe ``what it is'', not ``how it looks''
\item Focus on your content
\item Let \LaTeX\ do its job
\end{itemize}
\end{frame}
\subsection{What is \LaTeX}
\begin{frame}{What is \LaTeX}{The Engine}
\centering
\smartdiagramset{back arrow disabled=true}
\smartdiagram[flow diagram:horizontal]{\LaTeX\ Code, \LaTeX\ Engine, PDF}
\end{frame}
\defverbatim[colored]\helloWorld{
\begin{lstlisting}[tabsize=2]
\documentclass{article}
\begin{document}
Hello World! % This is just comments...
\end{document}
\end{lstlisting}}
\begin{frame}{Examples}{A simple document}
\helloWorld
\end{frame}
\AtBeginSection[]{% Print an outline at the beginning of sections
\begin{frame}<beamer>
\frametitle{Outline for Section \thesection}
\tableofcontents[currentsection]
\end{frame}}
\section{Using \LaTeX}
\subsection{Getting Started}
\begin{frame}{Using \LaTeX}{Different options}
\begin{itemize}
\item Install it locally:
\begin{itemize}
\item A distribution (engine and packages):
\begin{itemize}
\item MiKTeX (Windows)
\item MacTeX (OSX)
\item TeXLive (Linux)
\end{itemize}
\item An Editor:
\begin{itemize}
\item TexStudio (Windows, OSX, Linux)
\item TexMaker (Windows, OSX, Linux)
\item Other (\href{https://en.wikipedia.org/wiki/Comparison_of_TeX_editors}{Wikipedia Comparison})
\end{itemize}
\end{itemize}
\item Use it online:
\begin{itemize}
\item \href{http://www.overleaf.com}{Overleaf}
\item \href{http://www.sharelatex.com}{ShareLatex}
\end{itemize}
\end{itemize}
\end{frame}
\defverbatim[colored]\simpleStructure{
\begin{lstlisting}[tabsize=2]
\documentclass{article}
\title{A Title}
\author{John Doe}
\begin{document}
\maketitle
\section{This is a section}
Some text here.
\subsection{This is a subsection}
Some other text here.
\subsection{This is another subsection}
Guess what!
This is another piece of information...
\end{document}
\end{lstlisting}}
\subsection{Structure Elements}
\begin{frame}{Examples}
\simpleStructure
\end{frame}{
\begin{frame}{Examples}{Simple Structure}
\includegraphics[width=0.8\textwidth]{simple-document.pdf}
\end{frame}
\defverbatim[colored]\moreExamples{
\begin{exampletwoup}
\begin{itemize}
\item Tea
\item Milk
\item Biscuits
\end{itemize}
\end{exampletwoup}
\vskip 2ex
\begin{exampletwoup}
\begin{figure}
\includegraphics{chick}
\end{figure}
\end{exampletwoup}
\vskip 2ex
\begin{exampletwoup}
\begin{equation}
\alpha + \beta + 1
\end{equation}
\end{exampletwoup}
}
\begin{frame}{Examples}{Structure Elements}
\moreExamples
\end{frame}
\subsection{Math}
\defverbatim[colored]\evenMoreExamples{
\begin{itemize}
\item For the most part, you can just type your text normally.
\begin{exampletwouptiny}
Words are separated by one or more
spaces.
Paragraphs are separated by one
or more blank lines.
\end{exampletwouptiny}
\item Space in the source file is collapsed in the output.
\begin{exampletwouptiny}
The rain in Spain
falls mainly on the plain.
\end{exampletwouptiny}
\item Add \cmdbs{usepackage} to the pre-ample to add functionality
\end{itemize}}
\begin{frame}{Examples}{Source code}
\evenMoreExamples
\end{frame}
\defverbatim[colored]\mathExamples{
\begin{itemize}
\item Why are dollar signs \keystrokebftt{\$} special? We use them to mark mathematics in text.\\[1ex]
\begin{exampletwouptiny}
% not so good:
Let a and b be distinct positive
integers, and let c = a - b + 1.
% much better:
Let $a$ and $b$ be distinct positive
integers, and let $c = a - b + 1$.
\end{exampletwouptiny}
\item Always use dollar signs in pairs --- one to begin the mathematics, and one
to end it.
\item \LaTeX{} handles spacing automatically; it ignores your spaces.
\begin{exampletwouptiny}
Let $y=mx+b$ be \ldots
Let $y = m x + b$ be \ldots
\end{exampletwouptiny}
\end{itemize}
}
\begin{frame}{Examples}{Math}
\mathExamples
\end{frame}
\defverbatim[colored]\mathNotation{
\begin{itemize}
\item Use caret \keystrokebftt{\^} for superscripts and underscore \keystrokebftt{\_} for subscripts.
\begin{exampletwouptiny}
$y = c_2 x^2 + c_1 x + c_0$
\end{exampletwouptiny}
\vskip 2ex
\item Use curly braces \keystrokebftt{\{} \keystrokebftt{\}} to group
superscripts and subscripts.
\begin{exampletwouptiny}
$F_n = F_n-1 + F_n-2$ % oops!
$F_n = F_{n-1} + F_{n-2}$ % ok!
\end{exampletwouptiny}
\vskip 2ex
\item There are commands for Greek letters and common notation.
\begin{exampletwouptiny}
$\mu = A e^{Q/RT}$
$\Omega = \sum_{k=1}^{n} \omega_k$
\end{exampletwouptiny}
\end{itemize}}
\begin{frame}{Examples}{Math Notation}
\mathNotation
\end{frame}
\subsection{Tables}
\defverbatim[colored]\tablesExample{
\begin{itemize}
\item The argument specifies column alignment --- \textbf{l}eft, \textbf{r}ight, \textbf{r}ight.
\begin{exampletwouptiny}
\begin{tabular}{lrr}
Item & Qty & Unit \$ \\
Widget & 1 & 199.99 \\
Gadget & 2 & 399.99 \\
Cable & 3 & 19.99 \\
\end{tabular}
\end{exampletwouptiny}
\item It also specifies vertical lines; use \cmdbs{hline} for horizontal lines.
\begin{exampletwouptiny}
\begin{tabular}{|l|r|r|} \hline
Item & Qty & Unit \$ \\\hline
Widget & 1 & 199.99 \\
Gadget & 2 & 399.99 \\
Cable & 3 & 19.99 \\\hline
\end{tabular}
\end{exampletwouptiny}
\item Use an ampersand \keystrokebftt{\&} to separate columns and a double backslash \keystrokebftt{\bs}\keystrokebftt{\bs} to start a new row (like in the \bftt{align*} environment that we saw in part 1).
\end{itemize}}
\begin{frame}{Examples}{Tables}
\tablesExample
\end{frame}
\section{References and External Programs}
\subsection{References and Bibliography}
\defverbatim[colored]\refsExamples{
\begin{itemize}{\small
\item Use \cmdbs{label} and \cmdbs{ref} for automatic numbering.
\item The \bftt{amsmath} package provides \cmdbs{eqref} for referencing
equations.
}\end{itemize}
\begin{minipage}{0.55\linewidth}
\inputminted[fontsize=\scriptsize,frame=single,resetmargins]{latex}%
{structure-crossref.tex}
\end{minipage}
\begin{minipage}{0.35\linewidth}
\includegraphics[width=\textwidth,clip,trim=1.8in 6in 1.6in 1in]{structure-crossref.pdf}
\end{minipage}
}
\begin{frame}{Cross-referencing}
\refsExamples
\end{frame}
\defverbatim[colored]\bibtexInfo{
\begin{itemize}
\item Put your references in a \bftt{.bib} file in `bibtex' database format:
\inputminted[fontsize=\scriptsize,frame=single]{latex}{bib-example.bib}
\end{itemize}}
\begin{frame}{bib\TeX}
\bibtexInfo
\end{frame}
\defverbatim[colored]\bibtexExample{
\begin{itemize}
\item Use the \bftt{natbib} package\footnote{There is a new package with more
features named \bftt{biblatex} but most of the articles templates still use
\bftt{natbib}.} with \cmdbs{citet} and \cmdbs{citep}.
\item Add \cmdbs{bibliography} and \cmdbs{bibliographystyle} at the end.
\end{itemize}
\begin{minipage}{0.55\linewidth}
\inputminted[fontsize=\scriptsize,frame=single,resetmargins]{latex}%
{bib-example.tex}
\end{minipage}
\begin{minipage}{0.35\linewidth}
\includegraphics[width=\textwidth,clip,trim=1.8in 5in 1.8in 1in]{bib-example.pdf}
\end{minipage}}
\begin{frame}{bib\TeX}
\bibtexExample
\end{frame}
\begin{frame}{Manage Refereces}{External Program}
\begin{itemize}
\item Use a tool like JabRef.
\item All scientific websites can export to bib\TeX\ format.
\item Save references as \bftt{.bib} file and link it from your \LaTeX\ document.
\end{itemize}
\end{frame}
\subsection{Graphics}
\begin{frame}{Designing Graphics}{Suggested Tools}
\begin{itemize}
\item Vector graphics (Graphs, Charts, Figures):
\begin{itemize}
\item Adobe Illustrator (Proprietary)
\item Inkscape (Open Source)
\item draw.io (Free and Online)
\item TikZ package on \LaTeX\ (for brave people)
\end{itemize}
\item Image Editing
\begin{itemize}
\item Adobe Photoshop (Proprietary)
\item GIMP (Open Source)
\end{itemize}
\end{itemize}
\end{frame}
\subsection{Templates}
\begin{frame}{Templates for GEO2020}{Use them as starting point}
\begin{itemize}
\item P2 Template: \url{https://tinyurl.com/mscgeomp2}.
\item Final Thesis: \url{https://tinyurl.com/mscgeomthesis}.
\end{itemize}
\end{frame}
\subsection{Exercise}
\begin{frame}{Let's do an exercise}
Try to make the source look like the final example.
\begin{itemize}
\item Source: \url{https://tinyurl.com/latex-exerc-source}
\item Final: \url{https://tinyurl.com/latex-exerc-final}
\end{itemize}
\\
Your main source of information:
\begin{itemize}
\item \url{https://en.wikibooks.org/wiki/LaTeX}
\end{itemize}
\end{frame}
\end{document}