AERO 361 LATEX PAGE
Latex Stencils for isu thesis

  1. 1)THE texmf STENCIL
      1. 2)LATEX FILES
      2. 3)Stencils
      3. WHAT GOES INTO A LATEX PROJECT
      4. LaTex Editor: Kile
      5. HOW TO BUILD A LATEX REPORT
      6. IOWA STATE LATEX RESOURCES BY JOE STRAUSS  ( Many thanks to him for his contributions and advice on Latex)
      7. FIGURES
      8. Symbol [h!tb]
      9. LATEX AND XFIG xfig
      10. TYPES OF EQUATIONS
      11. Simple numbered equations
      12. Set of equations with number on the  last one
      13. Array of equations with equal spacing on the left
      14. Wrapping long Equations down the page
      15. Subequations
      16. Equations layed out in tabular form
      17. A big equation reduced in size
      18. Generic referencing
      19. Advanced and Cool referencing
      20. to insert a label
      21. Creating a table
      22. Multi-column lists

1)THE texmf STENCIL


<bash> cd make sure you are in your /home/joeusr dir
<bash>bunzip2 texmf.tar.bz2 use the bunzip2 utility to uncompress the tar file
<bash>tar xvf texmf.tar extract the files and dirs from the tar archive
<bash> rm -i texmf.tar remove the tar archive
<bash> cd texmf/ cd into the newly extracted texmf dir
<bash> texhash execute the texhash command that allows latex to search for the packages in $HOME/texmf if it cannot find them in its default system dir. Anytime you add a new .sty or .cls or .def file insert in $HOME/texmf/tex/latex where all the .sty files are located and use texhash from $HOME/texmf to update the ls-R file. The ls-R file tells lates where to look for the packaged that are user specific.

2)LATEX FILES

Make sure that you have created a directory lab4
down load the file.tar.bz2file into lab4 directory. Unzip and unroll that compressed file as you did in the previous step. When you download the file it will show up as Bruce_new_aere.tar.bz2: Bruce is the main architect of this laTex stencil which is a derivative of the isu thesis stencil created by Joe Strauss. This laTex stencil by Bruce can be used in aero461 and beyond.
When you unspool this file a directoy called Files will show up. In that dir all you latex files and figures.dir directory will reside. When ever you do a new project just copy the files dir to the appropriate report dir of the new project
  • <bash> bunzip2 Bruce_new.aere.tar.bz2
  • <bash> tar xvf Bruce_new.aere.tar
  • <bash> rm -i Bruce_new.aere.tar
  • <bash> cd files/
Once the file has be unrolled it will show up as a directory called files/. In this directory there will be a list of *.tex files that are commonly used for the report. The preamble or main file that calls all the other files is called main.tex. All LaTex documents must have a main.tex which starts and ends the document class.

title.tex
Author's name, title of the project, name of professor and class name will require editing in this file. Read through this file and play around with the fields and see what happens
%
This symbol stands for comment like ! for f90

3)Stencils

WHAT GOES INTO A LATEX PROJECT



The approach to the latex files is similar to that of the f90 source codes. The entire report is broken down into a preamble file (main.tex) and its subsequent chapter files, heres is an example of some common files
Names
Purpose
abstract.tex
abstract of the project
main.tex
main preamble that calls all other files
introduction.tex
introduction chapter
theory.tex formulation chapter
results.tex
results chapter
conclusion.tex
conclusion chapter
bibliography.tex
bibliography
appendixa.tex
appendix a
appendixb.tex
appendix b

When a latex document needs to be built the latex command is used on the main.tex file only. The main.tex files calls or \includes all other tex files to build the document. The subject matter of the report does not go into the main.tex file: it is broken up into separate files. The formulation or theory part of the report would go into the file called theory.tex or formulation.tex. The same procedure would be followed for the results and conclusion part of the report. The bibliography is important and a separate latex file if references have been used to create the report. The source code will go in the appendix part of the report as shown in the table.
NOTE: Under no circumstances are you to write the entire report into one tex file, as the report becomes bigger and more complicated the debugging can become tedious and at times unsuccessful. That is why the report is broken up into separate tex files.

LaTex Editor: Kile

kile is a laTex editor that is gui based. You are encouraged to use this app since its easy to use and pretty quick to learn. It has its own dictionary of symbols and its help page is extremely useful. Before starting a new report make sure the previous projects files are all not in the tabbed list. You need to start fresh.

HOW TO BUILD A LATEX REPORT

There a two main steps in building a latex report for viewing. The main.tex file is like the main program it "includes" all the other files representing each chapter of the report. Everytime a new file is created it needs to be included into the main.tex file at the appropriate place using "\include{newfile}". From the command line here are the three basic steps. If there are errors after the "latex" step the dvi file may be corrupted. The "latex" step is synonymous to the compile step in fortran.
  1. <bash> latex main.tex
  2. <bash> xdvi main.dvi
  3. <bash> dvips -f main.dvi > main.ps
The above series of commands will produce a postcript file. To produce an Adobe pdf file the following commands are used
  1. <bash> pdflatex main.tex
  2. <bash> acroread main.pdf
Note: when using pdflatex do not include figures that are in ps or eps format!

Building Reports using Bibtex

Bibtex is the best thing to happen to an engineer. Its a neat organized way of scripting the details of a reference which the bibtex command collates and organizes in the latex document. However, when compiling the main.tex file an extra command besides latex or pdlatex needs to be invoked called bibtex. When compiling ignore the .tex suffix for main.
  • latex main
  • bibtex main
  • latex main
  • latex main
or
  • pdflatex main
  • bibtex main
  • pdflatex main
  • pdflatex main
Here is a sample file for bibtex with the .bib suffix called ref.bib. The following lines need to be added into the main.tex file just prior to the \end{document}

\renewcommand{\bibname}{\centerline{BIBLIOGRAPHY}}
\bibliographystyle{unsrt}                                                       
\bibliography{ref}   
% make a user defined heading
% set the bibtex to order references as they are cited
% include the ref.bib file

Here is an example of different types of citation styles:

@article{
    hawken,
    author    = {Hawken, D. F.},
    title    = {Review of Adaptive-Grid Techniques for Solution of Partial Differential Equations},
    journal    = {IAS Review},
    address    = {University of Toronto, Toronto, Ontario, Canada},
    number    = {46},
    month    = dec,
    year    = {1985},
    pages    = {496--502}
 }
Citation for articles in journals
@techreport{
    cr:thompson,
    author    = {J. F. Thompson and F. C. Thames and C. W. Mastin},
    title    = {Boundary-Fitted Curvilinear Coordinate Systems for Solution of Partial Differential Equations on Fields
    Containing Any Number of Arbitrary Two-Dimensional Bodies},
    type    = {NASA CR},
    number    = {2729},
    month    = jul,
    year    = {1977}
}
Citation style for technical reports or papers
@book{
    book:tannehill,
    author    = {J. C. Tannehill and D. A. Anderson and R. H. Pletcher},
    title    = {Computational Fluid Mechanics and Heat Transfer},
    publisher    = {Taylor and Francis},
    address    = {Washington, D.C.},
    year    = 1997
}
Citation style for a book


Hypertext with LaTeX
Essential LaTeX++ pdf ps
A LaTeX survival guide for Unix systems pdf ps
LaTeX symbols pdf ps
The Comprehensive LaTeX Symbol List shows many symbols available in LaTeX. pdf
The Short Math Guide for LaTeX is a concise summary of the essential features in LaTeX for writing math formulas, including features provided by the packages amssymb and amsmath. pdf ps


Latex Project Management commands  (Latex How To by Daniel Franklin)
spelling
<bash> ispell file.tex
compile
<bash> latex main.tex
creating a pdf file from a latex file
<bash> pdflatex main.tex
viewing
<bash> kdvi main.dvi
printing
<bash> dvips -f main.dvi > main.ps
converting html to asci file
<bash> lynx -dump file.html > file.txt
Using and setting up for pdflatex
<bash> pdflatex main.pdf
Nasa's Latex page
Table of Contents
Steps on how to create color print outs in durham
  • have the ps file ready
  • bring it up using ggv
    • ggv file.ps
  • mark the color pages
  • save the color pages as
    • file_color.ps
  • move the file to your vincent account
    • mv file_color.ps /afshome/username
  • telnet into a vincent machine
    • telnet aeem2
  • In the vincent shell type
    • lpr -Pdu139_color -m -B310 file_color.ps
Need to be in telneted into vincent !!

LATEX MANUALS


Hypertext with LaTeX
ESSENTIALS
Essential LaTeX++ pdf ps
SURVIVAL GUIDE
A LaTeX survival guide for Unix systems pdf ps
LATEX SYMBOLS
LaTeX symbols pdf ps
ALL YOU CAN EAT MATH SYMBOLS
The Comprehensive LaTeX Symbol List shows many symbols available in LaTeX. pdf or pdf
MATH SYMBOLS
The Short Math Guide for LaTeX is a concise summary of the essential features in LaTeX for writing math formulas, including features provided by the packages amssymb and amsmath. pdf ps
FIGURES
How to place figures where you want them
More manuals
LATEX MANUAL
LATEX MANUAL SHORTER VERSION
ANOTHER LATEX MANUAL
Gabe's Latex page



Wonderful Latex page : Getting Started with LaTeX

By David R. Wilkins
2nd Edition
Copyright David R. Wilkins 1995

NASA'S LATEX PAGE


IOWA STATE LATEX RESOURCES BY JOE STRAUSS  ( Many thanks to him for his contributions and advice on Latex)



FIGURES

The figure.eps is a encapsulated postcript file exported using tecplot or matlab. Make sure that all figures used with latex are
  • encapsulated postcript format (eps)
  • if the format is postcript (ps), then a bounding box has to be inserted.

To check the format of a file

To check whether an exported item is ps or eps use the following command in unix as shown below
  • <bash> file filename

To convert a file to a eps format

If the original file is of some other format and an eps file is needed. The "convert" utility can be used e.g.,
  • <bash> convert file.jpg file.eps
Note: All eps and ps files will take up more diskspace than other formats

Importing a figure that is scaled to the width of the page

\begin{figure}[h!tb] 
\centering
\includegraphics[width = \textwidth]{figure.eps}
\isucaption{text}
\label{fig:text}
\end{figure}

Importing and scaling the figure

\begin{figure}[h!tb] 
\centering
\scalebox{.7}{\includegraphics{figure.eps}}
\isucaption{text}
\label{fig:text}
\end{figure


Importing - scaling and rotating the figure


\begin{figure}[h!tb]
\centering
\includegraphics [scale=0.4,angle=-90]{figure.eps}
\caption{text}
\label{fig:text}
\end{figure}

sideways figure


\begin{sidewaysfigure}[h!bt] 
\centering
\includegraphics[angle=0,scale=1.5]{figure.eps}
\isucaption{text}
\label{fig:text}
\end{sidewaysfigure}

2 figures in an array format


\begin{figure}[h!tb]
\centering
\label{name}
\subfigure [Initial grid with 13 points in linear distribution]
{\includegraphics[angle=0,scale=0.8] {fig1.eps}}
\subfigure [Initial grid with 14 points in linear distribution]
{\includegraphics[angle=0,scale=0.8] {fig2.eps}}
\isucaption { details regarding the plots}
\label{name}
\end{figure}

column of figures

Requires the following packages
\usepackage{subfigure}
\usepackage{subfigmat}

 \begin{subfigmatrix}{2}% number of columns
  \subfigure[subcaption]{\label....} \includegraphics{fig1}}
  \subfigure[subcaption]{\label{....} \includegraphics{fig2}}
 \end{subfigmatrix}
 \caption{..........................}
\end{figure}

Symbol [h!tb]

  • h here
    • The float may appear at the point in the text where the environment iks typed in
  • t top:
    • The float may appear at the top of the page, provided there is space
  • b bottom:
    • The float may appear at the bottom of the page, provided there is space
  • H here with force
    • the parameter H will insert the float immediately where it is defined and follow it with a pagebreak if there was no space.

The figures and tables that are referred to as floats will be placed based on the following rules
  1. No float will appear in a page prior to one in which it is defined
  2. Figures and Tables are output in the order in which they are defined.
  3. For combination htb, the argument h takes priority.

LATEX AND XFIG xfig


main menu
drawing objects
editing objects
object attributes
add tangent line


There is a powerful package that allows tghe user to draw pictures with latex style equations called "xfig". Before the next lab you are to tinker with xfig. Use the help page on xfig to get an idea how to use the commands. The next step will be to export and figure in .pstex/.pstex_t format so that latex can import the figure with symbols.

To create diagrams with latex type equations you can use the latex tool "xfig". Type xfig in a shell or you can access it through "kile". This ps/tex combined export mode allows the user to create figures with latex type equtions. The latex file will input the figure as shown below. In the \input field the .pstex_t file is accessed which in turn uses the .pstex file coressponding to the file. When ever you export the ps/tex file make sure there is a .pstex_t and .pstex file.

CAUTION: Whenever you spend time building a figure make sure the figure is saved (click on the save or save as button and name it file.fig)

\begin{figure} [ht]
 \centering
 \scalebox{1.0}{\input{fig2.pstex_t}}
 \caption{My figure}
 \label{the-label-for-cross-referencing}
\end{figure}

Download these files and bring example.fig file in xfig. The math symbols are written as $........$ in the text field window.
  • <bash> xfig
Compile the main.tex file and use xdvi on main.dvi
CAUTION: when exporting the .pstex and .pstex_t files do not put them in the figure.dir directory. It will be messy but at the moment place all these .pstex and .pstex_t files where the .tex files reside i.e. files/ dir

TYPES OF EQUATIONS

Simple numbered equations

\begin{equation}
\label{eq:name}
\frac {\partial u}{\partial t} + u \frac {\partial u}{\partial x} =
    - \frac {\partial p}{\partial x} + \mu\frac{\partial^2 u}{\partial x^2}
\end{equation}

Set of equations with number on the  last one

\begin{eqnarray}
\label{eq:name}
u(0,t) = u_o \nonumber \\
u(L,0) = 0
\label {bg4}
\end{eqnarray}

Array of equations with equal spacing on the left

\begin{eqnarray}
\phi_{xx} &=& \left(\phi_{\xi}\xi_{x}\right)_{x}    \nonumber\\
&=&     \phi_{\xi x}\xi_{x}+\phi_{\xi}\xi_{xx}        \nonumber \\
&=&     \frac{\partial^2{\phi}}{\partial{\xi}^2} \frac {\partial{\xi}}{\partial x} \xi_x+
             \phi_{\xi}\left(\frac {1}{x_\xi}\right)_{x} \nonumber\\
&=&    \phi_{\xi\xi}\xi_{x}^2+\phi_{\xi} \frac {\partial}{\partial{\xi}}\left(\frac {1}{x_\xi}\right)
             \frac {\partial{\xi}}{\partial{x}} \nonumber \\
&=&    \phi_{\xi\xi}\xi_{x}^2+\phi_{\xi} \xi_{x}\left(\frac {1}{x_\xi}\right)_{\xi} \label{e3}
\end{eqnarray}

Wrapping long Equations down the page

(Example submitted by Josh Riveland, aero361,sp2004)
\begin{equation*}\label{tanvel}
\begin{aligned}
V_{ti}=& V_{\infty}\cos\left(\theta_{i}-\alpha\right) +
\sum^{N}_{j=1}\frac{m_{j}}{2\pi}\left[ \beta_{ij}\sin\left(\theta_{i}-\theta_{j}
\right) - \cos \left(
\theta_{i}-\theta_{j}\right)ln\left(\frac{r_{i,j+1}}{r_{ij}}\right)\right] \\
& + \sum^{N}_{j=1}\frac{\gamma}{2\pi}\left[ \sin\left(\theta_{i}-\theta_{j}
\right)ln\left(\frac{r_{i,j+1}}{r_{ij}}\right) +
\beta_{ij}\cos\left(\theta_{i}-\theta_{j}\right)\right]
\end{aligned}
\end{equation*}

Subequations

Will need to include the amsmath package in main.tex (\usepackage{amsmath})

\begin{subequations}
\begin{eqnarray}
\alpha=...... \\
\beta = ....
\end{eqnarray}
\end{subequations}

Equations layed out in tabular form

\begin{equation}
   \begin{bmatrix}
      a_{11} & 0 & 0  \\
      0 & a_{22} & 0 \\
      0 & 0      & a_{33}
   \end{bmatrix}
%
   \begin{bmatrix}
      1 & 0 & 0 \\
      0 & 1 & 0 \\
      0 & 0 & 1
   \end{bmatrix}
%
   =
%
   \begin{bmatrix}
      a_{11} & 0 & 0  \\
      0 & a_{22} & 0 \\
      0 & 0      & a_{33}
   \end{bmatrix}
\end{equation}

A big equation reduced in size

{\small
\begin{equation}
   \begin{split}
      \dot{x}'&=U\cdot \cos{\Theta}\cos{\Psi}+V \cdot\left(\sin{\Phi}\sin{\Theta}
      \cos{\Psi} -\cos{\Phi}\sin{\Psi}\right)+W \cdot \left(\cos{\Phi}\sin{\Theta}
      \cos{\Psi}+\sin{\Phi}\sin{\Psi}\right) \\
%
      \dot{y}'&=U\cdot \cos{\Theta}\sin{\Psi}+V \cdot\left(\sin{\Phi}\sin{\Theta}
      \sin{\Psi} +\cos{\Phi}\sin{\Psi}\right)+W \cdot \left(\cos{\Phi}\sin{\Theta}
      \sin{\Psi}-\sin{\Phi}\cos{\Psi}\right) \\
%
      \dot{z}'&=-U \cdot \sin{\Theta} + V\cdot \sin{\Phi}\cos{\Theta}+W \cdot
      \cos{\Phi}\cos{\Theta}
   \end{split}
\end{equation}
}

Generic referencing

refer to an
  • equation
  • table
  • section
  • chapter
\ref{name of label}

Advanced and Cool referencing

To refer to a field with reference number and page associated with it use the following command shown in the next cell
\vref{name of label}

to insert a label

\label{name}

Creating a table

\begin{table}[!h]
{ \fontsize {9}{12}\selectfont
\label{nu_table}
\begin{center}
\begin{tabular}{|l||c||c||c||c||c||c||c||c||c|}
\hline
.
.... fill in the columns .... separted by '&' symbol
.
\hline
\end{tabular}
\label{case}
\isucaption{Table of parameters used ................}
\end{center}
}

Multi-column lists

\begin{multicols}{2}
\begin{enumerate}
  \item  Do this
  \item  Do that
  \item  Do this
  \item  Do that
  \item  Do this
  \item  Do that
  \item  Do this
  \item  Do that
\end{enumerate}
\end{multicols}