## Links & Resources
A collection of random notes to learn more about using *[LaTex](https://en.wikipedia.org/wiki/LaTeX)* and [Overleaf](https://www.overleaf.com/).
- [Overleaf/LaTex tutorials (Overleaf documentation)](https://www.overleaf.com/learn/latex/Tutorials)
- [LaTex using Overleaf (YouTube 28mins)](https://www.youtube.com/watch?v=P5EWoPOnZTU&t=81s)
- [Full LaTex Course (YouTube 1hr 30mins)](https://www.youtube.com/watch?v=fCzF5gDy60g&t=12s)
- [Kyle Butt's LaTeX templates](https://github.com/kylebutts/templates): These look really nice! I learned a bit about what can be done to simplify preamble stuff by looking through these.
- [Trefor Bazzet's LaTeX YouTube Playlist](https://www.youtube.com/watch?v=Jp0lPj2-DQA&list=PLHXZ9OQGMqxcWWkx2DMnQmj5os2X5ZR73): Super thorough and well done — sponsored by Overleaf. **Includes an entire video on writing/organizing a thesis document.**
## Using different Fonts
- [Top 10 LateX fonts](https://r2src.github.io/top10fonts/) (and how to use them properly)
## Useful snippets
### Citations & bibliography
>**TLDR:** Use `natbib`, it's very powerful.
> ([Overleaf documentation](https://www.overleaf.com/learn/latex/Bibliography_management_with_natbib) | [CTAN Official docs](https://ctan.org/pkg/natbib))
#### `natbib` preamble
```latex
\usepackage[square, numbers]{natbib}
\bibliographystyle{abbrvnat}
...
% At the bottom
\bibliography{ref.bib}
```
The `square, numbers` portion includes the reference citations in brackets (as opposed to the default parentheses), and uses numbers.
**`natbib` package options**
- `round` for round parentheses
- `square` uses square brackets
- `curly` curly braces
- `angle` angle braces or chevrons
- `semicolon` separates multiple citations with semicolons
- `colon` same as `semicolon`
- `comma` separate multiple citations with commas
- `authoryear` for author-year citations
- `numbers` for numerical citations
- `super` superscripts for numerical citations, as in _Nature_
- `sort` orders multiple citations according to the list of references
- `sort&compress` same as `sort` but multiple numerical citations are compressed if possible
- `compress` compress without sorting
- `longnamefirst` the full name of the author will appear in the first citation of any reference
- `sectionbib` To be used with the package **chapterbib** to add the bibliography to the table of contents as a unnumbered section instead of an unnumbered chapter
- `nonamebreak` prevents hyphenation of author names
- `elide` to omit common elements of merged references
#### Using APA style format
If you want to use APA format, then things get a bit more complicated because you need to use the `apacite` package (integrated with `natbibapa`).
See the [CTAN Docs](https://www.ctan.org/pkg/apacite) for details.
##### Preamble
First, you should use the below in your preamble.
```latex
\usepackage[natbibapa]{apacite}
\bibliographystyle{apacite}
...
% At the bottom
\bibliography{ref.bib}
```
##### `cite` functions
The major difference is that the typical `\cite` function changes -> to -> `\citep`.
See the [CTAN Docs](https://www.ctan.org/pkg/apacite) for all function details.
### Control the color of links in document
#### One line blunt-force
Want to remove the red and green boxes below?
![[academicResources_uglyBoxes.png]]
Simply include the below...
```latex
\usepackage[hidelinks]{hyperref}
```
... instead of the standard ...
```latex
\usepackage{hyperref}
```
See this [stackexchange](https://tex.stackexchange.com/questions/823/remove-ugly-borders-around-clickable-cross-references-and-hyperlinks) answer for more details.
##### Two things to note
1. According to the `natbib` [official CTAN docs](https://ctan.org/pkg/natbib), the compatibility between these two packages ( `hyperref` and `natbib`) is "of a mutual nature: both packages contain coding that interact with that of the other" (see *HyperTeX Compatibility* section, pp. 17).[^1]
2. This is a `hyperref` document-wide change, meaning that this edits the whole document for all links.
#### Full control (preferred)
As mentioned [[LaTex and Overleaf#Two things to note | above]] (note 1) `natbib` and `hyperref` work together. So you can configure `hyperref` to control the colors utilized for internal document links, citations, etc. with the `\hypersetup{}` command like the below.
```latex
\usepackage[hidelinks]{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=black,
citecolor=black,
urlcolor=blue
}
```
See the [overleaf reference guide](https://www.overleaf.com/learn/latex/Hyperlinks#Reference_guide) for what the above options mean and what else can go within this function.
The above setting makes pretty much everything black except for entities that are placed inside of `\url{}`, which will appear blue.
---
#### Related
[[academic_resources]]
[^1]: Sounds confusing as hell to manage!