I used LATEX and Kile for edition and all figures were constructed with figue. LATEX is by far better than other existing tools to edit a long document. Though appearing easier to use, Microsoft Word reveals itself as a nightmare for many of my colleagues. With Latex, it was a breeze (I'm serious).
Recommended readings:
If you are using standard BIBTEX, Kile handles all processing for you and you can skip this section. By contrast, the pre-processing with tex2plain needs an external script.
| Script to process a LATEX source file with tex2plain pre-processing. |
#!/bin/bash if [ $# -ne 1 ]; then echo "Usage: qtblatex basename" exit 2 fi TEXFILE=$(basename $1 ".tex") TEXFILEPLAIN=$(basename $TEXFILE ".plain") if [ "$TEXFILE" != "$TEXFILEPLAIN" ]; then echo "Be careful you probably edit .plain.tex file" echo > $TEXFILE.log exit 2 fi #if [ $TEXFILE.tex -nt $TEXFILE.plain.tex ]; then tex2plain $TEXFILE #fi mv $TEXFILE.aux $TEXFILE.plain.aux latex -interaction=nonstopmode $TEXFILE.plain.tex while egrep "Rerun to get cross-references right" $TEXFILE.plain.log > /dev/null; do latex -interaction=nonstopmode $TEXFILE.plain.tex done mv $TEXFILE.plain.aux $TEXFILE.aux mv $TEXFILE.plain.dvi $TEXFILE.dvi cp $TEXFILE.plain.log $TEXFILE.log |
To process a file, replace "latex" by the name of your script (configuration of Kile).
This section shows you the skeleton of my thesis, plus a series of special features that might be interesting to construct your own LATEX document.
The following code can be copied in your favorite editor and processed by LATEX. All comments are preceded by the comment character '%'. It will certainly complain about missing references and figures (ignore them for now). In my configuration, I was forced to add the package 'caption.sty' in the current directory to make it work. You should get a 35-pages dvi file that has been transformed into a pdf.
| % Declaration and list of LATEX packages in use |
\documentclass[a4paper,12pt]{book}
\usepackage[a4paper, tmargin=2cm, bmargin=2cm, lmargin=2cm, rmargin=2cm, twoside]{geometry}
\usepackage{float}
\usepackage{graphicx}
\usepackage[labelfont={bf,footnotesize},textfont=footnotesize]{caption}
\usepackage{setspace}
\usepackage{wrapfig}
\usepackage{sidecap}
\usepackage{afterpage}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{pspicture}
\usepackage{graphpap}
\usepackage{pifont}
|
| % Personal commands or macros |
\newcommand{\deter}[4]{\left| \begin{array}{cc}#1 & #2 \\ #3 & #4\end{array}\right|}
\newcommand{\ind}[1]{\index{#1}#1}
|
| % The document really begins here |
\begin{document}
\onehalfspacing
|
| % Definition of the front page |
\renewcommand\thepage{}
\begin{center}
\begin{figure}[ht]
\centering
\begin{tabular}{ccc}
\begin{minipage}{3cm}
\includegraphics[scale=0.85]{logo_geomac.eps}
\end{minipage}
&
\begin{minipage}{9cm}
\centering
\textbf{\large Universit\'e de Li\`ege}
\vspace{1 cm}
\textbf{\large Facult\'e des Sciences Appliqu\'ees}
\end{minipage}
&
\begin{minipage}{3cm}
\includegraphics[scale=0.65]{logo.ulg.eps}
\end{minipage}
\end{tabular}
\end{figure}
\vspace{5 cm}
\textbf{\Huge Array recordings of ambient vibrations:}
\vspace{0.5 cm}
{\huge surface-wave inversion}
\vspace{4 cm}
\textbf{\large A thesis submitted for the degree of}
\vspace{0.2 cm}
\textbf{\large Doctor of Applied Sciences}
\vspace{0.2 cm}
\textbf{\large presented by Marc Wathelet}
\vspace{7 cm}
February, 2005
\end{center}
\cleardoublepage
|
| % Start the front matters: table of content, list of figures and tables, with a roman style for page numbers |
\pagenumbering{roman}
\tableofcontents
\newpage
\addcontentsline{toc}{chapter}{\protect\numberline{}List of figures}
\listoffigures
\newpage
\addcontentsline{toc}{chapter}{\protect\numberline{}List of tables}
\listoftables
\newpage
|
| % \chapter* are no numbered, but also not automatically added to table of content, we add it manually |
\chapter*{R\'esum\'e}
\markboth{RESUME}{RESUME}
\addcontentsline{toc}{chapter}{\protect\numberline{}R\'esum\'e}
... R\'esum\'e en fran\c{c}ais ...
\chapter*{Abstract}
\markboth{ABSTRACT}{ABSTRACT}
\addcontentsline{toc}{chapter}{\protect\numberline{}Abstract}
... Abstract in English ...
|
| % Starting the introduction, back to Arabic numbering |
\chapter*{Introduction}
\markboth{INTRODUCTION}{INTRODUCTION}
\pagenumbering{arabic}
\addcontentsline{toc}{chapter}{\protect\numberline{}Introduction}
... Introduction ...
|
| % As for chapters, \section* are not numbered |
\section*{Objectives}
\addcontentsline{toc}{section}{\protect\numberline{}Objectives}
... Objectives ...
\section*{Thesis outline}
\addcontentsline{toc}{section}{\protect\numberline{}Thesis outline}
This document is organized in six chapters.
\underline{Chapter~\ref{chapGeophMethod}} ...
|
| % To reduce the size of handled files, the document is split by chapter. Long documents may be difficult to edit in Kile, due to automatic colored syntax. |
\chapter{Measuring wave velocity}\label{chapGeophMethod}
\include{chapsignals}
\chapter{The inversion algorithm}\label{chapInv}
\include{chapinv}
\chapter{Forward computation}\label{chapForward}
\include{chapdispcurve}
\chapter{Parameterization of a ground model}\label{chapParam}
\include{chapparam}
\chapter{Enhanced inversions}\label{chapEnhancedInversions}
\include{chapenhanced}
\chapter{Test cases}\label{chapTestCases}
\include{chapcases}
\chapter*{Conclusions}
\markboth{CONCLUSIONS}{CONCLUSIONS}
\addcontentsline{toc}{chapter}{\protect\numberline{}Conclusion}
... Conclusions ...
|
| % Back matters, switching to appendix for chapter names and numbering |
\appendix
\chapter{Sub-determinants of $R^{(i)}$}\label{appdSubDeter}
... appendix ...
|
| % Examples of cross-references |
... (section \ref{secRayEigenValue}, equation (\ref{equRayDunkinEqu})) ...
|
| % Array of equation, the '&' mark distinct column while '\\' separates rows. In this environment all lines are affected an equation number, '\nonumber' prevents it. |
\begin{eqnarray}
h_n & = & \hat h_n / k \\
k_n & = & \hat k_n / k \nonumber
\end{eqnarray}
|
| % Equation with roman text inside, and aligned equations. |
\begin{equation}
\left. \begin{array}{ccc}
SH & = & 0.5 \frac{1-e^{-2 d_n \hat h_n}}{h_n} \\
CH & = & 0.5 (1+e^{-2 d_n \hat h_n})
\end{array}\right\} \textrm{if} \quad h_n \quad \textrm{is real.}
\end{equation}
|
| % A usual figure with a caption at the bottom. |
\begin{figure}[ht]
\includegraphics{fig_chapdispcurve/2layers_vs0-nucst.eps}
\caption[short caption for list]{long caption. \label{fig2LayerVs0NuCst}}
\end{figure}
|
| % A wrap figure, the text will wrap around the figure be carefull the figure or table ('wraptable') is no longer a float, hence they are usually problems at the limits of pages. |
\begin{wrapfigure}{L}{0cm}
\centering
\includegraphics{fig_chapparam/paramprior_lvz-vs.eps}
\caption[short caption for list]{long caption. \label{figParamPriorLVZ}}
\end{wrapfigure}
|
| % A figure with a caption on its side (not at the bottom). |
\begin{SCfigure}[25][ht]
\includegraphics{fig_chapdispcurve/2layers_vs0-nucst.eps}
\caption[short caption for list]{long caption. \label{fig2LayerVs0NuCst}}
\end{SCfigure}
|
| % Two figures grouped side by side to form one unique float. You can mix figures and tables in the same float, but you must then replace \caption by \captionof{table} in a figure float, and vice-versa. |
\begin{figure}[ht]
\centering
\begin{tabular}{cc}
\begin{minipage}{3in}
\includegraphics{fig_chapparam/paramprior_bissection.eps}
\caption[short caption for list]{long caption. \label{figParamPriorBissection}}
\end{minipage}
&
\begin{minipage}{3in}
\includegraphics{fig_chapparam/paramprior_diagonal.eps}
\caption[short caption for list]{long caption. \label{figParamPriorDiagonal}}
\end{minipage}
\end{tabular}
\end{figure}
|
| % A table with caption |
\begin{table} [ht]
\centering
\begin{tabular}{cc|cc} \hline
Array geometry & Number of sensors & $k_{min}$ & $k_{max}$ \\ \hline
Perfect circle & 25 & 0.024 & 1.00 \\
Cartesian grid & 25 & 0.022 & 0.25 \\
Spiral & 25 & 0.036 & 2.75 \\
Perfect circle & 10 & 0.024 & 0.40 \\
Three triangles & 10 & 0.038 & 0.36 \\
Irregular circle & 10 & 0.026 & 0.15
\end{tabular}
\caption[Short caption for list]{long caption. \label{tabGeomKLimits}}
\end{table}
|
| % A figure drawn within LATEX |
\begin{figure}[ht]
\centering
\begin{picture}(350,120)
%\graphpaper(0,0)(350,120)
\linethickness{3pt}
\put(0,75){\textbf{Model}}
\put(0,15){\ding{52} Unknowns}
\put(0,0){\ding{52} Physical properties}
\arrowlength{12pt} \put(30,65){\vector(0,1){0}}
\put(30,30) {\line(0,1){30}}
\put(110,110){\textbf{forward} problem}
\put(50,85){\Curve(200,0){-2}}
\arrowlength{12pt} \put(255,82){\vector(2,-1){0}}
\put(110,30){\textbf{inverse} problem}
\put(50,65){\Curve(200,0){2}}
\arrowlength{12pt} \put(45,68){\vector(-2,1){0}}
\put(260,75){\textbf{Observables}}
\put(260,15){\ding{52} Data}
\put(260,0){\ding{52} Measurements}
\arrowlength{12pt} \put(290,65){\vector(0,1){0}}
\put(290,30) {\line(0,1){30}}
\end{picture}
\caption{Definition of an inversion problem \label{figInversionDef}}
\end{figure}
|
| % List of item without numbers. |
\begin{description}
\item \underline{$it_{max}$} ...;
\item \underline{$n_{s0}$} ...;
\end{description}
|
| % List of item with numbers (may be changed to letters or Roman numbers). |
\begin{enumerate}
\item ...;
\item ...;
\end{enumerate}
|
| % This is a very important command to manage your floats (figure or tables). It forces all of them to appear after the end of the current page. \clearpage alone does not wait for the end of the page. |
\afterpage{\clearpage}
|
| % Finally the list of references. Here BIBTEX or tex2plain work for you: according to collected references in the text, the list of used reference is compiled, sorted, ... |
\chapter*{References}
\markboth{REFERENCES}{REFERENCES}
\addcontentsline{toc}{chapter}{\protect\numberline{}References}
\bibliography{../publi/biblio}
|
| % This is the end ... |
\chapter*{Acknowledgments}
\markboth{ACKNOWLEDGMENTS}{ACKNOWLEDGMENTS}
\addcontentsline{toc}{chapter}{\protect\numberline{}Acknowledgments}
\end{document}
|
BIBTEX is a powerfull tool for bibliographic references. Once you have an errorless database, you can re-use it in all papers, books or thesis. To create a database, just create a text file like this example:
| % List of Journals, defined by keywords in order to always spell them in the same way |
% List of Journals
@string{BSSA="Bull. Seism. Soc. Am."}
@string{GJI="Geophys. J. Int."}
|
| % These are special keywords for tex2plain, to cite paper in press or submitted (most journals require to skip them in the reference list, but not in the text) |
% Special keyword for papers in press: use it in field 'year' to hide
% in press entries from reference table
@string{Submitted="submitted to"}
@string{InPress="in press"}
@string{Accepted="accepted in"}
|
| % One entry for a paper, I use the convention AuthorYear for keywords (must be unique). A letter is added if various publications for the same year. This letter is different from the letter that might appear in the final reference list of a paper (according to number of citations in text). 'myref' is not accepted by BIBTEX. It is ignored by tex2plain. It is my personal reference to find the text of the paper ('RF019' means printed copy with number 19, or 'pfd' if only under electronic format) |
@article{Aki1957,
author = "Aki, K.",
title = "Space and time spectra of stationary stochastic waves, with special reference to microtremors",
journal = BSSA,
year = "2048",
volume = "789",
pages = "415--456",
myref = "RF019",
}
|
If you must use BIBTEX directly, you can remove all 'myref' by executing:
| Remove 'myref' before processing with BIBTEX |
# grep -v "myref *=" < mybiblio.bib > bibtexbiblio.bib |
Inside your text you can use the following commands:
| Bibliographic references in the main text | ---> In the final document |
\cite{Smith1965} | Smith et al. 1965 |
\cite{Smith1965,Frank1988c} | Smith et al. 1965, Frank and Mayer 1988b |
\citey{Smith1965} | 1965 |
\citet{Smith1965} | Smith et al. (1965) |
Note that '\citet' is only supported by tex2plain.
If you are working in seismology, and especially with ambient vibrations, you will probably appreciate to download a copy of my current BIBTEX database. If you notice errors, please report them.
If you write your source document in French, you will probably want to use accents without typing "\^{e}" for "ê". This is a problem of character encoding of the source file. LATEX assumes by default 7-bit font encoding (only 128 characters, hence no accents). To change the input encoding, add the following code at the beginning of the file:
| Changing input encoding |
\usepackage[latin1]{inputenc} |
Refers to the literature for other encodings for Turkish, Galician, Icelandic, Czech, Slovak, ...
Rules for formating the text (indent for paragraph, spaces before colon, ...) change from one language to another. To set French typesetting, use the following package:
| Changing typesetting |
\usepackage[french]{babel} |
The software figue can produce .ps files and currently no .eps. You can convert from ps to eps files by using the following shell script. It requires the tool "ps2epsi" which is usually available with the "psutils" package of most Linux distribution.
| Transforming ps into eps |
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage ps2eps yourfile1[.ps | .eps] yourfile2[.ps | .eps] ..."
exit 2
fi
while [ "$1" ]; do
file=$(basename $1 ".ps")
file=$(basename $file ".eps")
echo "Doing just:"
echo "ps2epsi "$file".ps"
ps2epsi ${file}.ps
echo "mv "$file".epsi "$file".eps"
mv ${file}.epsi ${file}.eps
shift
done
|
The main difference between the two types of file is that the eps has the exact dimension of the image, whereas the ps has paper dimensions (A4, letter, ...). On my linux box, the "ps2epsi" script did not perform a good job in calculating the boundingbox, resulting of images overlapping the main text. To fix this problem, you have to modify the original "ps2epsi" script located at /usr/bin. Copy it in your /home/username/bin, and modify this copy (/home/username/bin must be in your $PATH). There is a call to "gs" (at line 55 in my version), add option "-sPAPERSIZE=a4" in the "gs" command line.
Additionally, it is handy to create all ps file of one chapter in the same directory. In this directory, the transformation into eps may be automated by creating a Makefile.
| Makefile for figures |
OBJECTS=$(shell ls *.ps | sed "s/\.ps$$/.eps/g") all: $(OBJECTS) .SUFFIXES: .ps .eps .ps.eps: ps2eps $< |
Before processing the main LATEX command, you must run "make" in the figure directory. Only the modified ps files will be updated.
latex2html helps you translating from LATEX to html. However, it is not straight forward if you are using particular packages, as I did. The original main file is 'these.tex' (that contains '\include' to other sub-files). The bibliographic citations are first dereferenced by using the program tex2plain to create 'these.plain.tex' where '\include' are replaced the effective contents of sub-files. latex2html does not support '.' in file names. Hence we rename it as 'thesis.tex'. The modification listed hereafter apply only to this last file, not to the original LATEX file. Correct the file according to the following remarks and run 'latex thesis.tex' to generate the list of figures, tables, table of content, figure numbers,... (thesis.aux).
Here follows the list of encountered problem and their solutions:
| Package 'geometry' is not supported | Comment '\usepackage[...]{geometry}', for html it is useless. |
| Package 'caption' is not supported | Comment '\usepackage[...]{caption}', bad luck. |
| Package 'setspace' is not supported | Comment '\usepackage{setspace}', bad luck, we cannot adjust the space between line of paragraphs in html. |
| Package 'sidecap' is not supported | Comment '\usepackage{sidecap}', bad luck, but it is not so important, figure placement being not capital for html. |
| Package 'afterpage' is not supported | Comment '\usepackage{afterpage}', figure placement and float barriers are useless for html. |
| \onehalfspacing and similar commands not available | Comment them as the corresponding package cannot be used. |
| '\renewcommand\thepage{}' is not accepted | I do not understand why but it is like that, no very important here, comment it. |
| \cleardoublepage and \afterpage{\clearpage} not available | Comment them as the corresponding package cannot be used. |
| \verb command unknown | Remove it, bad luck. |
| \begin{SCfigure}[25][ht] and \end{SCfigure} not available | Replace them by the simple \begin{figure}[ht] and \end{figure}. Don't forget to remove the '[25]' (or any number). |
| \captionof{...} is not available | Usually it is used for table inserted inside a figure float, with the minipage structure. For html, you must split the 'minipage' structure into individual figures and tables. The '\captionof' is replaced by '\caption'. Minipage structure are fine when they contain only one type of float (figure or table). |
| As mentioned before, '.' in file names are not supported | If you have '\includegraphics{../publi/paper1/ps/fig1.eps}', you must remove the '../' and create a symbolic link in the current directory. |
| Removing all \afterpage{\clearpage} may lead to 'LaTeX Error: Too many unprocessed floats' | Add a '\clearpage' before the incriminated float. This command is meaningless for latex2hmtl but crucial for latex. |