# $\LaTeX$ & Vim
<!-- Put the link to this slide here so people can follow -->
Richard Lai
----
## Outline
1. $\LaTeX$
2. Vim
3. .vimrc
4. practice
5. reference
---
## $\LaTeX$
Just a software system for typesetting documents
----
### What is $\LaTeX$
+ A typesetting system based on $\TeX$
+ Easy to type formulas or equations in mathematics, physics
----
### Why $\LaTeX$ ?

Microsoft word is shxt, really.
----
### [Overleaf](https://www.overleaf.com/)
+ the collaborative, online LaTeX editor that anyone can use.
+ Pay for better experience (faster compilation, AI...etc)

----
## Syntax (?)
```tex=
\commandname[]{}
```
----

----
```tex=
\documentclass{article} % class of document
\usepackage{graphicx} % Required for inserting images
\title{tutorial of latex}
\author{richardlaiis}
\date{December 2024}
\begin{document} % required
\maketitle % title, author and date
\section{Introduction}
\end{document} % required
```
----
```tex=
\usepackage{packge_name} % import a package
```
----
### How to type traditional chinese?
```tex=
\usepackage{xeCJK}
\setCJKmainfont{Noto Serif CJK SC} % 思源宋體
% Noto Sans CJK SC is 思源黑體
```
----
### Basic typesetting
```tex=
\section{Applicaion}
\subsection{software}
\subsection{hardware}
\subsubsection{HDL (Hardware Descriptive Language)}
\section{Conclusion}
```

----
### margin & line space
```tex=
\usepackage[margin=2cm, a4paper]{geometry}
\usepackage{setspace}
\doublespacing % onehalfspacing,
```
----
### insert a image
```tex=
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{float}
\begin{figure}[H]
\centering
\includegraphics[width=1.0\linewidth]{Image/Image.png}
\begin{center}
\href{https://www.youtube.com/watch?v=dQw4w9WgXcQ}{Click this}
\end{center}
\end{figure
```

----
### Lists
```tex=
\begin{itemize}
\item apple
\item mac book
\item hell yeah
\end{itemize}
\begin{enumerate}
\item first step
\item second step
\item last step :)))))
\end{enumerate}
```

----
### table
```tex=
\begin{center}
\begin{tabular}{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}
\end{center}
```

[~~Table generator~~](https://www.tablesgenerator.com/)
----
### [My template](https://github.com/richardlaiis/overleaf-code/)
Use at your own risk.
----
### [math](https://github.com/richardlaiis/overleaf-code/blob/main/math_command.md) - inline


----
### math - display
```tex=
test:
\[\int^b_a \frac{f'(x)}{f(x)}dx=\ln{|f(x)|}+C,\ C\in R\]
```

----
### More to learn
+ add headers/footers
+ citation
+ more complex equation
+ "draw" a graph
---
## Vim
Highly customizable text editor
----

Is it really that hard?
----
### Philosiphy
+ No mouse, only keyboard
----
### Basic
enter vim, go to your WSL, type <code style="color: cyan">vim</code> and enter:

----
### Mode

+ insert mode: Type text in this mode
+ normal mode: Type commands
+ visual mode: Select some texts
----
### Then, how to ~~exit vim~~ type commands?

First, enter the normal mode (press ESC)
----
### How to type commands
+ <code style="color: cyan">:w</code> : 存檔
+ <code style="color: cyan">:q</code> : 離開
+ <code style="color: cyan">:q!</code> : 未存檔強制離開
+ <code style="color: cyan">:wq</code> : 存檔並離開
----
### Movement
+ Using direction keys are too slow! (Maybe)
+ Try using hjkl
+ h for left, l for right, j for down, k for up
----
### Edit
All tasks are done in **normal mode:**
+ <code style="color: cyan">dd</code> : 剪下 cursor 在的那一行
+ <code style="color: cyan">p</code> : paste
+ <code style="color: cyan">yy</code> : 複製 cursor 在的那一行
+ <code style="color: cyan">u</code> : Undo one step
----
### built-in resources
+ Just type `vimtutor` in your terminal

---
## .vimrc
vim script
----

----
### Time limit exceed :(
[my vim configuration](https://github.com/richardlaiis/overleaf-code/blob/main/math_command.md)
---
## Practice
----
### Game
+ https://vim-racer.com/
+ https://vimsnake.com/ (Snake game but vim ver.)
+ https://texnique.xyz/
---
## Reference
+ https://www.overleaf.com/learn/latex/Learn_LaTeX_in_30_minutes
+ https://blog.techbridge.cc/2020/04/06/how-to-use-vim-as-an-editor-tutorial/
{"slideOptions":"{\"transition\":\"fade\"}","title":"LaTeX & vim","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"3f5fe014-25a3-4be4-85ce-7a56506829be\",\"add\":5254,\"del\":2283}]"}