Latex beginner guide
Hello world in latex
Create a text file (hello.tex) in your home folder with following text:
\documentclass[a4paper,11pt]{article}
\begin{document}
Hello world!
\end{document}
Compile this tex file into dvi file and use xdvi to view it:
latex hello.tex
xdvi hello.dvi
You can also convert it to pdf:
pdflatex hello.tex
xpdf hello.pdf
Structure of latex document
- Latex commands start with a backslash (\).
- Parameters can follow the command.
- Optional parameters are enclosed in [ ] while mandatory ones are enclosed in {
}.
- { } can also be used to terminated a command mixed within some text (to
make it easier for the compiler to understand the command).
- Special characters in latex (#, $, %, ^, &, _, {, }, ~) are escaped with \ except for the \ character itself which is used to break a line.
- To use literal backslash (\) you can use the special command $\backslash$.
- Single line comments start with % while multi-line comments can be enclosed between \begin{comment} and \end{comment} structure.
- Every latex document starts with \documentclass with parameters ([a4paper,11pt]{article})
following it.
Exercises:
1. View latex templates in sql-ledger
2. View latex templates in a text editor like vim to see the color coded syntax which will help you understand the latex template structure in a better way.