7.1. Scientific Publications¶
While you have probably learned how to use Microsoft’s Office Suite, including MS Word and Powerpoint, these tools are not very well suited to presentations which involve a significant mathematical exposition. Not only is it difficult to create equations, they look lame in MS Word.
That’s why professional mathemeticians, physicists, chemists, computer scientists, economists, engineers, and others use Latex (pronounced ” LAY’ tek , not ” Laytecs ” like the gloves ).
An example of this powerful desktop publishing software is shown here:
This is an equation from a paper of mine.
Have a look at this paper by clicking on the preceeding link. Once on the abstract page, click on the PDF link which is in the upper right corner of that page. Scroll through the paper. This paper was produced with Latex and Gnuplot and sent to the publisher in this form, ready for publication. Imagine how impressive your lab report would be if it looked like this!
You can have a look at some other examples of Latex in action by visiting the ” Preprint Archive ” at Cornell University. Started by particle physicists in the late 1980s, this repository is where we send copies of our papers at the same time we send them off to the publisher. That way the paper, and more importantly its results, are available to everyone with internet access.
The archive is here: http://www.arxiv.org/
For some examples of Latex output, scroll down to my field: High Energy Physics - Lattice which is where papers on large scale simulations of particle theory go. ( the name ” Lattice ” comes from the fact that we represent spacetime as a 4-dimenional “lattice” of points instead of the usual “spacetime continuum”. That way we can simulate the quantum behavior of fields ). Have a look at the New listings to see the latest papers posted. This is where almost all new results in physics appear first. Click on any abstract that interests you, then on the PDF link. That should pop the paper up on your screen. Look at the gorgeous typesetting of the document.
As long as you are still visiting the archive, have a look around. The new papers in ” String Theory ” usually appear on High Energy: Theory while new experimental results show up in High Energy: Phenomenology. There’s an Astrophysics branch that includes both new theoy and experimental results, as well as a whole separate branch for Mathematics. Or, check out Artificial Intelligence in the Computer Science branch. If you are a scientist, start getting used to reading!
Won’t it be cool to hand in your next lab report looking polished and professional like one of these research papers?
7.1.1. LaTeX¶
Again, latex is pronounced: LAY’ tek , (not lay . tecs like the material). You can read why by googling latex. It was invented by Donald Knuth in the 1980s.
One of the reasons that I have decided to switch to using Fedora Scientific is that latex comes completely installed if you choose it as a package. That saves a lot of hassle installing it as a standalone package. You can verify that latex was correctly installed by openning a Terminal window and typing
sci[~]> latex -v
(-v stands for “show version”).
This should display something like this:
sci[~]>latex -v
TeX (Web2C 7.4.5) 3.14159
kpathsea version 3.4.5
Copyright (C) 1997-2003 D.E. Knuth.
Kpathsea is copyright (C) 1997-2003 Free Software Foundation, Inc.
There is NO warranty. Redistribution of this software is
covered by the terms of both the TeX copyright and
the GNU General Public License.
For more information about these matters, see the files
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.
Kpathsea written by Karl Berry and others.
If you see an error message, email me and we’ll sort it out.
7.1.2. Getting Started¶
Latex is a kind of programming language. What you actually do is write a little program (using your text editor) which gets compiled into a graphical format–we’ll use PDF, but another format that was common is DVI, DeVice Independent format.
The program that you write is mostly composed of the text of your document, but in addition contains key words which tell latex to make certain symbols, and take certain lexigraphical actions (superscripting, or bolding, or creating a new section in your paper).
So, you first need a basic latex document.
Open an Terminal Shell window .
Make a new subdirectory (below your home/) called latex/ .
Now cd to this directory .
I want to show you a unix “trick” (it’s actually just a standard unix command).
In the terminal window type emacs. This should open an emacs editor on your desktop. Now try to type something in the xterm window . It doesn’t respond, right?
That’s because when the emacs application starts, it takes control of the xterm’s prompt–the xterm will wait until the emacs application exits before responding to input.
Exit emacs
Now, start emacs this way:
emacs &
by adding an ampersand “&” after the command. This tells the xterm to ” start emacs in the background ”, detaching it from the current xterm operation. Notice that emacs starts, but you now have your xterm prompt back and can issue commands. Make sure that you can now type commands (like ls) at the xterm prompt .
In the open emacs editor, copy the text below and save this file as tiny.tex .
\documentclass{article}
\begin{document}
This is my first latex document.
Oh yeah,
\em{Physics is the Mother of all Sciences}
\end{document}
At your terminal shell prompt (the one that is now active because we detached emacs with the ” &” above), type:
pdflatex tiny.tex
This will create a file called ** tiny.pdf ** in your latex folder. Do an ls to see if it’s there.
The built-in PDF Document in the Fedora Scientific environment is called: okular
While still in your latex directory, do an listing, and see if tiny.tex and tiny.pdf files are there.
Now type
okular tiny.pdf
The viewer should open it up so that you can see your new document.
It’s tiny, but it’s latex document.
7.1.3. Basic Latex Document Structure¶
Notice what you did above.
- You wrote tiny.tex in plain text using emacs (or any text editor) which is something like a program containing your text, plus special commands for formating (the words enclosed in em{ ...} are em phasized, for example). You can also use the form: {em ...}. Later we’ll use special commands for math symbols and more impressive formatting.
- Then you compiled the document into a particular output format: PDF in this case, by running pdflatex tiny.tex.
- Finally, you used the PDF viewer, okular, to review your work. At this point you have a document that you could transmit to anyone with a PDF viewer
Let’s look at the program part:
The Latex Document
Latex commands begin with a backslash: \, followed by a keyword.
Any other word in a latex document is considered text to be typeset.
\documentclass{article}
\begin{document}
This is my first latex document.
Oh yeah,
\em{Physics is the Mother of all Sciences}
\end{document}
7.1.4. The (Minimal) Structure of a LateX Document¶
At the very least, a latex document must have the following features. It must start with the keyword
\documentclass
followed by arguments. We will usually use the article class, the document begins
\documentclass{article}
\documentclass{article}
\begin{document}
This is my first latex document.
Oh yeah,
\em{Physics is the Mother of all Sciences}
\end{document}
but there are book and other classes that we could have used instead of article.
Following this, we might add some further things to set up the document (including packages, making definitions, for instance). These are “setup” things, not part of the document text itself.
\begin{document}
\documentclass{article}
\begin{document}
This is my first latex document.
Oh yeah,
\em{Physics is the Mother of all Sciences}
\end{document}
Simple enough, right? From here, everything either gets printed or actions are taken on latex keywords (like \em{} below).
\documentclass{article}
\begin{document}
This is my first latex document.
Oh yeah,
\em{Physics is the Mother of all Sciences}
\end{document}
Finally, at the end we put
\end{document}
\documentclass{article}
\begin{document}
This is my first latex document.
Oh yeah,
\em{Physics is the Mother of all Sciences}
\end{document}
7.1.4.1. A bit more interesting document¶
If all went well above, try the file below. If things DIDN’T go well, email your file to me and tell me what happened.
Let’s make a file that is a bit more interesting. First, a useful thing to remember is that most of us who know latex, learned it by copying things out of other files we were shown (or found).
So, you can do the same with these examples I’m giving you. You’ll need the text below.
You can also just download this file first.tex and save it in your latex/ directory, or copy and paste it into a file (called first.tex) using emacs.
% first.tex
% My first real Latex document
\documentclass[12pt]{article}
\begin{document}
\title{My First LaTeX Document}
\author{
Jane R. Feynman \\
Department of Physics\\
University of the Pacific \\
3601 Pacific Ave., Stockton, CA 95211
}
\maketitle
\begin{abstract}
In the abstract section you would put a brief (one paragraph)
description of your project or experiment, and the main results.
\end{abstract}
\section{Introduction}
% LaTeX comments begin with a percent sign, and are not printed.
In the Introduction you would put your introductory remarks. You will
introduce the project and give the reader some context for your study.
\subsection{Subsection: Math}
Including mathematics is easy.
$$
\int_{-a}^{\infty} f(x) dx= F(a)
$$
or you can do it like this for a numbered equation:
\begin{equation}
\oint_C \frac{dz}{z-z_0}=2\pi i
\end{equation}
\begin{equation}
\sum_{i=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}
\end{equation}
A numbered equation can be referred to or cited by giving it a label.
\begin{equation}\label{eq:pot}
V(r)={\hbar^2 \ell(\ell+1)\over 2mr^2}-{\hbar c \alpha\over r}
\end{equation}
Somewhere in your text you may wish to refer to this equation. You don't
need to know what Eq. number it is, just its label. Refer to it with
the command Eq.~(\ref{eq:pot}) and LaTeX automatically uses the correct
equation number, even if you go back and add more equations later. You
will need to run latex twice, once to compute the equation numbers.
\section{Tables}
Suppose that you want to create a table showing your data. The syntax
for a multicolumn table is found below.
\vspace{1cm}
\begin{tabular}{|c|c|c|c|}
\hline
Run 1 & Output & Run 2 & Output \\
\hline
1 & 37 & 1 & 28 \\
\hline
2 & 42 & 2 & 35 \\
\hline
3 & 73 & 3 & 19 \\
\hline
4 & 15 & 4 & 22 \\
\hline
\end{tabular}
\section{Conclusions}
In this section draw your conclusions and summarize your findings.
Certainly from this short and simple document, we can see that LaTeX
is tremendously powerful, easy, and FUN! There are many online
tutorials and help pages on LaTeX. Simply enter {\tt latex tutorial}
or {\tt introduction to latex} into Google and you will find lots of
help.
\end{document}
Try to compile and view this file in the same way as the one above . You should create the file on your computer, but if you have problems and want to see the correct version, the PDF output is here.
Have a look at the PDF file. Notice the different types of things contained:
- A title page and abstract
- Sections and subsections
- Mathematical typesetting, including numbered equations
- Tables
- Different fonts and text sizes
Now edit the file.
- Change the author and address your name and address .
- Change the title to My Own Latex Document .
- Change the Abstract to say: In this report, I will prove that Physics is the Mother of all Sciences. .