Quick and Dirty LaTeX Tutorial
Quick and Dirty LaTeX Tutorial
\tableofcontents \section{Carnivorous Plants} Here is my first paragraph on carnivorous plants. Here is my second paragraph on carnivorous plants. \end{document} If you create your own example document from the above text, then you will have to write your own Makefile or type the commands by hand. An example Makefile is given below: all: latex tutorial.tex latex tutorial.tex dvips tutorial -o tutorial.ps ps2pdf tutorial.ps Put this text in a file named Makefile that is in the same directory as tutorial.tex. Also add one tab before each of the lines that follow all:. Using the tab key to indent the translation instructions is mandatory because that is the format for a Makefile. Use File...Open or the Open toolbar button to open tutorial.tex if you have created your own rather than using the article_template.
Table
Switch back to the Command Preview notebook page on the LaHelper GUI, and then select the Tables...Table menu item. An example table along with help text will be displayed. Click on the refresh button for the Mini-Print Preview to see a preview of the table. There are a variety of options for creating a table, but the most important thing to notice is that columns are separated by & signs and rows are terminated using a double backslash, \\. Below is a simple example:
\begin{table} \begin{center} \begin{tabular}{ccl} 1.01 & 1.3 & text \\ 2 & 2.3 & text \\ \end{tabular} \caption{Three Blind Mice} \label{tb:Xname} \end{center} \end{table} Sometimes it is easiest to use a spreadsheet application to drag down columns of & signs between the columns of your information. If your information is generated by a script, then printing the information out with the & signs is usually easy to do also. (Note: emacs and vim have block text selection modes that also aid table creation.)
Cross Reference
Now move your mouse back to your text editor where the tutorial.tex file is open. Click to place your cursor below the sentence in the body of the document but before the \end{document} line. Then select the Edit...Paste command from the text editor's menu. (You can also click your third mouse button to paste the text.) You will see the example table appear in your document. Now add a sentence that refers to the table. Use the text below as an example: The information in Table~\ref{tb:Xname} is totally useless. Now save the tutorial.tex file, click the Make button on LaHelper, and restore your postscript viewer. Choose the File...Reload menu item or click on the reload button on the toolbar to see your new document. You will see the table placed near the bottom of the page, and you will notice how the ~\ref{tb:Xname} was replaced with the table number. A cross reference consists of a pair of \label and \ref commands that have the same text inside their curly braces similar to a hyperlink. Click on the Structure...Cross
Reference menu item in LaHelper for a full explanation of the cross referencing command.
Table of Contents
Now add a \tableofcontents command below the \maketitle command in the tutorial.tex document. Click on the Make button and view the results in the postscript viewer. You will see the table of contents appear in your document.
List of Figures
A list of all of the figures in the document will be created using the following command: \listoffigures
List of Tables
A list of the tables in the document is generated using the following command: \listoftables
Bulleted List
An example of how to create a bulleted list is given by the Text...Bulleted List menu item in LaHelper and is repeated below. The itemize environment is used, and each bullet starts with the \item command. That's all there is to it. \begin{itemize} \item Here is a bullet. \item Here is another bullet. \end{itemize}
Numbered List
The following example is similar to the one given by the Text...Numbered List menu item in LaHelper. The format is the same as a bulleted list, but the enumerate environment is used. \begin{enumerate} \item Here is item one. \item Here is item two. \end{enumerate} Bulleted lists and numbered lists can be nested inside each other.
Graphics
Graphics can be included by saving them as Encapsulated Postscript (EPS) or Postscript (PS). The instructions on how to create figures are located in LaHelper's Graphics menu. Because the graphics files are separate from the document, they can be changed without having to open the document and re-insert them. The example below shows the graphic being loaded from a subdirectory named drawings. \begin{figure} \begin{center} \includegraphics[height=3.25in]{drawings/Xname.eps} \caption{Three Blind Mice} \label{fg:Xname} \end{center} \end{figure} The width of the drawing can be specified instead of the height. The graphic will be scaled to this size while maintaining the original aspect ratio.
Here is a superscript example: $x ^ { 2 }$. Here is a subscript: $x_{ 2 }$, and here is a fraction $\frac{ 1 }{ 2 }$. Another quick example is a square root: \sqrt{ x }. Equations should be placed in the equation environment. The \ref command can be used to generate an equation number. Below is an example equation: \begin{equation} f( x ) = A x ^ { 2 } + B x + C \label{eq:Xname} \end{equation} The math markup is incredibly general, and the symbols can be combined in nearly any way that you can imagine. LaTeX is widely known in academic and publishing circles as producing the best quality of typeset mathematics. It has been used to write many textbooks.
Special Characters
LaTeX uses some characters as special markup symbols, so when you want one of these symbols to appear in your document, a special command must be used. Most often the symbol is created by placing a backslash before the character. Below is a list of these commonly used characters: \textbackslash = \ \& = & \$ = $ \% = % \# = # \_ = _ \{ = { \} = } \~ = ~
\^ = ^ `` = Left Double Quotation Marks '' = Right Double Quotation Marks \ldots = ...
Summary
Amazingly enough, enough information has been given here to create a large majority of the documents that people write on a daily basis. One of the keys to using LaTeX is to keep it as simple as possible. Another is to not rely on the visual feedback provided by the postscript viewer. Checking to see how the printed version of the document appears only at key points during the writing process helps the writer to focus on the information and its organization rather than on tweaking its appearance. There are two main constructions in the LaTeX markup, environments and commands. Environments use a \begin{something} and \end{something} pair, and commands are stand alone like \textbf{ that would make this text bold }. Many commands and environments offer optional arguments. These are placed in square brackets before the curly braces. One handy example is \caption[ Short Title ]{ Long Figure or Table Caption Text }. This command will cause the short version of the title to be used in the list of figures or list of tables rather than the long version of the text. This quick tutorial did not touch on creating your own custom commands, because it is important for beginners to learn to use the ones that already exist. The LaTeX commands can help to teach you how to write a well organized document and leave the layout work to the computer.