-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLaTeX_tips.tex
2708 lines (2604 loc) · 202 KB
/
LaTeX_tips.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
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%! TEX root = LaTeX_tips.tex
%% LaTeX tips and stuff.
%% Made for you not to spend long hours on Google and StackOverflow to look up weird stuff.
%%
%% Copyright 2020 Riccardo Milani
%%
%% Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
%% Riccardo Milani wrote this file. As long as you retain this notice you
%% can do whatever you want with this stuff. If we meet some day, and you think
%% this stuff is worth it, you can buy me a beer or coffee in return
% Authors: Riccardo Milani, X12
% Acknowledgments: Cl\'ement Colas, Ga\"etan Mangeon, Germain Davy
\documentclass[a4paper,12pt,%
final%
%draft%
]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{lmodern}
\usepackage[top=3cm, bottom=3cm, left=2cm, right=2cm]{geometry}
\usepackage{xcolor}
\definecolor{BlueX}{RGB}{0,62,92}
\def\maincolor{BlueX}
\definecolor{mLightBrown}{HTML}{EB811B}
\usepackage{verbatim}
\usepackage{fancyvrb}
\usepackage{amsmath,amssymb,amsfonts,mathtools,amsthm}
\usepackage{empheq}
\usepackage{xfrac,nicefrac}
\usepackage{fontawesome}
\usepackage{lipsum}
\usepackage{paralist}
\usepackage[inline]{enumitem}
\setlist[itemize]{topsep=0pt,noitemsep}
\usepackage{xspace}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{trees,%
patterns,%
patterns.meta,%
intersections,%
pgfplots.fillbetween
}
\pgfplotsset{compat=newest}
\usepackage{forest}
\usepackage{siunitx}
\usepackage{titlesec} % Modify the style of the sections, chapters...
\titleformat{\section} %command
%[display] %shape
{\color{\maincolor}\Large\bfseries\itshape} %format
{\color{\maincolor}\Large\bfseries\itshape\thesection~-} %label
{1ex} %sep
{} %before-code
%{} %after-code
\titleformat{\subsection} %command
%[display] %shape
{\color{\maincolor}\large\bfseries} %format
{\color{\maincolor}\large\bfseries\thesubsection~-} %label
{.5ex} %sep
{} %before-code
%{} %after-code
\usepackage[%
pdfpagelabels,
urlbordercolor=\maincolor,
linkbordercolor=mLightBrown,
pdfborderstyle={/S/U/W 1}
]{hyperref}
\newcommand*{\fullref}[1]{\hyperref[{#1}]{\autoref*{#1} - \textit{\nameref*{#1}}}}
\usepackage[numbered]{bookmark}
\parindent=0pt
\setlength{\parskip}{2ex}
\title{\color{\maincolor}\Huge\bfseries\scshape Random (and possibly useful) \LaTeX{} tips}
\author{\vspace{-7ex}}
\date{\vspace{-7ex}}
\addto\captionsenglish{% Needed if babel is used. It is needed for every language that will be used.
\renewcommand{\abstractname}{\vspace*{-\baselineskip}}%
}
%
\begin{document}
\maketitle
%\begin{center}
%{\color{\maincolor}\Huge\bfseries\scshape%
%Random (and possibly useful) \LaTeX~tips}
%\end{center}
\vspace*{-2.5cm}
\pdfbookmark[1]{Abstract}{abstract}
\begin{abstract}
\parindent=0pt
\setlength{\parskip}{2pt}
\noindent We collect here some \LaTeX{} tricks that we used (do not ask why) and that we found useful. We hope that this list could save some Googlin', roaming around StackExchange and, most importantly, time to other people who may happen to need the same things.
Indeed, this is not a tutorial, this is not an introduction to \LaTeX{}, we assume that the reader has already some (basic) notions. In particular, [s]he should be able to write and compile properly a \texttt{tex} file. You may find here and there some basic stuff (for instance the chain of commands to obtain a fully compiled file), but it won't suffice if you start with zero knowledge of \LaTeX{}. The usual tools (namely Google) is your friend.
There is no particular structure or whatsoever. We identified some major themes and then simply put an itemize in there. A brief ToC is given here below.
We try to give the snippet of the solution, hopefully commented, and an example: please copy them, and play around with them in order to make them suit your desires! If a loading of a package is required, you'll often see \verb|%...| or alike, usually meaning that what comes before it, goes in the preamble, what comes next into the document. Sometimes, when we were too lazy and we found it pretty clear, a link to an on-line solution is given. In our snippets, you'll find words in \texttt{< >}, that means that it is something that you have to / can choose. When discussing a package, we often provide the link to the PDF of the user manual: this might change and not be accessible anymore, if that happens, just google "in:ctan.org <name\_of\_the\_package>" and open the related \href{https://ctan.org/}{CTAN} (Comprehensive \TeX{} Archive Network) address, and please, modify the link in this document, or, at least, report the issue. Moreover, one can retrieve the manual of an installed package by running \verb|texdoc <name\_of\_the\_package>| (on *nix machines).
If one would like more details about a subject, or if [s]he couldn't find / solve his/her problem with this document, there are a couple of websites that could be useful. \href{https://ctan.org/}{CTAN}, has already been mentioned, and (all hail!) \href{https://tex.stackexchange.com/}{TexExchange} as well. Other references are: \href{https://www.tug.org/}{\TeX{} Users Group}, \href{https://www.overleaf.com/learn/}{Overleaf}, \href{https://en.wikibooks.org/wiki/LaTeX}{WikiBooks}, \href{https://latex.org/forum/index.php}{\LaTeX.org} and \href{https://www.texfaq.org/}{\TeX{} FAQ}.
A couple of words about \LaTeX{} editors. If for you writing in \LaTeX{} is a necessary pain (what's all this code anyway?!), there are plenty of dedicated editors out there that make things easy for you, among others \LaTeX Studio and \TeX Maker (see \autoref{sec:texmaker}). I think that the rich-format text option of the aforementioned \href{https://www.overleaf.com/learn/}{Overleaf} (or Share\LaTeX{} since they have merged) can definitely be a killer-feature. Overleaf might also be a good choice for a collaborative project, in this case, see the related item in \autoref{sec:Miscellaneous}. If you are more code-prone, numerous plugin have been developed for classical text editors such as \verb|[neo]vi[m]| or \verb|emacs| (I, myself, cannot but suggest \verb|vim+vimtex+Ultisnips|). One may found a list of available editors \href{https://tex.stackexchange.com/questions/339/latex-editors-ides}{here}.
Some non-\TeX{}-related stuff (but usually still pdf-related) is given. It usually involves commands that can be found in \texttt{Linux} distros. But, here again internet is your friend and plenty of one-line alternatives are available out there.
Finally, if you liked and you have some cool tricks that you want to share in order to make other people's lives easier, do not hesitate to contribute: along with this file, you should have received its \href{run:./LaTeX_tips.tex}{source code} (of course we wrote it in \LaTeX, what do you expect?!); if not, ask for it (there are some tricks inside it, too!). And there's more: a Github repo. Here it is: \href{https://github.com/RiMillo/LaTeX_tips}{\faGithub\texttt{/RiMillo/LaTeX\_tips}}.
Happy \LaTeX ing! And remember: {\itshape Sharing is caring!}
\end{abstract}
%\clearpage
\tableofcontents
%\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: SECTIONING
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Structure, Sectioning \& General Layout}
\label{sec:Sectioning}
\begin{itemize}
\item Manage a big, multi-file project: \verb|\input| vs. \verb|\include|, \verb|\includeonly|, packages \href{https://ctan.mc1.root.project-creative.net/macros/latex/contrib/import/import.pdf}{\texttt{import}} and \href{http://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/subfiles/subfiles.pdf}{\texttt{subfiles}}; have a look \href{https://en.wikibooks.org/wiki/LaTeX/Modular_Documents}{here}.
\begin{itemize}
\item Nested \verb|\input| are forbidden.
\item You may know about \verb|\graphicspath| which allows one to add directories to the path where the pictures are searched for (cf.~\fullref{sec:Graphics}). Well, with a workaround one can achieve the same thing for the input files. Details \href{https://tex.stackexchange.com/a/79060/206129}{here} but an example is given below:
\begin{verbatim}
\makeatletter
\providecommand*{\input@path}{}
\g@addto@macro\input@path{{path1/}{path2/}}% append
\makeatother
\end{verbatim}
\end{itemize}
\item General introduction to a structure of a document: \href{https://en.wikibooks.org/wiki/LaTeX/Document_Structure}{here}
\begin{itemize}
\item The \texttt{book} class has a special \href{https://en.wikibooks.org/wiki/LaTeX/Document_Structure#Book_structure}{structure}: \verb|\frontmatter|, \verb|\mainmatter|, \verb|\appendix|, \verb|\backmatter|.
\end{itemize}
\item You may now know that one defines a chapter with \verb|\chapter{Chpt title}|, a section with \verb|\section{Sec title}|, and similarly for \texttt{part}, \texttt{subsection}, \texttt{subsubsection}, \texttt{paragraph}, \texttt{subparagraph}. There is also the possibility to choose a "short title" and a "mark". The example here below is for \texttt{section} but can be applied to the other commands as well
\begin{verbatim}
\section[Short title]{A very long long tile: do you really want it?}
\sectionmark{Section in header}
\end{verbatim}
\begin{itemize}
\item Ok, you know about the braces and the long title.
\item A short title is what will appear in the ToC (Table of Contents) (and possibly in the footer/header of a \texttt{beamer} document \autoref{sec:Beamer}).
\item A mark is what will appear in the header/footer. Of course, there should be one and it needs the \texttt{fancyhdr} package (see here below). In the \texttt{fancyhdr} manual, the authors say it is better to repeat the \verb|\sectionmark{}| inside the long title too (let me stress: repeat, copy\ldots) in order to avoid some possible problems of undefined marks, however this seem to be possible only if a short title is provided as well.
\end{itemize}
\item Modify first indentation: \verb|\parindent=<len>|
\item Customize titling style: package \href{http://mirrors.ircam.fr/pub/CTAN/macros/latex/contrib/titlesec/titlesec.pdf}{\texttt{titlesec}}; an example
\begin{Verbatim}[samepage=true]
\titleformat{\section} % Command: chapter, subsection...
%[display] % Shape - Optional
{\color{\maincolor}\Large\bfseries\itshape} % Format
{\color{\maincolor}\Large\bfseries\itshape\thesection~-} % Label
{1ex} % Separation
{} % Before-code
%{} % After-code - Optional
\end{Verbatim}
\item Indent first line after section. Depending on (the typographic rules of) the chosen language, the first line after a non-centered titled \emph{section} may not be indented. If you would like to indent it anyway, just load \verb|\usepackage{indentfirst}|.
\item Indent a \emph{whole} paragraph: have a look \href{https://tex.stackexchange.com/questions/35933/indenting-a-whole-paragraph}{here}.
\item Numbering and ToC depth (how many levels are printed):
\begin{itemize}
\item \verb|\seccounter{secnumdepth}<n>|: define up to which level of sectioning titles are numbered.
\item \verb|\setcounter{tocdepth}{<n>}| (mind that you can change the numbered level with \verb|\setcounter{secnumdepth}{<n>}| so that they are included in the ToC, but it is not exactly the same thing, as it is explained \href{https://tex.stackexchange.com/questions/17877/how-to-show-subsubsections-and-paragraphs-in-toc/17879#17879}{here}).
\item Selectively change the depth: have a look \href{https://en.wikibooks.org/wiki/LaTeX/Document_Structure#Table_of_contents}{here} or \href{https://tex.stackexchange.com/questions/59091/setcountertocdepth}{here}.
\end{itemize}
\item If the ToC does not show up in the bookmarks, you can add it manually. Just remember to add a \verb|\clearpage| or \verb|\cleardoublepage| just before it, so that the page in the bookmark is not messed up (we use \texttt{chapter} as level of the related ToC entry, but you can use \texttt{section} or whatever)
\begin{verbatim}
\cleardoublepage
\pdfbookmark[chapter]{\contentsname}{toc}
\tableofcontents
\end{verbatim}
\item Lengths and skips: \href{https://tex.stackexchange.com/questions/41476/lengths-and-when-to-use-them}{here}.
\item Horizontal / landscape pages
\begin{itemize}
\item For the whole document: use option \texttt{landscape} \verb|\usepackage[landscape]{geometry}| or \verb|\documentclass[landscape]{<class>}|.
\item For a certain part only: have a look \href{https://tex.stackexchange.com/questions/337/how-to-change-certain-pages-into-landscape-portrait-mode}{here}. The environment is only one \verb|\begin{landscape}|, but it could come from two packages. If you are producing a pdf, use package \texttt{pdflscape} (it gives more metadata to the document that improve its readability), otherwise \texttt{lscape}.
\begin{itemize}
\item For horizontal numbering as well, see \href{https://tex.stackexchange.com/questions/9071/how-to-translate-and-rotate-the-heading-of-landscaped-pages}{this}.
\end{itemize}
\end{itemize}
\item Footnotes: \verb|\footnote{This goes in the footer}|. You may want to customize the appearance, have a look \href{https://www.overleaf.com/learn/latex/footnotes#Changing_the_numbering_style}{here}. For advanced customization, refer to package \href{http://ctan.mines-albi.fr/macros/latex/contrib/footmisc/footmisc.pdf}{\texttt{footmisc}}.
\begin{itemize}
\item ATTENTION: \texttt{beamer} (\autoref{sec:Beamer}) defines its own \texttt{footnote}, hence it could be used with \texttt{footmisc}. If you want to change the behaviour you should redefine the template:
\begin{verbatim}
\setbeamertemplate{footnote}{...}
\end{verbatim}
\item Footnotes in a float caption: see \href{https://tex.stackexchange.com/questions/10181/using-footnote-in-a-figures-caption}{here}. Two ways: Add an optional custom caption for list of Figure, or \texttt{protect} the command
\begin{verbatim}
\caption[Caption for LOF]{A caption with a \footnote{Footnote text}}
% or....
\caption{A caption with a \protect\footnote{Footnote text}}
\end{verbatim}
\end{itemize}
\item Customize headers and footers: package \href{http://mirrors.standaloneinstaller.com/ctan/macros/latex/contrib/fancyhdr/fancyhdr.pdf}{\texttt{fancyhdr}}.
\item Position stuff exactly where you wish: use package \href{https://mirrors.chevalier.io/CTAN/macros/latex/contrib/textpos/textpos.pdf}{\texttt{textpos}} and its command
\begin{verbatim}
\begin{textblock}{<width>}(<xcoord>,<ycoord>)
% [...]
\end{textblock}
\end{verbatim}
\begin{itemize}
\item Pay attention to the package options \texttt{overlay} (use it for \texttt{beamer}, \autoref{sec:Beamer}), and \texttt{absolute}.
\item You may want to use it together with \texttt{eso-pic} (help grids), see \fullref{sec:Draft}.
\end{itemize}
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: FONT & APPEARANCE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Font, Appearance \& Spacing}
\label{sec:font}
\begin{itemize}
\item \href{https://en.wikibooks.org/wiki/LaTeX/Fonts}{A general intro}.
\item Font-related
\begin{itemize}
\item Be advised: changing the font appearance with \LaTeX{} may be hard. There are some predefined ones, you may find them \href{https://www.overleaf.com/learn/latex/font_typefaces}{here}, but there are only a dozen. If you want a new style you should install it, look it up on the web, you can start \href{https://tug.org/fonts/fontinstall.html}{here}. It is easier if one uses Xe\LaTeX{}.
\item Be advised that \verb|\emph{.}| does not not necessarily means italic. You might modify it as reported \href{https://tex.stackexchange.com/questions/315058/change-the-behaviour-of-emph-per-environment}{here} or \href{https://tex.stackexchange.com/questions/315058/change-the-behaviour-of-emph-per-environment}{here}.
\item Change default font style: \verb|\renewcommand{\familydefault}{<family>}| where \texttt{family} may be chosen in: \verb|\rmdefault| {roman family font}, \verb|\sfdefault| (sans serif family font), or \verb|\ttdefault| (teletype font family)
\item Font sizes: see \autoref{tab:sizes}. Note: \verb|\HUGE| is available with the \texttt{memoir} class only, \verb|\Tiny| and \verb|\TYNY| only with \texttt{beamer}.
\begin{itemize}
\item The sizes presented in the table are set automatically and relatively to the main size, i.e.~the one that you pass as option to the class. However, one can choose exactly the size of the font with
\begin{verbatim}
\fontsize{<size>}{<interline>}\selectfont
\end{verbatim}
Most of the times this will give warnings since for most of the fonts only a few sizes exist. Loading package \texttt{anyfontsize} will make \TeX{} look for the size closest to the requested one and than scale it. Xe\LaTeX{} and lua\LaTeX{} are able to do it without additional packages.
\end{itemize}
\item Font styles: see \autoref{tab:styles}.
\end{itemize}
\item \LaTeX{} lengths: have a look \href{https://www.overleaf.com/learn/latex/Lengths_in_LaTeX}{here} or even \href{https://en.wikibooks.org/wiki/LaTeX/Lengths}{there}.
\item Spacing:
\begin{itemize}
\item \verb|\vspace{<length>}| (resp.~\verb|\hspace{<length>}|) tells \LaTeX{} to leave a vertical (resp.~horizontal) space. Its starred version \verb|\vspace*{<len>}| forces it when you are close to the top/bottom of the page.
\item For leaving one-time space between two lines, use \verb|\smallskip|, \verb|\medskip| or \verb|\bigskip| (which are equivalent to e.g.\ \verb|\vspace{\smallskipamount}|).
\item \verb!\small|med|bigbreak!: as above but suggests to \LaTeX{} that it would be a good place for a pagebreak if necessary.
\item When forcing a newline, a custom vertical space may be added: \verb|The end\\[3cm]|.
\item Fill the line/page: \verb!\hfill!, \verb!\vfill!. Might be useful: for lines \verb|\dotfill|, \verb|\hrulefill|.
\item Change the space after paragraph: \verb|\setlegth{\parskip}{<len>}|
\item Spacing after a command
\begin{itemize}
\item Use a user-defined command and empty brackets as suggested \href{https://tex.stackexchange.com/questions/31091/space-after-latex-commands}{here}. Examples:
\newcommand{\cmd}{command}
\begin{verbatim}
\newcommand{\cmd}{command}
A space after my \cmd{} here. There shouldn't be one after my \cmd{}.
\end{verbatim}
gives:\\
A space after my \cmd{} here. There shouldn't be one after my \cmd{}.
\item Use package \texttt{xspace} as explained \href{https://tex.stackexchange.com/questions/362046/insert-a-space-after-a-command-vs-vs-space}{here}.
\newcommand{\cmdd}{command\xspace}
\begin{verbatim}
\usepackage{xspace}
\newcommand{\cmd}{command\xspace}
A space after my \cmd here. There shouldn't be one after my \cmd.
\end{verbatim}
A space after my \cmdd{} here. There shouldn't be one after my \cmdd{}.
\end{itemize}
\item Dots, abbreviations, and spacing.
\begin{itemize}
\item Suppose you want to write \verb|cf. there|. \LaTeX{} interprets that dot as a phrase-ending period and it stretches the blank between the dot and the following word. Add a tilde, like this \verb|cf.~there| or write \verb|cf.\ there| (as you would do in math mode) to avoid it. The difference is that the tilde is an unbreakable space, hence the two words are forced to be together and cannot be broken up by a new line, for instance.
\item Conversely, \LaTeX{} interprets a dot after a one-letter all-capital word as an abbreviation (e.g.\ for John R. R. Tolkien). If it is not the case for you, add \verb|\@| before the period: \verb|Yesterday, I watched Rambo I\@. It is a good movie|.
\end{itemize}
\end{itemize}
\item Special and Accented characters: \href{https://en.wikibooks.org/wiki/LaTeX/Special_Characters#Escaped_codes}{here} (the link is useful for other symbols as well).
\item Special styles, e.g.\ underlined, highlighted, spaced-out\ldots{}
\begin{itemize}
\item The package \href{https://mirrors.chevalier.io/CTAN/macros/latex/contrib/ulem/ulem.pdf}{\texttt{ulem}} provides several underlined styles (double, wavy, strike-out\ldots).
\begin{itemize}
\item It redefines the \verb|\emph{[...]}| command to underlined (instead of italic). Add option \texttt{normalem} to avoid that: \verb|\usepackage[normalem]{ulem}|.
\end{itemize}
\item The package \href{http://ctan.tetaneutral.net/macros/latex/contrib/soul/soul.pdf}{\texttt{soul}} gives interesting hyphenatable (can be cut to go to next line) styles: spaced-out, highlighted, underlined\ldots{}
\end{itemize}
\item Color
\begin{itemize}
\item Load package \texttt{color} or \href{http://mirrors.standaloneinstaller.com/ctan/macros/latex/contrib/xcolor/xcolor.pdf}{\texttt{xcolor}}
\item Some colors are pre-loaded: red, magenta, green, blue, cyan,\ldots
\item \verb|\color{<clr>}| select the color for the \emph{whole} current scope (that is an environment, current braces\ldots). \verb|\textcolor{<clr>}{<colored text>}| will write only \texttt{colored text} in the chosen color
\item Define colors: \verb|\definecolor{<name>}{<model>}{<spec>}|. The \texttt{name} it's up to you, \texttt{model} is \texttt{rgb} (in [0,1] or \texttt{RGB} in 0-255), \texttt{cmyk}, \texttt{gray}. \texttt{spec} is what defines the color according to the given model. If you want to mix pre-loaded colors, use \verb|\colorlet| (\verb|<clr1>!<n>!<clr2>| means ``mix \texttt{n}\% of \texttt{clr1} with (100-\texttt{n})\% of \texttt{clr2}''; \texttt{clr2} can be omitted and defaults to \texttt{white})
\begin{verbatim}
\definecolor{fullred}{RGB}{255,0,0}
\colorlet{mygray}{black!50}
\end{verbatim}
\item Outline text: use \verb|\contour{<contour color>}{<text>}| from package \texttt{contour} (option \texttt{outline} is advised)
\item (Semi-)Transparent text: obtaining a faded text is easy in \texttt{TikZ} (\autoref{sec:tikzpgf}): use option \verb|opacity=<r>| where \texttt{r} is a number between 0 (completely transparent) and 1 (solid). Some others options are available for standard text. The dedicated package \href{http://ctan.mines-albi.fr/macros/latex/contrib/transparent/transparent.pdf}{\texttt{transparent}} with \verb|\transparentcolor{<r>}{<text>}|, or the first two answers of this \href{https://stackoverflow.com/questions/3594329/semi-transparent-text-in-beamer-pdflatex}{post}.
\item Black\&White / grayscale output: pass option \texttt{monochrome} (for disabling colored output) or \texttt{gray|Gray} to package \texttt{color} (or \texttt{xcolor} according to what you are using). This won't however work on the images that you load. With \texttt{beamer} (\autoref{sec:Beamer}), \texttt{monochrome} does not work well, so prefer \texttt{gray}.
\item Consider this: you mixed your colors \verb|\colorlet{halfbw}{black!50}|, now how to get its \texttt{RGB}/\texttt{HTML} (\ldots) code? Use \verb|\convertcolorspec| or \verb|\extractcolorspec| as explained \href{https://tex.stackexchange.com/questions/35033/figuring-out-rgb-or-hex-color-from-xcolor}{here}.
\end{itemize}
\item Poetry: reference packages \href{https://ctan.gutenberg.eu.org/macros/latex/contrib/verse/verse.pdf}{\texttt{verse}} (pretty basic but it does the job; it seems to be frozen) and \href{https://mirrors.chevalier.io/CTAN/macros/latex/contrib/poemscol/poemscol.pdf}{\texttt{poemscol}} (a complete and huge package).
\end{itemize}
\begin{table}
\centering
\caption{Font sizes}
\label{tab:sizes}
\begin{tabular}{lc}
\verb|\HUGE| & [\texttt{memoir} only]\\
\verb|\Huge| & {\Huge The quick brown fox\par}\\
\verb|\huge| & {\huge The quick brown fox\par}\\
\verb|\LARGE| & {\LARGE The quick brown fox\par}\\
\verb|\Large| & {\Large The quick brown fox\par}\\
\verb|\large| & {\large The quick brown fox\par}\\
\verb|\normalsize| & {\normalsize The quick brown fox\par}\\
\verb|\small| & {\small The quick brown fox\par}\\
\verb|\footnotesize| & {\footnotesize The quick brown fox\par}\\
\verb|\scriptsize| & {\scriptsize The quick brown fox\par}\\
\verb|\tiny| & {\tiny The quick brown fox\par}\\
\verb|\Tiny| & [\texttt{beamer} only]\\
\verb|\TINY| & [\texttt{beamer} only]\\
\end{tabular}
\end{table}
\begin{table}
\centering
\caption{Font styles}
\label{tab:styles}
\begin{tabular}{lll}
Command & Switch & Output \\
\hline
\verb|\textnormal{...}| & \verb|{\normalfont ...}| & \textnormal{document font family}\\
\verb|\emph{...}| & \verb|{\em ...}| & \emph{emphasis}\\
\verb|\textrm{...}| & \verb|{\rmfamily ...}| & \textrm{roman font family}\\
\verb|\textsf{...}| & \verb|{\sffamily ...}| & \textsf{sans serif font family}\\
\verb|\texttt{...}| & \verb|{\ttfamily ...}| & \texttt{teletype font family}\\
\verb|\textup{...}| & \verb|{\upshape ...}| & \textup{upright shape}\\
\verb|\textit{...}| & \verb|{\itshape ...}| & \textit{italic shape}\\
\verb|\textsl{...}| & \verb|{\slshape ...}| & \textsl{slanted shape}\\
\verb|\textsc{...}| & \verb|{\scshape ...}| & \textsc{Small Capitals}\\
\verb|\textbf{...}| & \verb|{\bfseries ...}| & \textbf{bold}\\
\verb|\textmd{...}| & \verb|{\mdseries ...}| & \textmd{medium weight, normal}\\
%\verb|\textlf{...}| & \verb|{\lfseries ...}| & \textlf{light}\\
\verb|\uppercase{...}| & & \uppercase{All caps}\\
\verb|\lowercase{...}| & & \lowercase{LOWER CAPS}
\end{tabular}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: LANGUAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Languages}
\label{sec:languages}
Sometimes, especially in a thesis, one may have to use different languages, possibly with different typesetting styles (e.g.\ white-space before semicolon in French not in English). \href{https://en.wikibooks.org/wiki/LaTeX/Internationalization}{Here}, one can find an article about the internalization with pieces of advice and examples. When juggling more than one languages, the \texttt{babel} package comes in hand.
\begin{itemize}
\item Load the \texttt{babel} package with the languages you want to use as options. The order is important since the last one is considered as default one:
\begin{verbatim}
\usepackage[<secondary_language>,<main_language>]{babel}
\end{verbatim}
Thus, if one want to use French and English with the latter as default one would write \verb|\usepackage[french,english]{babel}|
Even simpler, use the key \texttt{main}:
\begin{verbatim}
\usepackage[french,main=english]{babel}
\end{verbatim}
\item When a paragraph should be typeset / written in French, one should just switches the language with the help of the \texttt{otherlanguage} environment (an example \href{https://tex.stackexchange.com/questions/20987/changing-babel-package-inside-a-single-chapter}{here}):
\begin{Verbatim}[samepage=true]
[English typesetting]
\begin{otherlanguage}{french}
[French typesetting]
\end{otherlanguage}
[English typesetting]
\end{Verbatim}
\item For some languages (e.g.\ Italian) \texttt{babel} changes autonomously caption names (figure, table,\ldots) and stuff (table of contents\ldots). With \texttt{french} (and similar) this does not happen for everything, hence one may want to rename manually the captions. For instance, one can use: \verb|\addto\captionsfrench{\def\tablename{Tableau}}|.
\item When certain languages are loaded, \texttt{babel} may be incompatible with some packages. This comes down to the fact that it modifies basic characters. Think about the semicolon ``\texttt{;}'' which in French gets modified so that a thin space is added before it. There are packages (for instance, \texttt{tikz}, see \autoref{sec:tikzpgf}) which suppose that such character have its basic and original meaning. This may cause compatibility issues. If you fear that a certain error is due to this incompatibility, you can try to switch off the particular value of the character, with \verb|\shorthandoff{;}|. You may reactivate it with \verb|\shorthandon{;}|. Other incompatibilities may involve Spanish and German, and characters like ``!'', ``>'', ``<'', ``:''.
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: ITEMIZE & Co.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{List, Enumerations, Items \& Co.}
\label{sec:Items}
\begin{itemize}
\item Error \texttt{too deeply nested}: too many nested lists / enumerations. \LaTeX{} has a finite number on definition for list and sub-lists, you have reached the end. Unfortunately, as explained \href{https://texfaq.org/FAQ-toodeep}{here} there nothing to do about it
\item In \texttt{enumerate} start from a different number: just add \verb|\setcounter{enumi}{<n>}| (as proposed \href{https://overleaf.com/learn/latex/Counters}{here}). See also below with package \texttt{enumitem} and \autoref{sec:Miscellaneous} for managing counters.
\item The \texttt{enumitem} \href{https://ctan.crest.fr/tex-archive/macros/latex/contrib/enumitem/enumitem.pdf}{package} enables more control on the \texttt{itemize} environment and alike.
\begin{itemize}
\item Usage
\begin{itemize}
\item Locally
\begin{verbatim}
\usepackage{enumitem}
% [...]
\begin{itemize}[<options>]
\item [...]
\end{itemize}
\end{verbatim}
\item Globally
\begin{verbatim}
\usepackage{enumitem}
\setlist[itemize]{<options>}
\end{verbatim}
\end{itemize}
\item Spacing
\begin{itemize}
\item No indent: \texttt{leftmargin=*}; another way: \verb|\setlength{\leftmargini}{0pt}| (or \verb|\leftmarginii| for subitems etc.) or \verb|\itemindent|
\item No separations between items: \texttt{noitemsep};
\item No separations whatsoever: \texttt{nosep};
\item Modify top spacing: \texttt{topsep=<len>};
\end{itemize}
\item Modify the bullet: \texttt{label=<cmd>}. With a star, \texttt{label*=<cmd>}, \texttt{cmd} is repeated two times for sub-items, three for sub-sub-items, etc;
\item Modify the numbering:
\begin{itemize}
\item Enumerations starting from \texttt{<n>}: \verb|\begin{enumerate}[start=<n>]|
\item Resume the previous count: \verb|\begin{enumerate}[resume]|
\item Customize the numbering of a sub-enumeration: for instance, see \href{https://tex.stackexchange.com/questions/78842/nested-enumeration-numbering}{this SO's thread}: \verb|\begin{enumerate}[label*=\arabic*.]|
\end{itemize}
\item Run a bit of code before/after the \texttt{itemize}: \texttt{before|after=<code>}
\item \verb|\setlist[<type>[,<depth>]]{<options>}|: in the preamble, and will set the global parameter for all the \texttt{type}-lists of depth \texttt{depth}. If \texttt{depth} is not given, the options are set to all (sub)-items. \texttt{type} may be \texttt{itemize,description,enumerate}...
\begin{verbatim}
\setlist[itemize]{%
leftmargin=*} % No margin for all the items of itemize
\setlist[itemize,1]{%
label=$\bullet$} % Items are circles
\setlist[itemize,2]{%
label=$\triangleleft$} % Sub-items are left-facing triangles
\end{verbatim}
\item Enumerations with a prefix: \href{https://tex.stackexchange.com/questions/37740/enumerate-with-properties}{here}. Just set the label as you wish as option:
\begin{verbatim}
\begin{enumerate}[label=\textbf{H\arabic*}]
\item Property 1
\item Property 2
\end{enumerate}
\end{verbatim}
\item \textbf{ATTENTION}: it may interfere with \texttt{beamer} and they may not work as expected if loaded together, see this \href{https://tex.stackexchange.com/questions/24371/does-enumitem-conflict-with-beamer-for-lists}{post} for two common problems.
\item \textbf{ATTENTION}: it may cause some errors with the \texttt{enumerate} lists. In this case, load the option \texttt{shortlabels} and explicitly choose the type of item for the numeration
\begin{verbatim}
\usepackage[shortlabels]{enumitem}
% [...]
\begin{enumerate}[1.]
\item One.
\end{enumerate}
\end{verbatim}
\end{itemize}
\item Inline lists: \href{https://mirrors.chevalier.io/CTAN/macros/latex/contrib/paralist/paralist.pdf}{\texttt{paralist}} package, and in particular its \texttt{inparaenum} environment.
\begin{itemize}
\item \textbf{ATTENTION}: load \texttt{paralist} \emph{before} \texttt{enumitem}.
\item A similar result is obtained with the \texttt{inline} option of \texttt{enumitem} and using starred versions of the usual item-related environments. Consider the following example in which we set the type of label, the separator, internal and final. Here is how it appears:
\begin{enumerate*}[label={(Ex\arabic*)},itemjoin={{, }},itemjoin*={{, and }}]
\item Example 1
\item Example 2
\item Example 3
\end{enumerate*}.
\begin{verbatim}
\begin{enumerate*}[%
label={(Ex\arabic*)},itemjoin={{, }},itemjoin*={{, and }}]
\item Example 1
\item Example 2
\item Example 3
\end{enumerate*}.
\end{verbatim}
\item \texttt{paralist} does not work properly with \texttt{beamer}.
\end{itemize}
\item Lists by columns: package \href{https://mirrors.ircam.fr/pub/CTAN/macros/latex/required/tools/multicol.pdf}{\texttt{multicol}} (and possibly \texttt{enumitem}), see this \href{https://stackoverflow.com/questions/1398127/breaking-a-list-into-multiple-columns-in-latex}{question}. If you have a number of items that does not suit well with the number of columns, try to balance the columns with empty labels: \verb|\item[]|. A possible alternative is manually do it with \texttt{minipage} or alike.
\item Referencing and \texttt{itemize}
\begin{itemize}
\item There is no point (actually, no way neither) in referencing an item in an \texttt{itemize}: they all look the same, you can not tell them apart;
\item \texttt{enumerate} items can be referenced by default with the \texttt{enumitem} package, an example \href{https://tex.stackexchange.com/questions/58713/ref-should-use-enumerate-label-name}{here};
\item For \texttt{description} items:
\begin{Verbatim}[samepage=true]
\usepackage{enumitem, hyperref}
\makeatletter
\def\namedlabel#1#2{\begingroup
#2%
\def\@currentlabel{#2}%
\phantomsection\label{#1}\endgroup
}
%...
\begin{description}[style=multiline, labelwidth=1.5cm]
\item[\namedlabel{itm:rule1}{Rule1}] What should I do?
\item[\namedlabel{itm:rule2}{Rule2}] Reference to \ref{itm:Rule1}
\end{description}
\end{Verbatim}
\end{itemize}
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: TABLES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Tables}
\label{sec:Tables}
\begin{itemize}
\item General info \href{https://en.wikibooks.org/wiki/LaTeX/Tables}{here}
\item Position of a table: usually a \texttt{tabular} object is loaded in a \texttt{table} environment, making it a float, that is an element whose position may not be exactly where it is typed, but it is chosen by an internal \TeX{} algorithm. This can be frustrating, I know, just be patient. Some hints about positioning are in \fullref{sec:Floats}.
\begin{itemize}
\item One of the main uses of the \texttt{table} environment is explicitly to make a \texttt{tabular} a float, so that, for instance, a caption (with the \verb|\caption| command) may be added
\end{itemize}
\item \verb|@{<ex>}|: put \texttt{<ex>} at the beginning of the following column on every row
\begin{verbatim}
\begin{tabular}{c@{:}c}
Test & Test \\
ReTest & ReTest
\end{tabular}
\end{verbatim}
\begin{itemize}
\item \verb|@{}|: set the space between two columns to zero
\end{itemize}
\item Fix a table width, you have to use at least once the column type \texttt{X}:
\begin{verbatim}
\usepackage{tabularx}
%...
\begin{tabularx}{<tablewidth>}{XX}
Test & Test \\
ReTest & ReTest
\end{tabularx}
\end{verbatim}
\begin{itemize}
\item Centered \texttt{X}-like column type: \href{https://tex.stackexchange.com/questions/89166/centering-in-tabularx-and-x-columns}{here}
\begin{verbatim}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\end{verbatim}
\end{itemize}
\item Merge cells: multirow \& multicolumn. Attention: multirow needs the \texttt{multirow} package
\begin{verbatim}
\multicolumn{<#cols to merge>}{<type>}{<content>}
\multirow{<#rows to merge>}{<width(or *)>}{<content>}
\end{verbatim}
e.g.: \verb!\multicolumn{2}{c|}{Two columns in one}!
\item Horizontal tables / landscape: use the environment \texttt{sidewaystable} (instead of \texttt{table}) from the package \texttt{rotating}. Other solution found \href{http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/latex/required/tools/longtable.pdf}{here};
\item Wider choice of row / column separators: see package
\href{http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/latex/required/tools/longtable.pdf}{\texttt{hhline}}, or \href{https://ctan.crest.fr/tex-archive/macros/latex/contrib/arydshln/arydshln-man.pdf}{\texttt{arydshln}};
\item Tables spanning more than one pages: use package \href{http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/latex/required/tools/longtable.pdf}{\texttt{longtable}};
\item Table and colors:
\begin{itemize}
\item the reference is \href{http://mirrors.ircam.fr/pub/CTAN/macros/latex/contrib/colortbl/colortbl.pdf}{\texttt{colortbl}} (which may be loaded by passing options \texttt{tables} to package \href{http://mirrors.standaloneinstaller.com/ctan/macros/latex/contrib/xcolor/xcolor.pdf}{\texttt{xcolor}}).
\item Some tips \href{https://texblog.org/2011/04/19/highlight-table-rowscolumns-with-color}{here}.
\item Alternate color row: see \href{https://texblog.org/2011/09/02/coloring-every-alternate-table-row/}{here}.
\end{itemize}
\item For typesetting numerical data (but not necessarily), you may want to have a look at \texttt{pgfplotstable}, \autoref{sec:tikzpgf}.
\item Colored and rounded tables (use of \texttt{TikZ}, \autoref{sec:tikzpgf}): some tips \href{https://tex.stackexchange.com/a/184075}{here} and example in \href{run:./ex_plot.tex}{\texttt{ex\_plot.tex}}.
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: GRAPHICS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Graphics \& Animations}
\label{sec:Graphics}
\begin{itemize}
\item Into to figures and tables (and floats) management \href{https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions}{here} or \href{https://www.overleaf.com/learn/latex/Inserting_Images}{here}.
\item Set the path for the pictures (the directory where the pictures are searched for): from the \href{http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/latex/required/graphics/grfguide.pdf}{\texttt{graphicx}} package \verb|\graphicspath{{pic_dir/}{dir2/}}|.
\item Position of an image: usually an image is loaded in a \texttt{figure} environment, making it a float, that is an element whose position may not be exactly where it is typed, but it is chosen by an internal \TeX{} algorithm. This can be frustrating, I know, just be patient. Some hints about positioning are in \fullref{sec:Floats}.
\item Crop an image
\begin{verbatim}
\includegraphics[<...>, trim={1cm 0 2cm 0}, clip]{img_name}
% trim={left bottom right top}, clip is mandatory
\end{verbatim}
\item Animations. \textbf{Mind that not all the PDF-viewers support the animations}: \texttt{evince} (default pdf viewer of Debian / Calibre / Scibian) does not, \texttt{AdobeReader} does. It seems that \texttt{evince} now supports some animations, at least those loaded with \verb|\movie| (see below)
\begin{itemize}
\item Make animations by showing images one after the other with \href{https://ctan.org/pkg/animate}{\texttt{animate}} package. Suppose you have 1000 images, named \verb|img_<nnnn>| with which you want to create an animation
\begin{verbatim}
\usepackage{animate}
%[...]
%\animategraphics[<options>]{<frame_per_second>}{/path/img_}{<start>}{<end>}
\animategraphics[<...>, autoplay, loop]{40}{img/img_}{0001}{1000}
\end{verbatim}
In \texttt{<options>} one can put standard graphics options, such as \texttt{scale, width},... The option \texttt{every=<num>} allows to choose one image every other \texttt{<num>} images. \texttt{loop} makes starts again the animation when it reaches the end. If the numbering is like \verb|img_1, img_10, img_100|, use
\begin{verbatim}
\animategraphics[<...>, autoplay, loop]{40}{img/img_}{1}{100}
\end{verbatim}
\begin{itemize}
\item You can extract images from a video using
\begin{verbatim}
ffmpeg -i inputfile.avi -r <n_frame_per_second> \
-f image2 -ss <start> -t <duration> output-%3d.jpeg
\end{verbatim}
\end{itemize}
\item Embed an external video. With this strategy, the video is not included in the pdf, in fact, it is just a link, sort of, so that the video is actually read by an external app. That means that if you share the pdf, the video should be joined too.
\begin{verbatim}
\usepackage{multimedia}
%% [...]
\movie[<...>,loop]{<place_holder>}{video.avi}
\end{verbatim}
The place holder is something that is inserted if the video is not found or before that the video starts playing. For example, you can put a static image:
\begin{verbatim}
\movie[loop]{\includegraphics[<...>]{image.png}}{video.avi}
\end{verbatim}
Notice that if you load a video with a path, let's say \texttt{subdir/video.avi} and you want to share the pdf, then the video should lie in the same path in order to be read. For instance, the colleague to whom you sent the pdf, should rebuild the same path.
\begin{itemize}
\item You can create a movie using \texttt{convert}/\texttt{ImageMagick}. \verb|-delay <n>| gives \texttt{n/100} frames per second; default is 1.
\end{itemize}
\begin{verbatim}
convert -quality 100 -delay <n> <images go here> out.mpeg
\end{verbatim}
\end{itemize}
\item (Not \LaTeX-related) Erase background / Change background color of an image: \href{http://www.imagemagick.org/discourse-server/viewtopic.php?t=32305}{here} (if transparent background, the final extension must be \texttt{png}). Run from terminal:
\begin{verbatim}
convert in.{png, pdf, ...} -fuzz 5% -transparent <orig_color> out.png
convert in.{png, pdf, ...} -fuzz 5% -fill <new_color> -opaque <orig_color> \
out.{pdf, png, ...}
\end{verbatim}
For instance, replace white with \texttt{HTML} color \texttt{FAFAFA}
\begin{verbatim}
convert in.jpg -fuzz 5% -fill "#FAFAFA" -opaque white out.jpg
\end{verbatim}
Similarly use \verb|RGB(rrr,ggg,bbb)|.
\item (Not \LaTeX-related) Reduce the size of a pdf: "Let me add one more pdf image, it won't really matter in the size of the final document!" Weeeeeeeell, it might actually matter, in particular if each image is more than 1MB in size. If it is really important, you might want to try to compress it. \href{https://askubuntu.com/a/256449}{Here}'s a tip relying on \texttt{ghostscript}.
\begin{verbatim}
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH \
-sOutputFile=output.pdf input.pdf
\end{verbatim}
Instead, for jpeg images look a possibility is \href{https://stackoverflow.com/a/7262050/12152457}{here}
\begin{verbatim}
convert -strip -interlace Plane -gaussian-blur 0.05 -quality 85% in.jpg out.jpg
\end{verbatim}
You may also try (out will be the \verb|n|\% of the in)
\begin{verbatim}
convert -size <n>% in.jpg out.jpg
\end{verbatim}
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: FLOATS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Floating environments}
\label{sec:Floats}
When writing a long text, the order in the source file is usually ensured in the compiled file. For instance, Section 2 is printed after Section 1 and before Section 3: their order is fixed. Floating environments, or floats, do not have a fixed position: they floats. Take the following example:
\begin{verbatim}
Paragraph one is in pole-position. Go Kimi!
\begin{figure}
\includegraphics{ferrari.pdf}
\end{figure}
Paragraph two is the runner-up.
\end{verbatim}
\LaTeX{} may print the picture between the two paragraph, before paragraph one, or after paragraph two according to its internal layout algorithm. That is what a float is.
\begin{itemize}
\item Position of float: this is slippery ground. Theoretically, \LaTeX{} has an algorithm that computes where it's better to print out a float (a float being something like a \texttt{figure} or \texttt{table} environments), however it sometimes does a bad job and one would like to choose. Well, this is not always possible but one can make an attempt.
\begin{itemize}
\item An intro is available \href{https://www.overleaf.com/learn/latex/Positioning_images_and_tables}{here}: a solution for wrapping floats is also proposed.
\item First, one can tell \LaTeX{} where he prefers to have the float printed. For instance one can pass the following options (e.g.\ \verb|\begin{table}[<opt>]|): \texttt{h} (for \emph{here} or as close as possible), \texttt{t} (for \emph{at the top} of a page), \texttt{b} (for \emph{at the bottom} of a page), \texttt{p} (in \emph{page} of floats only, no text), \texttt{!} (to override the \LaTeX{} algorithm), \texttt{H} (from package \texttt{float}, to force the position exactly \emph{Here}). Indeed, lists in order of preference are accepted: hence, \texttt{htb} means "try to print it here, otherwise at the top of a page, otherwise at the bottom of a page".
\item Sometimes it is not enough. Clearing a page, \verb|\clearpage| or \verb|\cleardoublepage|, usually force to print all the hanging floats, so that, for example, floats form a chapter are found far and in another chapter. This kind of commands are thought for the end of a chapter or of a section, but one can also use \verb|\FloatBarrier| (from the package \href{http://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/placeins/placeins-doc.pdf}{\texttt{placeins}}) that tells \LaTeX{} to print all the hanging floats before trespassing the barrier.
\item \href{http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/LatexTips.html#figplacement}{Here} is a trick to avoid having figures on a page by themselves.
\end{itemize}
\item Captions \& co: suggested \href{https://mirrors.chevalier.io/CTAN/macros/latex/contrib/caption/caption-eng.pdf}{\texttt{caption}} package which allows one to customize the caption of figures and tables and floats in general.
\begin{itemize}
\item Usually, the caption goes before a table, but after a figure, but in any case\ldots
\item Remember to call a \verb|\label{<my_table>}| \textbf{after} a caption, otherwise it does not point to what one wishes.
\item Change caption names, separators: well-detailed \href{https://tex.stackexchange.com/questions/17489/change-caption-name-of-figures}{post} (mind the with or without \texttt{babel} difference, related info also in \fullref{sec:languages}).
\item Caption width: sometimes one would like to choose the caption width, for global effect pass option \verb|width=<len>| when loading \texttt{caption}, for local (only in the environment where it will be placed) \verb|\captionsetup{width=<len>}|.
\item Caption font: use the dedicated options:
\begin{verbatim}
\usepackage[font={small,color=red}]{caption}
\end{verbatim}
\item Package \texttt{caption} provides also the command \verb|\captionof{}| for non-floating environment (hence, pictures not in \texttt{figure}, \texttt{tabular}s not in \texttt{table}). For instance
\begin{verbatim}
\begin{tabular}{l|l}
x&y\\1&2
\end{tabular}
\captionof{A non-floating table}
\end{verbatim}
\end{itemize}
\item Splitting floats into subfloats: package \href{https://mirrors.ircam.fr/pub/CTAN/macros/latex/contrib/caption/subcaption.pdf}{subcaption} provides environments and utilities to divide figure in subfigures. An example for two side-by-side subfigures
\begin{verbatim}
\begin{figure}
\begin{subfigure}{0.48\linewidth}
\includegraphics{A.png}\subcaption{Letter A}
\end{subfigure}
\begin{subfigure}{0.48\linewidth}
\includegraphics{2.png}\subcaption{Number 2}
\end{subfigure}
\end{figure}
\end{verbatim}
\begin{itemize}
\item For tables, use \verb|\subtable|.
\item In order to modify the font as in the previous example, load the same options for \emph{both} \texttt{caption} and \texttt{subcaption}.
\end{itemize}
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: EQUATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Math, Equations \& Theorems}
\label{sec:math}
\begin{itemize}
\item Some good tips about equations and math mode in general can be found \href{https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics}{here}. This short \href{http://www.math.hkbu.edu.hk/TeX/short-math-guide.pdf}{guide} is quite useful, as well. One can find good stuff \href{http://ctan.math.utah.edu/ctan/tex-archive/obsolete/info/math/voss/mathmode/Mathmode.pdf}{here}, too.
\item Math symbols:
\begin{itemize}
\item basic ones can be found \href{https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols}{here}, otherwise, most modern IDE, such as \TeX Maker (cf.~\autoref{sec:texmaker}) provides a list (anyhow, my advice: think in English. For instance $\forall$ is obtained via \verb|\forall|, $\in$ via \verb|\in|).
\item Run on a terminal \verb|texdoc symbols| to get a list math symbols, or \verb|texdoc comprehensive| for "The Comprehensive \LaTeX{} Symbol List" ($>14000$ entries).
\item \href{http://detexify.kirelabs.org/classify.html}{\texttt{Detexify}} (both web and mobile application) lets you draw the sought symbol and returns the associated command (and possibly the package to load).
\item Bold symbols may not always available (for example \verb|\mathbf{\delta}| will print a normal delta). Try package \texttt{bm} and its \verb|\bm{...}| command.
\end{itemize}
\item A little bit about the different environments.
\begin{itemize}
\item \verb|$ [...] $| delimits an inlined equation.
\item \verb|\begin{equation} ... \end{equation}| inserts a \emph{numbered} equation which goes in a \emph{newline by itself} and which is \emph{center}-aligned. In order to avoid numbering add a star \verb|\begin{equation*}| or use the alternative delimiters \verb|\[ ... \]| or \verb|$$ ... $$| (yes, double it). This is called the \emph{display style}.
\item One can force an inlined equation to be typeset as a displayed one by using \verb|\displaystyle|. Look at this: without $\sum_{1}^\infty\frac1n$, with $\displaystyle\sum_{1}^\infty\frac1n$. The opposite effect is obtained with \verb|\textstyle|.
\item \LaTeX{} will change the font according to the type, so for instance in an inline equation or in a sub-/super-script fractions won't be typed over two lines and they'll "compressed". Another example is the limits of an integral or sum sign. Add the command \verb|\displaystyle| to force the behavior of the \emph{display} behavior.
\item The display environment is center-aligned. One may achieved left-alignment (with respect to the position of the equation on the page) by using the \verb|flalign| environment: Mind the \verb|&| at the beginning \emph{and} at the end of the line to force it.
\begin{verbatim}
\begin{flalign}
& \alpha &= \beta & \\
& \gamma &= \delta & \\
\end{flalign}
\end{verbatim}
\item Usually, for every math environment there exists also its \texttt{-ed}-form to be used when math-mode is already activated. Mind:
\begin{minipage}[T]{.35\textwidth}
\begin{Verbatim}[frame=single]
[text-mode: on]
\begin{align}
[math-mode: on]
e^{i\pi}+1=0
\end{align}
[text-mode: on]
\end{Verbatim}
\end{minipage} \hspace*{2em} vs.\hspace*{2em}%
\begin{minipage}[T]{.35\textwidth}
\begin{Verbatim}[frame=single]
[text-mode: on]
\begin{equation}
[math-mode: on]
\begin{aligned}
e^{i\pi}+1=0
\end{aligned}
\end{equation}
[text-mode: on]
\end{Verbatim}
\end{minipage}
\end{itemize}
\item Fractions. Some info \href{https://www.overleaf.com/learn/latex/Fractions_and_Binomials}{here}. The no-fuss command is \verb|\frac{num}{den}| (from \texttt{amsmath}). It will give a nice fraction in display mode, like this
\[
\frac12, \qquad \frac{x}{1+x}, \qquad \frac{x}{1+\frac{1}{x}}
\]
and a more compact style in inline mode, like this $\frac12$, $\frac{x}{1+x}$, $\frac{x}{1+\frac{1}{x}}$.
\begin{itemize}
\item \verb|\dfrac{num}{den}| forces display mode, whereas \verb|\tfrac{num}{den}| forces inline mode: \verb|\dfrac{x}{y}| $\dfrac{x}{y}$ vs.~\verb|\tfrac{x}{y}| $\tfrac{x}{y}$ (in fact, \verb|\frac| automatically chooses between \verb|\tfrac| or \verb|\dfrac| according to the position). Notice, however, that both commands lead to an increased interline with respect to the usual textual one.
\item For good-looking inline fractions, use \verb|\sfrac{num}{dem}|, $\sfrac{1}{2}$, (from package \href{https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/l3packages/xfrac.pdf}{\texttt{xfrac}}) or \verb|\nicefrac{num}{den}|, $\nicefrac{1}{2}$, (from \href{https://ctan.mines-albi.fr/macros/latex/contrib/units/units.pdf}{\texttt{nicefrac}})\ldots or just use the slashed form, $1/2$. The interline space is not increased.
\item For continued fractions, use \verb|\cfrac|
\[ a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cdots}}} \]
\end{itemize}
\item Use \verb|\limits| (respectively \verb|\nolimits|) to force a display-style (resp.~inline-style) of the limits of a symbol in an inlined (resp.~display) math environment. Look at this: without \verb|\limits| $\sum_{1}^\infty\frac1n$, with $\sum\limits_{1}^\infty\frac1n$
\item In order two reference an equation, two common commands are \verb|\ref{<tag>}| and \verb|\eqref{<tag>}| (see \fullref{sec:Referencing} for other commands that add \emph{Equation} automatically). Suppose that you want to reference equation (1). \verb|\ref{...}| will give only the number, hence you may want to use \verb|(\ref{...})|. \verb|\eqref{...}| adds the parenthesis for you, so that you get automatically (1). However, \verb|\eqref{...}| does not work with, for instance, \verb|\textbf|: you'd rather use \verb|\textbf{(\ref{...})}|.
\item Tagged equations: name instead of the usual number. Notice that this works with unnumbered environments as well. \verb|\tag{}| puts parenthesis around the tag, \verb|\tag*{}| does not.
\begin{minipage}{.45\linewidth}
\begin{Verbatim}[frame=single]
\begin{equation*}
\label{eq:euler}
e^{i\pi}+1=0\tag{Euler's}
\end{equation*}
\end{Verbatim}
\end{minipage}\hspace{1cm} gives \hspace{1cm}
\begin{minipage}{.35\linewidth}
\begin{equation*}
\label{eq:euler}
e^{i\pi}+1=0\tag{Euler's}
\end{equation*}
\end{minipage}
Notice that the tag is used when referencing the equation: e.g., here \verb|\eqref{eq:euler}| gives \eqref{eq:euler}.
\item Parentheses:
\begin{itemize}
\item Have a look \href{https://www.overleaf.com/learn/latex/Brackets_and_Parentheses}{here}
\item Types and commands: ``$()$'' \verb|()|; ``$[]$'' \verb|[]|; ``$\{\}$'' \verb|\{\}| (yes, you need a backslash); ``$||$'' \verb!||!; ``$\|\|$'' \verb!\|\|!; ``$\langle\rangle$'' \verb|\langle\rangle|; ``$\lceil\rceil$'' \verb|\lceil\rceil|; ``$\lfloor\rfloor$'' \verb|\lfloor\rfloor|;
\item Sizes:
\begin{itemize}
\item Choosing manually the size by combining one of the parenthesis type and (ascending order) \verb|\big|, \verb|\Big|, \verb|\bigg|, \verb|\Bigg|. E.g.\ $\displaystyle \big(\Big(\bigg(\Bigg($
\item Use \verb|\left( \right)| for parentheses which automatically adapt to the size of the content: e.g.
% Leave it
\begin{tabular}{ll@{\hspace{1em}vs.\hspace{1em}}ll}
$\displaystyle(\sum^N_{0} n)$ & \verb|(\sum^N_{0} n)| & $\displaystyle\left(\sum^N_{0} n\right)$ & \verb|\left(\sum^N_{0} n\right)|
\end{tabular}
\item You can combine different types of parentheses with the left-right construction: $\displaystyle\left(\sum^N_{0} n\right\}$ given by \verb|\left(\sum^N_{0} n\right\}|. Even ``void'' type (use ``\verb|.|'') is accepted: $\displaystyle\left(\sum^N_{0} n\right.$ given by \verb|\left(\sum^N_{0} n\right.|
\item The void type is useful, for instance, when closing a system. See:
% Leave it
\begin{minipage}{.45\linewidth}
\begin{Verbatim}[frame=single]
\begin{equation*}
\left\{
\begin{aligned}
x + y ={}& 5 \\
x - y ={}& 5
\end{aligned}
\right.
\end{equation*}
\end{Verbatim}
\end{minipage}\hspace{1cm} gives \hspace{1cm}
\begin{minipage}{.35\linewidth}
\begin{equation*}
\left\{
\begin{aligned}
x + y ={}& 5 \\x - y ={}& 5
\end{aligned}
\right.
\end{equation*}
\end{minipage}
\item Parenthesis built with the \verb|\left|-\verb|\right| structure should be both in the same scope (for instance in the same cell with \texttt{align}) in order for the environment to be balance. If errors occur, try by adding void delimiters with the ``\verb|.|'' (dot). The following example is useless, but you get the idea
\begin{verbatim}
% CODE:|<start -------------------------------------------- end>|
% | |<start end>| |
\left[\overbrace{a\left.\right]}^{Comment over bracket} \right.
% PDF: |<start ------------ end>|
\end{verbatim}
\end{itemize}
\end{itemize}
\item Matrices:
\begin{itemize}
\item For basic stuff, have a look \href{http://www.sascha-frank.com/Faq/matrices.html}{here}. \texttt{matrix}, \texttt{pmatrix} (parentheses), \texttt{bmatrix} (brackets), \texttt{Bmatrix} (curly), \texttt{vmatrix} (vertical), \texttt{Vmatrix} (double vertical), \texttt{smallmatrix} (small inline matrix).
\item \href{https://mirrors.chevalier.io/CTAN/macros/latex/contrib/nicematrix/nicematrix.pdf}{\texttt{nicematrix}}: powerful package which enables one to have the control on many matrix parameters (for instance, spaces), create external rows/columns, and even tables.
\end{itemize}
\item Cross out term from equation, for instance if they vanish. Example:
\begin{verbatim}
\usepackage[makeroom]{cancel}
%[...]
\[ x + \cancel{y} = \]
\end{verbatim}
\item Boxed equation. The simple one: \verb|\boxed{...}| from the \texttt{amsmath} package. The customizable one: the \texttt{empheq} environment from the \href{https://ctan.org/pkg/empheq}{\texttt{empheq}} package.
\item \texttt{align}-like environments
\begin{itemize}
\item \verb|\\| denotes a new line, \verb|&| an alignment spot, as for the tables.
\item With \texttt{align}, no external math environment is needed and every line has a number (unless a \verb|\nonumber| is given). \texttt{aligned} do not activate the numbering for each line and it needs an outer math environment. Hence, coupling it with \texttt{equation} gives only one number.
\begin{minipage}{.45\linewidth}
\begin{Verbatim}[frame=single]
\begin{align}
aaa &= 0 \\
b &= 100
\end{align}
\begin{equation}
\begin{aligned}
aaa &= 0 \\
b &= 100
\end{aligned}
\end{equation}
\end{Verbatim}
\end{minipage}\hspace{1cm} gives \hspace{1cm}
\begin{minipage}{.35\linewidth}
\begin{align}
aaa &= 0 \\
b &= 100
\end{align}
\begin{equation}
\begin{aligned}
aaa &= 0 \\
b &= 100
\end{aligned}
\end{equation}
\end{minipage}
\item They have an intrinsic structure of \texttt{rlrl...} alignment, meaning that, the first column is right aligned, the second left aligned, and so on. You can tweak this by adding a void column.
\begin{verbatim}
\begin{aligned}
a &= b & text % text is right aligned
c &= d & text % text is right aligned
\end{aligned}
\begin{aligned}
a &= b && text % text is left aligned
c &= d && text % text is left aligned
\end{aligned}
\end{verbatim}
\end{itemize}
\item Numbering and referencing inside a system: \texttt{align} or package \href{https://ctan.org/pkg/empheq}{\texttt{empheq}} are recommended.
\begin{minipage}{.45\linewidth}
\begin{Verbatim}
\begin{empheq}%
[left=\empheqlbrace]{align}
aaa &= 0 \label{eq:emph_a} \\
b &= 1 \label{eq:emph_b}
\end{empheq}
Reference \eqref{eq:emph_a}
and \eqref{eq:emph_b}.
\end{Verbatim}
\end{minipage}\hspace{1cm} gives \hspace{1cm}
\begin{minipage}{.35\linewidth}
\begin{empheq}%
[left=\empheqlbrace]{align}
aaa &= 0 \label{eq:emph_a} \\
b &= 1 \label{eq:emph_b}
\end{empheq}
Reference \eqref{eq:emph_a} and \eqref{eq:emph_b}.
\end{minipage}
\item Sub-equations (get second numbering inside the same equation, for instance (1a), (1b),...): use the \texttt{subequations} environment from the package \texttt{amsmath}. Example:
\begin{subequations}
Euler's: \label{eq:one}
\begin{align}
e^{i\pi}+1=0\label{eq:one_a}\\
\cos(\pi)+1=0\label{eq:one_b}
\end{align}
\end{subequations}
\begin{itemize}
\item ATTENTION: it does NOT switch to math mode, that means that we should call a math-mode-enabling environment inside it:
\begin{verbatim}
\begin{subequations}
Euler's: \label{eq:one}
\begin{align}
e^{i\pi}+1=0 \label{eq:one_a}\\
\cos(\pi)+1=0 \label{eq:one_b}
\end{align}
\end{subequations}
\end{verbatim}
\item In the example here above, unless you changed the default parameters, referencing \verb|eq:one| will give \eqref{eq:one}, \verb|eq:one_a| will give \eqref{eq:one_a} and \verb|eq:one_b| \eqref{eq:one_b}.
\item Problems may arise when coupling it with brackets or \texttt{align}. Two workarounds are found \href{https://tex.stackexchange.com/questions/322087/bracket-in-subequations/323414#323414}{here} and \href{https://tex.stackexchange.com/questions/80134/nesting-subequations-within-align}{here}.
\item Tags: look \href{https://tex.stackexchange.com/questions/284313/how-do-i-tag-a-subequations-environment-as-a-whole}{here}
\end{itemize}
\item Theorems, lemmata, corollaries, definitions, and alike: A nice introduction \href{https://www.overleaf.com/learn/latex/theorems_and_proofs}{here}. The base package is \href{https://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/latex/required/amscls/doc/amsthdoc.pdf}{\texttt{amsthm}}
\begin{itemize}
\item Often, at the ends of a proof (or of other environments if one has defined), a symbol is added to mark the end of it. It may not work well (a blank line is left) if the end happens to coincide with the end of a math environment. In this case, add \verb|\qedhere| before the end of the math environment
\begin{verbatim}
\begin{proof}
A really easy proof:
\begin{align}
2x &= 4\\
x &= 2.\qedhere
\end{align}
\end{proof}
\end{verbatim}
\item Define and use theorem style
\begin{Verbatim}[samepage=true]
\newtheoremstyle{myRemark}% name of the style to be used
{3pt}% space above the theorem. E.g.: 3pt
{3pt}% space below the theorem. E.g.: 3pt
{\itshape}% font to use in the body
{}% measure of space to indent
{\itshape\bfseries}% head font
{.}% punctuation between head and body
{.5em}% space after theorem head; " " = normal interword space
{}% Manually specify head
\theoremstyle{myRemark} % Choose the style
%\newtheorem{env_name_to_call_in_tex}%
% [continuing_the_same_numbering_as_this_thm_style]%
% {Printed name}%
% [second_numbering:reset_when_this_is_called]%
\newtheorem{rem}{Remark}[section] %Style = myRemark
\newtheorem{note}{Note}[section] %Style = myRemark
\theoremstyle{plain}
\newtheorem{thm}{Thm} %Style = plain
\end{Verbatim}
\item Package \href{http://ctan.mines-albi.fr/macros/latex/contrib/thmtools/doc/thmtools-manual.pdf}{\texttt{thmtools}} provides a nice and easy interface for all this definitions, it might be worth it. An example here (\texttt{within} and \texttt{sibling} are not compatible):
\begin{Verbatim}[samepage]
\declaretheorem[
name=Definition, % printed/header name
style=definition, % reference style
within=chapter, % numbering restarts at...
%sibling=theorem, % same numbering as...
qed={$\circ$}, % symbol for QED, if any
refname={def.}, % name used with \autoref, \cref
Refname={Def.}, % name used with \Autoref, \Cref (capitalized)
]{myDefinition} % environment name
\end{Verbatim}
\item Customize the title: \href{https://tex.stackexchange.com/questions/374359/how-to-place-the-definition-title-in-square-brackets-instead-of-paranthesis/374360}{here}
\item Define names for referencing
\begin{verbatim}
\newcommand{\remautorefname}{Remark} % For autoref (hyperref)
%\crefname{<env>}{<singular>}{<plural>} % For cref (cleveref)
\crefname{rem}{Remark}{Remarks}
\end{verbatim}
\end{itemize}
\item Diagrams: \href{http://mirrors.ircam.fr/pub/CTAN/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf}{\texttt{tikz-cd}} might be useful.
\item "\texttt{Too many math alphabets}" error: follow \href{https://texfaq.org/FAQ-manymathalph}{here} and try to limit package \texttt{bm}:
\begin{verbatim}
\newcommand\bmmax{3} % Let it be less than 4 which is the default
\newcommand\mmmax{0} % Let it be less than 3 which is the default
\usepackage{bm}
\end{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% LET THIS BE THE LAST
\item Spacing: whitespaces are skipped in math mode, however, there are several ways to force them. There is even a negative space. See \autoref{tab:math_space}.
\end{itemize}
\begin{table}
\centering
\caption{Spacing in math mode}
\label{tab:math_space}
\begin{tabular}{lllc}
\verb|\!| & negative thin space & \verb|$ a\! b\! c $| & $ a\! b\! c $ \\
\textvisiblespace & none & \verb|$ a b c $| & $ a b c $ \\
\verb|\,| & thin space & \verb|$ a\,b\,c $| & $ a\,b\,c $ \\
\verb|\:| & medium space & \verb|$ a\:b\:c $| & $ a\:b\:c $ \\
\verb|\>| & medium space & \verb|$ a\>b\>c $| & $ a\>b\>c $ \\
\verb|\;| & thick space & \verb|$ a\;b\;c $| & $ a\;b\;c $ \\
\verb|\|\textvisiblespace & thicker space & \verb|$ a\ b\ c $| & $ a\ b\ c $ \\
\verb|\quad| & tab & \verb|$ a\quad b\quad c $| & $ a\quad b\quad c $ \\
\verb|\qquad| & double tab & \verb|$ a\qquad b\qquad c $| & $ a\qquad b\qquad c $ \\
\end{tabular}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTION: BEAMER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%