\documentclass[12pt]{article} % Last updated on June 16, 2025. \usepackage{graphicx} % The following is a tutorial of learning to program in LaTeX. % Included in this tutorial are some examples of defining your own LaTeX % commands. Note that anything after a percent sign (%) is considered a % comment in LaTeX. \newcommand{\sigline}{\rule[-0.8mm]{60mm}{0.2mm}} \newcommand{\scoreline}{\rule[-0.8mm]{15mm}{0.2mm}} \newcommand{\mybox}{\fbox{\parbox[c][3mm]{4mm}{\ \ }}\ \ } \newcommand{\ret}{$<$\tectsf{return}$>$} \newcommand{\ctrl}{$<$\textsf{Ctrl}$>$} \newcommand{\ie}{\textit{i.e.},\ } \newcommand{\eg}{\textit{e.g.},\ } \newcommand{\ea}{\textit{et~al.}\ } \newcommand{\teff}{T_{\mbox{{\small eff}}}} \newcommand{\lappxe}{\ ^{<}_{\sim}\ } \newcommand{\gappxe}{\ ^{>}_{\sim}\ } \newcommand{\apj}{ApJ} \newcommand{\apjs}{ApJS} \newcommand{\aj}{AJ} \newcommand{\ana}{A\&A} % The following sets the margin limits and other page characteristics for % the printed PDF document. \setlength{\topmargin}{-0.5in} \setlength{\oddsidemargin}{0.0in} \setlength{\textwidth}{6.5in} \setlength{\textheight}{9.0in} \setlength{\parskip}{20pt} % How much space to include between paragraphs. \setlength{\parindent}{0pt} % Do not indent the first line of paragraphs. \pagestyle{plain} % Use this for starters. It puts the page number at the bottom of a page. % \begin{document} \begin{center} \large \textbf{PHYS-4007/5007: Computational Physics}\\*[4mm] \textbf{Tutorial \#3}\\*[2mm] \textbf{Learning the \LaTeX\ Mark-Up Language} \end{center} \thispagestyle{empty} % Do not include a page number on this first page. %\vspace*{-6mm} % How to shrink vertical space. \section{Introduction} \LaTeX\ is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. \LaTeX\ is the de facto standard for the communication and publication of scientific documents. \LaTeX\ is available as free software for vitually all operating systems. \LaTeX, which is pronounced `\textit{Lah-tech}' or `\textit{Lay-tech},' is a document preparation system for high-quality typesetting. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing. Section III of the course notes goes into detail on the \LaTeX\ Mark-Up Language. \textbf{\LaTeX\ Features:} \vspace*{-6mm} \begin{itemize} \item Typesetting journal articles, technical reports, books, and slide presentations. \item Control over large documents containing sectioning, cross-references, tables and figures. \item Typesetting of complex mathematical formulas. \item Advanced typesetting of mathematics with AMS-LaTeX. \item Automatic generation of bibliographies and indexes. \item Multi-lingual typesetting. \item Inclusion of artwork, and process or spot colour. \item Using PostScript or Metafont fonts. \end{itemize} \vspace*{-5mm} % The section command puts the enclosed text into a section label environment. % Since it inserts a large amount of vertical space before and after the label, % I have forced LaTeX to shrink this space. \section{Getting Started with \LaTeX} Log into your \textsf{Linux} account, open a terminal window, and change directory to your `\textsf{tex}' subdirectory. Now open the web browser and go to the \textsf{Computer Programming Tutorials Web Page} on the course web page: \\ \vspace{-8mm} \hspace*{6mm} \textsf{https://faculty.etsu.edu/lutter/courses/phys4007/} \vspace{-4mm} Scroll down to the `\textsf{Programs and Supplemental Files for the Tutorials}' table and click on the `Tutorial03\_LaTeX.tex' link in the data table on the \textsf{Tutorial 3} row. Following this, open a new file in your \textsf{tex} subdirectory using the \textsf{emacs} editor with \\*[2mm] \hspace*{6mm} \textsf{$>$ emacs Tutorial03\_LaTeX.tex \&} \\*[2mm] where the `\textsf{$>$}' symbol represents the \textsf{Linux} prompt (remember, don't type this symbol, it's only included above to indicate that this is a \textsf{Linux} command). Note that the ampersand symbol (\&) puts the process in ``background'' mode so that you can get back the \textsf{Linux} command prompt in the terminal window to carry out additional commands. Now copy the text in your web browser to the \textsf{emacs} GUI window, then save this file. Now go back to the terminal window and issue the command: \\*[2mm] \hspace*{6mm} \textsf{$>$ latex Tutorial03\_LaTeX} \\*[2mm] -- do not include the filename suffix ``\textsf{.tex}'' in this command. You will see a variety of output printed to the screen indicating any issues that the \LaTeX\ compiler may have found. Following this, issue the \textsf{Linux} command: \\*[2mm] \hspace*{6mm} \textsf{$>$ xdvi Tutorial03\_LaTeX \&} \\*[2mm] and again, don't include the ``\textsf{.dvi}'' filename suffix. Click on the \textsf{xdvi} GUI and examine the document that was created. \vspace*{-5mm} \section{Sections, Tables, and Lists} \vspace*{-5mm} This shows how one uses the \textsf{$\backslash$section} command to make new sections. In addition to a page counter and figure counter, \LaTeX\ also has a variety of other counters, including the `section' counter. Section titles are labeled with current numeric section counter. For instance, to create the section title above, which is the third section of this tutorial, I just issued the following command in this \LaTeX\ document: \hspace*{6mm} $\backslash$\textsf{section}\{\textsf{Sections, Tables, and Lists}\} There are a variety of ways to create tables in \LaTeX. We will first look at the \textsf{tabular} environment. The following is an example of using the \textsf{tabular} environment, first the coding in the actual \LaTeX\ file, then how this will look in the output file (\ie the dvi and pdf files). In the \LaTeX\ file (\eg Tutorial03\_LaTeX.tex): \newpage \begin{verbatim} \begin{tabular}{rccl} \hline \textbf{Decimal} & \textbf{Binary} & & \textbf{Name} \\ \textbf{Value\ \ } & \textbf{Value} & \textbf{Symbol} & \textbf{Description} \\ \hline 0\hspace*{6mm} & 00000000 & NUL & Null character \\ 1\hspace*{6mm} & 00000001 & SOH & Start of Heading \\ 2\hspace*{6mm} & 00000010 & STX & Start of Text \\ \end{tabular} \end{verbatim} \vspace*{-5mm} The resulting table in the dvi and pdf files: \begin{tabular}{rccl} \hline \textbf{Decimal} & \textbf{Binary} & & \textbf{Name} \\ \textbf{Value\ \ } & \textbf{Value} & \textbf{Symbol} & \textbf{Description} \\ \hline 0\hspace*{6mm} & 00000000 & NUL & Null character \\ 1\hspace*{6mm} & 00000001 & SOH & Start of Heading \\ 2\hspace*{6mm} & 00000010 & STX & Start of Text \\ \end{tabular} For the tabular environment, the number of columns in the table is indicated in the $\backslash$begin \{tabular\} statement with the \{rccl\} option. This tells \LaTeX\ to make a table with 4 columns, the first being right-justified, the 2nd and 3rd columns being center-justified, and the 4th being left-justified. $\backslash$hline tells \LaTeX\ to draw a horizontal line across the table. $\backslash$textbf\{\} tell \LaTeX\ to put the text in between the curly braces in boldface font. $\backslash$hspace tells \LaTeX\ to add a horizontal space of 6 millimeters, where the asterisk (*) force these spaces to be included. The ampersand symbol (\&) marks the column divisions and the double backslashs tells \LaTeX\ this is the end of the row. This \LaTeX\ tutorial will discuss how to change the appearance of tables a bit later. Another useful environment for making tables is the \textsf{tabbing} environment. The tabbing environment provides a way to align text in columns. It works by setting tab stops and tabbing to them much the way you do with an ordinary typewriter. The next page shows an example of using the `tabbing' environment. In the \LaTeX\ file, the first few lines of this environment looks like this producing the output on the next page): \vspace*{-5mm} \begin{verbatim} \begin{tabbing} XXXXXXXXXXXXXXXXXXXXXXXXXXXX \= \kill \> \\ \> \\ PRINCIPAL INVESTIGATOR: \> \rule[-0.8mm]{60mm}{0.2mm} \\ \> Type your name here \\ \> \\ \end{verbatim} \vspace*{-5mm} and the final line of this environment is indicated with $\backslash$end\{tabbing\}. \newpage \begin{tabbing} XXXXXXXXXXXXXXXXXXXXXXXXXXXX \= \kill \> \\ \> \\ PRINCIPAL INVESTIGATOR: \> \rule[-0.8mm]{60mm}{0.2mm} \\ \> Type your name here \\ \> \\ NAME AND ADDRESS OF THE \> East Tennessee State University \\ ORGANIZATION: \> Department of Physics and Astronomy \\ \> Johnson City, TN 37614 \\ \> \\ SUBMISSION DATE: \> 19 September 2025 \\ \> \\ CLASS STATUS AND MAJOR: \> Senior in Physics \\ \> \\ MACHINE ARCHITECTURE: \> Intel Core 2, 64-bit CPU \\ \> \\ OPERATING SYSTEM: \> Ubuntu Linux \\ \> \\ PROGRAMMING LANGUAGE: \> Fortran 77 and Python \\ \> \\ \> \\ \> \\ GRANT OFFICIAL SIGNATURE: \> \rule[-0.8mm]{60mm}{0.2mm} \\ \> Dr.\ Donald G. Luttermoser \\ \> East Tennessee State University \\ \> \end{tabbing} \vspace*{-5mm} In addition to tables, one often needs to display lists. The following shows the use of the \textsf{itemize} environment: \begin{itemize} \item High-dispersion spectra of the Mg II $h$ and $k$ resonance lines are a very sensitive diagnostic of temperature reversals in the atmospheres of stars due to their high opacity in relatively low-temperature regimes ($\sim$5000~\AA ). \item The Fe~II multiplets are a major source of cooling in these types of stellar atmospheres (Judge \& Neff 1990). \item The line strengths of the C~II] UV0.01 multiplet are sensitive to the electron density of the emitting region (Stencel \ea 1981; Lennon \ea 1985). \end{itemize} At this point in this \LaTeX\ tutorial, change this itemized lists from a ``bulleted'' list to a numeric list. To do this, change the word ``\textsf{itemize}'' in the \textsf{$\backslash$begin\{itemize\}} and \textsf{$\backslash$end\{itemize\}} commands to ``\textsf{enumerate}'' so that these commands read: \textsf{$\backslash$begin\{enumerate\}} and \\ \textsf{$\backslash$end\{enumerate\}}. Recompile your \LaTeX\ document to see how this itemized list changes in appearance (as shown here): \begin{enumerate} \item High-dispersion spectra of the Mg II $h$ and $k$ resonance lines are a very sensitive diagnostic of temperature reversals in the atmospheres of stars due to their high opacity in relatively low-temperature regimes ($\sim$5000~\AA ). \item The Fe~II multiplets are a major source of cooling in these types of stellar atmospheres (Judge \& Neff 1990). \item The line strengths of the C~II] UV0.01 multiplet are sensitive to the electron density of the emitting region (Stencel \ea 1981; Lennon \ea 1985). \end{enumerate} \vspace*{-5mm} \section{Equations} \vspace*{-5mm} One of the things that makes \LaTeX\ so useful to physicists, astronomers, and mathematicians is its ability to create equations and formulae in papers in a relatively easy way. There are a variety of ways to display mathematics in papers which we will work on here. If you need to include an equation in the main body of a paragraph, then use the dollar sign as delimiters around the equation, for instance \$F = m a\$ produces $F = m a$. Let's say that we want a little more space between the `$m$' and the `$a$' in this equation. We would then insert a small space with the `$\backslash$,' marker, producing $F = m\, a$. To make a numbered, center-justified equations, one uses the \textsf{equation} environment: \begin{equation} F_{\mbox{{\scriptsize tot}}} = \sum_{i=1}^{N} F \left[ t, r(t), v(t) \right] = m a = m \frac{dv(t)}{dt} = m \frac{d^{2} r(t)}{dt^{2}}\ . \end{equation} If instead, we wanted an unnumbered center-justified equation, we would use the \textsf{displaymath} environment: \begin{displaymath} F_{\mbox{{\scriptsize tot}}} = \sum_{i=1}^{N} F \left[ t, r(t), v(t) \right] = m a = m \frac{dv(t)}{dt} = m \frac{d^{2} r(t)}{dt^{2}}\ . \end{displaymath} If we need to display a set of equations that are numbered, we use the \textsf{eqnarray} environment: \begin{eqnarray} v & = & \frac{dr(t)}{dt} = \dot{r} \hspace*{10mm} (\mbox{for velocity}) \\ a & = & \frac{dv(t)}{dt} = \frac{d^{2}r(t)}{dt^{2}} = \ddot{r} \hspace*{10mm} (\mbox{for acceleration}), \end{eqnarray} or if we would rather not have numbers associated with these equations, we would use the `\textsf{eqnarray$\ast$}' environment: \begin{eqnarray*} v & = & \frac{dr(t)}{dt} = \dot{r} \hspace*{10mm} (\mbox{for velocity}) \\ a & = & \frac{dv(t)}{dt} = \frac{d^{2}r(t)}{dt^{2}} = \ddot{r} \hspace*{10mm} (\mbox{for acceleration}), \end{eqnarray*} Please note the use of the ampersand symbol (\&) in the equation array environment to separate the left-hand side of the equation (typically with only one variable present), the center column containing the equal sign, and the right-hand side of the equation. \LaTeX\ will make sure the center column with the equal signs line up in the same vertical column on the page. \vspace*{-5mm} \section{Including Figures} \vspace*{-5mm} Figures can be included in the \LaTeX\ mark-up language as well. We can either have a figure by itself or in a \textsf{figure} environment with a figure number and a caption. There are a variety of ways to add figures to a manuscript. I will describe two here. The first I will call the ``\textbf{Classical}'' way using the $\backslash$\textsf{special} command, and the other, I will call the ``\textbf{Modern}'' way using the \textsf{graphicx} package. \vspace{-5mm} \subsection{The ``Classical'' Way of Adding Figures} The $\backslash$\textsf{special} command in \LaTeX\ is a low-level command used to send instructions to the device driver (the program that converts the DVI output from \LaTeX\ into a displayable or printable format like PDF or PostScript). In ``classical'' \LaTeX, the $\backslash$\textsf{special} command is often used to insert figures, typically stored in \textit{encapsulated postscript} files (with a filename suffix of `.eps'). We will show how to use the $\backslash$\textsf{special} command here. First, from the \textsf{Computer Programming Tutorial} web page, download the file \textsf{temptex.eps} from the `\textsf{Programs and Supplemental Files for the Tutorials}' table to the directory you are currently working (\ie the \textsf{/tex} subdirectory). Now go to your \LaTeX\ file in the \textsf{emacs} GUI. Scroll down until you find the first instance of the $\backslash$\textsf{special} command. Note that we need to make some blank space in the document before inserting the figure. I typically assume a vertical size of the figure anywhere between 2.5 inches to 3.5 inches. Prior to the $\backslash$\textsf{special} command, let's create a vertical space of size 3.2 inches with the command $\backslash$\textsf{vspace*\{3.2in\}}, where the asterisk (*) forces that vertical space to be made at that place. Following this we will now insert the figure stored in the \textsf{temptex.eps} file using the $\backslash$\textsf{special} command: \hspace*{6mm} $\backslash$\textsf{vspace*\{3.2in\}} \\ \hspace*{6mm} $\backslash$\textsf{special\{psfile=temptex.eps hoffset=0 voffset=0 hscale=100 vscale=100\}} \vspace*{3.2in} \special{psfile=temptex.eps hoffset=0 voffset=0 hscale=100 vscale=100} We see that this figure is a little too big and that it is not centered in the space that we have allowed for it. To correct this, let's first scale the figure down to 70\% of its current size by setting \textsf{hscale} (horizontal scale) and \textsf{vscale} (vertical scale) from 100 to 70 and recompile: \hspace*{6mm} $\backslash$\textsf{vspace*\{3.2in\}} \\ \hspace*{6mm} $\backslash$\textsf{special\{psfile=temptex.eps hoffset=0 voffset=0 hscale=70 vscale=70\}} \newpage \vspace*{3.2in} \special{psfile=temptex.eps hoffset=0 voffset=0 hscale=70 vscale=70} The figure now fits in the space we allowed for it, but it is not centered. Now we will reposition this figure so that it is centered in the space that we made for it. First we need to shift it downward --- as such, change \textsf{voffset} (vertical offset) from 0 to -30 (where these numbers have units of `points,' note that there are 72 points per inch on the document). %This picture is now vertically centered, Now we must center it horizontally. As can be seen, we need to shift this picture a bit to the right --- as such, change \textsf{hoffset} (horizontal offset) from 0 to 30. \hspace*{6mm} $\backslash$\textsf{vspace*\{3.2in\}} \\ \hspace*{6mm} $\backslash$\textsf{special\{psfile=temptex.eps hoffset=30 voffset=-30 hscale=70 vscale=70\}} \vspace*{3.2in} \special{psfile=temptex.eps hoffset=30 voffset=-30 hscale=70 vscale=70} At this point, the figure is well placed for the space we have allowed for it. \vspace{-5mm} \subsection{The ``Modern'' Way of Adding Figures} As you can see, inserting figures in the ``classical'' way is not an \textit{exact science} --- there's a lot of experimentation to get the figure `just right.' Due to the difficulties in handling graphics, figures, and pictures in \LaTeX\ and \TeX, the CTAN (Comprehensive TeX Archive Network) group have developed packages that can be used in either \TeX\ or \LaTeX\ documents. The three most popular are the following: \begin{itemize} \item The \textsf{color} package: \LaTeX 's color support is built around the idea of a system of \textit{color models}. The color models supported by a driver may vary, but typically include: \begin{itemize} \item \textsf{rgb}: Red Green Blue. A comma separated list of three real numbers between 0 and 1 giving the components of the color. \item \textsf{cmyk}: Cyan Magenta Yellow, [K]Black. A comma separated list of four real numbers between 0 and 1 giving the components of the color according to the additive model used in most printers. \item \textsf{grey}: grayscale. A single real number between 0 (black) and 1 (white). \item \textsf{named}: Colors accessed by name selected from a list of predefined colors is used, \eg `LightBlue'. \end{itemize} \item The \textsf{graphics} package: The `standard' graphics package. \item The \textsf{graphicx} package: The `extended' or 'enhanced' graphics package. \end{itemize} \vspace*{-6mm} One loads any of these packages in the \textit{Preamble} of the \LaTeX\ document, typically right after the $\backslash$\textsf{documentclass} statement, \eg \hspace*{6mm} $\backslash$\textsf{usepackage\{graphicx\}} There are many options you can use with these packages which are too numerous to mention here. One can download a ``\textit{Guide to Graphics in LaTeX}'' at the following website: \hspace*{6mm} \textsf{https://ctan.org/pkg/graphicx} To demonstrate the ease at including a figure with the \textsf{graphicx} package, all we have to do is issue one command in your \LaTeX\ file: \hspace*{6mm} \textsf{$\backslash$includegraphics[width=0.75$\backslash$textwidth]\{temptex.eps\}} where here we are using the `width' option to scale the size of the figure to be 75\% of the $\backslash$textwidth of the document. Note that the vertical scale (height) will also be set to 75\%. Here is the result of this command:\\ % \includegraphics[width=0.75\textwidth]{temptex.eps} \vspace*{-10mm} Note that the figure is not quite centered horizontally. We can fix this by including \textsf{$\backslash$includegraphics} command in a `center' environment: \hspace*{6mm} \textsf{$\backslash$begin\{center\} $\backslash$includegraphics[width=0.75$\backslash$textwidth]\{temptex.eps\} $\backslash$end\{center\}} \\ % \vspace*{-15mm} \begin{center} \includegraphics[width=0.75\textwidth]{temptex.eps} \end{center} \vspace*{-12mm} Finally note that whereas the $\backslash$\textsf{special} command typically requires the figure files to be Postscript files, the \textsf{graphics} and \textsf{graphicx} packages supports virtually all image file types (\eg JPEG [.jpg filename extension], GIF, TIFF, BMP, etc.) as well as Postscript files. \vspace{-5mm} \subsection{Adding Figures in a Figure Environment} %Next, we will place this figure in a \textsf{figure} environment. At first, we %will use the same settings as we did for the figure on the previous page. The %first thing we note is that \LaTeX\ has placed this figure at the top of this page. %Note that we prefer to have this figure show up after this paragraph. We can %force \LaTeX\ to place it at this location by issuing a `[h]' keyword after the %$\backslash$begin$\{$figure$\}$ command. %\begin{figure} % [h] %\vspace*{2.8in} %\caption{A sample encapsulated postscript figure.} %\special{psfile=temptex.eps hoffset=30 voffset=-30 hscale=70 vscale=70} %\end{figure} %At this point we see that the $x$-axis label falls below the figure caption. %Since we have enough room to move the figure up using the voffset keyword, go %ahead and change -30 to 0 and recompile your \LaTeX\ file. We now see that %the $x$-axis label is above the figure caption, however we don't have quite %enough space between the last paragraph and the top of the figure. As such, %we will increase the size of the vertical space from 2.8 inches to 3.0 inches %in the \textsf{figure} environment. At this point, I think we are satisfied %with the placement of this figure in the floating \textsf{figure} environment. What we have been doing so far is just inserting figures into the text of the manuscript. However, in textbooks and scientific manuscripts, figures are included with Figure numbers and captions. This is handled in \LaTeX\ with the `\textsf{figure}' environment. This environment is what is known as a \textit{floating} environment, meaning that \LaTeX\ will insert the figure where ever it `feels' it looks the best. We can override this by placing positioning options with the $\backslash$\textsf{begin\{figure\}} statement (t = top of page, b = bottom of page, h = current location in the text, p = placed on a separate page at the end of the manuscript). For instance, the following lines of \LaTeX\ code will produce the following figure environment in the paper:\\ % \vspace*{-10mm} \begin{figure}[h] \hspace*{10mm} \includegraphics[width=0.75\textwidth]{temptex.eps} \caption{An Encapsulated Postscript Figure.} \end{figure} \begin{verbatim} \begin{figure}[h] \hspace*{10mm} \includegraphics[width=0.75\textwidth]{temptex.eps} \caption{An Encapsulated Postscript Figure.} \end{figure} \end{verbatim} Note that instead of using the `centering' environment for the figure placement, I forced a horizontal space of 10 millimeters in front of the figure, giving a better placement of the figure with respect to the figure caption. \subsection{Adding Picture Files} At this point, once again go to the \textsf{Computer Programming Tutorial} web page and now download the file \textsf{temptex.bmp} from the `\textsf{Programs and Supplemental Files for the Tutorials}' table to the directory you are currently working (\ie \textsf{/tex} subdirectory) As mentioned above, the \textsf{graphics} and \textsf{graphicx} packages allow a user to use any type of image, picture, and photograph files (\eg JPEG, GIF, TIFF, and BMP). Note, however, that these picture file types do not include \textit{size} information that \LaTeX\ requires. Instead, one has to specify the size of the picture in the $\backslash$\textsf{includegraphics} command. There are a variety of ways of handling this, including: \begin{itemize} \item Specify the size in units of measure (\eg mm, cm, inch): \hspace*{6mm} $\backslash$\textsf{includegraphics[height=60mm, width=100mm]\{temptex.bmp\} } \item Specify the `bounding box' locations in points (= 1/72 inches): \hspace*{6mm} $\backslash$\textsf{includegraphics[bb=0 0 320 240]\{temptex.bmp\} } \end{itemize} \begin{figure}[ht] \centering \includegraphics[height=60mm, width=100mm]{temptex.bmp} \caption{The above is a bitmap image.} \end{figure} The following lines of \LaTeX\ produced the above figure (Fig.\ 2). \vspace*{-6mm} \begin{verbatim} \begin{figure}[ht] \centering \includegraphics[height=60mm, width=100mm]{temptex.bmp} \caption{The above is a bitmap image.} \end{figure} \end{verbatim} \section{The Table Environment} \vspace*{-5mm} We will next work with the \textsf{table} environment. Let's use the table we printed on Page 3 of this Tutorial and insert it in the \textsf{table} environment as shown below. \begin{tabular}{rccl} \hline \textbf{Decimal} & \textbf{Binary} & & \textbf{Name} \\ \textbf{Value\ \ } & \textbf{Value} & \textbf{Symbol} & \textbf{Description} \\ \hline 0\hspace*{6mm} & 00000000 & NUL & Null character \\ 1\hspace*{6mm} & 00000001 & SOH & Start of Heading \\ 2\hspace*{6mm} & 00000010 & STX & Start of Text \\ \end{tabular} Now before the \textsf{$\backslash$begin\{tabular\}\{rccl\}} line, insert the line \textsf{$\backslash$begin\{table\}}, and after the \textsf{$\backslash$end\{tabular\}}, insert the line \textsf{$\backslash$end\{table\}}. %and recompile your code. Next, let's center the table on the page. We do this by inserting the line \textsf{$\backslash$begin\{center\}} after the \textsf{$\backslash$begin\{table\}} line and enter \textsf{$\backslash$end\{center\}} after the \textsf{$\backslash$end\{tabular\}} line (and before the \textsf{$\backslash$end\{table\}} line) and recompile the code at the Linux prompt. Click on the \textsf{xdvi} GUI to see how this has changed your document. We now see that this table has move to the top of the following page. This occurred because the `table' environment is \textit{floating} just like the `figure' environment. We can force the table to appear at a specific location by using the position options mentioned for the `figure' environment. %Since we don't %want the table to appear before the position of where it is at in the \LaTeX\ %file, insert `[h]' keyword after the \textsf{$\backslash$begin\{table\}} command. We next want to add some vertical lines in this table to separate each column with a line and completely enclose the table in a box. To do this, input the `$|$' character in the \textsf{$\backslash$begin\{tabular\}} line so that it reads:\\ \vspace*{-5mm} \textsf{$\backslash$begin\{tabular\}\{$|$r$|$c$|$c$|$l$|$\}} then insert an \textsf{$\backslash$hline} command just before the \textsf{$\backslash$end\{tabular\}} line. Recompile and look at the output in the \textsf{xdvi} GUI. Finally, let's include a caption for this table. In scientific journals, table captions typically come at the top of a table. After the \textsf{$\backslash$begin\{center\}} line, insert the following line: \vspace*{-3mm} \textsf{$\backslash$caption\{Portion of the ASCII Set of Symbols\}} \vspace*{-3mm} Recompile and examine the resulting \textsf{dvi} file. When all is said and done, the data table should appear as shown in Table 1. \begin{table} % \begin{center} % \caption{Portion of the ASCII Set of Symbols} \begin{tabular}{|r|c|c|l|} \hline \textbf{Decimal} & \textbf{Binary} & & \textbf{Name} \\ \textbf{Value\ \ } & \textbf{Value} & \textbf{Symbol} & \textbf{Description} \\ \hline 0\hspace*{6mm} & 00000000 & NUL & Null character \\ 1\hspace*{6mm} & 00000001 & SOH & Start of Heading \\ 2\hspace*{6mm} & 00000010 & STX & Start of Text \\ \hline \end{tabular} \end{center} % \end{table} % \vspace*{-5mm} \section{Special Fonts and Characters} \vspace*{-5mm} At this point, go ahead and try different things with this \LaTeX\ program, for instance, making some of the text boldface with the $\backslash$textbf$\{$\ $\}$ environment or italics with the $\backslash$textit$\{$\ $\}$ environment. Note that there is also a sans-serif font. The command for this is $\backslash$textsf$\{$\ $\}$. Go through this \LaTeX\ document and change some of the phrases and/or sentences to each of these 3 fonts. When a student first learns to create a manuscript by writing a program in \LaTeX, one of the most difficult topics is realizing that you can't just clip and paste text from one document into the \LaTeX\ file. This is because a \LaTeX\ program must be written with standard ASCII characters (see \S I.E of the notes). For instance, if you were to copy text from an external file with the pi symbol ($\pi$), it might show this symbol in the \textsf{emacs} GUI, but when you compile your \LaTeX\ file, you will note that the $\pi$ symbol is not shown in the DVI or PDF file. Instead, we need to make the $\pi$ symbol in math mode: \$$\backslash$pi\$. In addition, some of the characters in standard ASCII (\ie the keys on an American keyboard) have special meanings in \LaTeX. For instance the dollar sign, which put text following this symbol into math mode (as shown with the pi symbol above). To actually print the dollar sign, we must put a `backslash' in front of the dollar symbol ($\backslash$\$). There are a significant number of these special characters in \LaTeX\ which require using the backslash to print out these characters. The most common are \$, \#, \%, \{, \}, \_, and \&. Also, the tilde symbol ($\sim$) is used to stop \LaTeX\ from separating two words in a document at the end of a line. To actually print this symbol, you have to go into math mode and use the $\backslash$\textsf{sim} command. As I'm sure most of you have noticed, \LaTeX\ (and \TeX) commands begin with the `\textit{backslash}' character ($\backslash$). You may be wondering how I am printing out this symbol in this tutorial, since \LaTeX\ assumes `backslash' indicates a command (or function). This is done by issuing the following command in math mode (\ie between the dollar sign, \$, markers): \$$\backslash$\textsf{backslash}\$. \end{document}