Source file basics part 1
Below is the source file (.tex) demonstrating the basics of LaTeX.
- Document classes
- White space
- Interword and intersentence spacing
- Italicising, boldface and typewriter styling
- Single and double quotes
% (comment) First text note with sample.cls (this document class controls document formatting)
\documentclass{sample}
\begin{document}
This is where the document begins. You may need to also view this example as a source (tex) file.
LaTeX ignores blank/white spaces and justifies the document itself, placing \textit{interword} and \textit{intersentence} spaces automatically.
To force an interword space, use a lone backslash \textbackslash \textbackslash, so the following \ \ \ \ is four spaces away.
One can also use the tilde \~ character (this will attempt to keep the words on the same line. These~~words~~are~~forced~~to~~be~~separated~~by~~an~~extra~~space.
In LaTeX, one can document (escape) special characters with backslash. For example, comments start with \% (use \textbackslash \% to document the back slash and \%).
LaTeX utilises standard commands, some with parameters. To document to command use the escape sequence \textbackslash command. To invoke a command, e.g. start a new paragraph, use \textbackslash par. (Alternatively, authors can start a new paragraph with two carriage returns.)
Some common comands with parameters: \textbackslash textit\{\} for \textit{italicising}, \textbackslash textbf\{\} for \textbf{boldface} and \textbackslash texttt\{\} for \texttt{typewriter style} text.
Single left and right quotes are handled be ` and ' respectively, `for example'. Double quotes are handled by two left-single ` quotes and then two right-single quotes (apostrophes) ', ``for example''.
\end{document}
The source file and (required) document class file are included. A generated PDF can be found here.