ATTENTION for latex exercise
make sure you have created a
- lab4 directory in aero361
- report directory in lab4
<bash>
cd aero361
<bash> mkdir -p lab4/report
|
|
BACKGROUND AND PRACTICE ON TAR
A directory that needs to be archived is tar'd in a unix platform. The
tar format is very common and useful for archiving and transferring
files on line. The tar command is used to create and unroll tar files.
In the past one could not ftp directories or directory structures so a
way was created whereby an entire directory structure was converted
into a single file. This conversion was done using the tar command. The file was then
transferred via the net through a mail
program or ftp. Now days one used scp
since it is secure and faster. Examples below illustrate how to use the
tar command
<bash>
tar cvf [path]/filename.tar
directory[name]
|
converting a chosen
directory into a tar archive called filename.tar
|
<bash>
tar xvf filename.tar
|
unrolling
filename.tar into its original directory structure or some other
location
|
- Exercise
on tar: lets say you want to archive aero361
dir. The tar file will be aero361.tar. Need to be in a directory that
when you list the contents of that dir aero361 shows up. Refer to the
tables below for commands and options.
- creating a tar file and placing it in the
/remote/aere/joeusr dir
- <bash>tar cvf /remote/aere/joeusr/aero361.tar
aero361
- <bash>cd /remote/aere/joeusr
- Compress the tar file using the bzip2 command
- unrolling a tar file in /remote/aere/joeusr
- <bash>bunzip2 aero361.tar.bz2
- <bash>tar xvf aero361.tar
tar OPTION FLAGS
OPTION
|
DESCRIPTION
|
| -c, --create |
create a new archive |
| -d, --diff, --compare |
find differences between archive and file
system |
| --delete |
delete from the archive (not for use on
mag tapes!) |
| -r, --append |
append files to the end of an archive |
| -t, --list |
list the contents of an archive |
| -u, --update |
only append files that are newer than copy
in archive |
| -x, --extract, --ge |
|
COMPRESSION UTILITIES
The predecessor to the bzip2 compression command is "gzip". Whenever a
tar file is created it is compressed using either one of these
utilities shown below.
compression
command
|
what
it does
|
final
result
|
<bash>gzip
file
|
compress
file with gzip
|
file.gz
|
<bash>bzip2
file
|
compress
file with bzip2
|
file.bz2
|
<bash>gunzip
file.gz
|
uncompress
file file.gz
|
file
|
<bash>bunzip2
|
uncompress
file file.bz2
|
file
|
<bash>unzip
|
unzips zip files
|
|
Now that you have practiced the tar and compression commands, you are
ready for the latex part of the lab.
|
THE texmf STENCIL
The texmf directory will contain all the stencils and class files that
set the report format. There is a texmf directory in the Latex
directory in the system, but that cannot be edited by the user. The
user creates a texmf directory in the $HOME for all user specific type
of formats. Whenever the user creates his/her stencil or class file the
files are placed in the $HOME/texmf directory tree. The Aero report
stencil was created by Bruce (LaTex Guru) for aeros. The stencil is
extremely capable and very appealing. It can generate reports for
- aero 361 class projects
- aero 461 and aero 462 projects
- aero 491/492 senior projects
The aere report stencil is an extension to the isuthesis stencil. In
the past we used the isuthesis stencil for the undergraduate classes,
later on Bruce decided to create the aere stencil that uses the
isuthesis stencil. The isuthesis stencil is a creation of Joe Strauss,
another LaTex Guru.
- download the texmf.tar.bz2 file into your
$HOME
(/home/joeusr) directory
| <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 latex where to look
for
the packaged that are user specific.
|
|
LATEX FILES
Make
sure you have created a directory lab4
down
load the file.tar.bz2
file
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 unroll this file a directory called Files will show up. In
this dir all your latex files and figures.dir
directory will reside.
Whenever 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
|
kile is a laTex editor that is gui based. You are encouraged to use
this application 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. However, you will have to
learn this application on your own. The Instructors of this class are
"command line oriented" and so they shy away from most GUI
applications, unless its CFD type post-processing. Almost all the basic
commands and some advanced commands that reside in books is available a
click away from the menus and side bar panels in kile, e.g., math symbols menu
Steps using kile
- bring up kile from menu or from shell as shown above
- select the file open menu to select all the requisite
files for the report: click me
- select the main.tex file and mark it as the master
document: click me
- Edit the files use various menus to insert equations
and text
- compile the file by clicking the latex icon: click me
- preview the file in dvi form by clicking the icon: click me
- from the kdvi preview browser go back into edit mode
by clicking the pen at the right end of the main menu: click me
The main menu
|
click me
|
The selection of the
Master Document: the main.tex file is the master document
|
click me
|
The compile or latex
button
|
click me
|
The dvi viewer button
|
click me
|
Here is the menu locations of common fields that you would require. The
tool is pretty is easy!
- Equations
- tables
- figures and
menu
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. Every time a new file is
created it needs to be included into the main.tex file at the
appropriate place using "\include{new file}". 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.
latex command
<bash>
dvips -f main.dvi > main.ps
|
To convert a dvi report into pdf the following command is used
It will convert the main.dvi into a main.pdf file with indexing
NOTE
to set the xdvi window to the actual page width and height use the -s
0 option as shown below
<bash>
xdvi -s 0 main.dvi
|
Trouble Shooting: Quitting and Continueing from the
latex command
Latex will try to auto correct errors in syntax, missing braces,
incomplete fields and etc. However, its always good to have the least
number of errors in the file. When latex encounters an error or some missing package it
will stop and give a reason. Latex will give the line number and the
file where the error occurred.
- To continue on with the latex process and see the
final result type
- <bash>
r
- <bash>
xdvi or kdvi main.dvi
- Toexit the latex process type
Acrobat documents in pdf format can be built from teTex except the
latex command cannot be used in the so called compile step. The latex
command can only be used when "eps" type figures are being used in the
document. The latex command cannot recognize any other picture format
other than "ps" or "eps". If the report contains "jpeg", "png", "tiff"
or "gif" type formatted images but no "eps" or "ps" type images then
pdflatex command is used to build the report. So remember when using
pdflatex command make sure that all images are in formats other than
"eps" or "ps". The pdflatex command will create a main.pdf file.
HOW TO DRAW FIGURES FOR LATEX using xfig
There is a powerful package that allows the 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 equations. 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 pertaining
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.
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
|
|
| 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 |
|