# Headings and advice to write a PhD in physics using LaTeX

I have 3 months to write a PhD thesis in French. I have a good level in LaTeX (wrote several memoires and many articles), however, I would like to know if you have any suggestions concerning good practises for this kind of work (more than 100 pages, figures, tables, bibliography, footnotes...)

What would be great would be to share a heading file, including all packages that will be needed during the writing.

I give you what I came up with:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage{lipsum}

\begin{document}
\chapter{Chapter 1}
\section{A section}
\lipsum[1-10]

\chapter{Chapter 2}
\section{Another section}
\lipsum[1-10]
\end{document}


I also noticed this excellent link: Jamie Stevens' Webpage

Any other suggestion is welcome.

-
This question is too vague. Please could you make it clearer exactly what it is you are asking? –  Seamus Jan 31 '11 at 11:08
If you are french then you have tuteurs.ens.fr/logiciels/latex with a lot of explanations. –  Alain Matthes Jan 31 '11 at 11:13
You might also want to check this question: tex.stackexchange.com/questions/326/… –  Martin Tapankov Jan 31 '11 at 11:25
I hope you're fluent in french otherwise the task seems impossible! :-D –  Matthew Leingang Jan 31 '11 at 13:28

Apart from very good things already said (version control and the use of \includeonly{}), here's what I did for my own PhD thesis written in French. I used this header (sorry for the long input and the French comments):

\RequirePackage[l2tabu, orthodox]{nag}
%%% Déclaration
\documentclass[a4paper,frenchb,pdftex,11pt,twoside,openright]{book}
\input{makeat} % bidouillages en tout genre

% \includeonly{a-base}
% introduction, 0-contextePbTVHD, 1-testsub, 2-HDContexteQual, 3-evalImpactSysDegsurQual, 4-metriques, 5-eval, 6-modQualVid, 7-modClassif, a-base, b-transfoCouleur, conclusion, publications

%%% Packages
%% Packages de programmation
\usepackage{ifpdf}
\usepackage{ifthen}
%% Packages primordiaux
\usepackage[utf8]{inputenc}
\usepackage[LY1]{fontenc}
\shutup \usepackage{fourier} \youcanspeak % pour les maths (avec suppression des warnings) !! À mettre avant lmodern ou garamond !!
\usepackage{agaramondpro}
\usepackage[kerning=true,babel=true]{microtype}
\usepackage{textcomp}
\usepackage{setspace}
\usepackage{fancyhdr}

%% autres packages
% maths
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{array}
\usepackage{multirow}
\usepackage{mathtools}
% déco
\usepackage{lettrine}
\renewcommand{\LettrineFontHook}{\color[gray]{0.6}}
\usepackage{tikz}
% layout
\usepackage[center, labelsep=endash]{caption} % avant subfig
\usepackage{subfig} % plusieurs figures en une seule (remplace subfigure)
\usepackage{pdfpages} % inclusion de pdf
\usepackage{titlesec}
\usepackage{wrapfig}
\usepackage[nottoc]{tocbibind}
\usepackage{colortbl}
\usepackage{booktabs}
\setlength{\heavyrulewidth }{0.2em}
% utile
\usepackage{lastpage}
\usepackage{eurosym}
\usepackage[utopia]{quotchap}
\renewcommand{\chapnumfont}{\usefont{LY1}{AGaramondPro}{b}{n}\fontsize{100}{130}\selectfont\color{chaptergrey}}

%% babel
\usepackage[english]{babel}
\usepackage[babel]{csquotes}
\MakeAutoQuote{«}{»}

% infos
\newcommand{\montitre}{Qualité d'usage en télévision haute définition : évaluations subjectives et métriques objectives}
\newcommand{\datesoutenance}{2 octobre 2008}

%% hyperref
\usepackage{graphicx}  % Graphiques internes et externes
\usepackage{pstricks}
\usepackage{pdflscape}
\usepackage[hyperindex, plainpages=false, pdfpagelabels, pagebackref, colorlinks=false, hypertexnames=false]{hyperref}

\hypersetup{
pdftitle={\montitre},
pdfauthor={...},
pdfsubject={...},
}
\usepackage[all]{hypcap}

%%% Commandes
\newcommand{\ornementChapitre}{\begin{center}\begin{Large}\textorn{2}\end{Large}\end{center}}
%% centrage des colonnes sur plusieurs lignes
\renewcommand\multirowsetup{\centering}
%% création d'un type de colonne centrée de largeur 1.5
\newcolumntype{D}{>{\centering}p{1.5cm}}
%% notes dans la marge
\newcommand{\note}[1]{\marginpar{%
\vskip-\baselineskip %raise the marginpar a bit
\raggedright\footnotesize
\color{red}{\itshape\hrule\smallskip#1}\par\smallskip\hrule}}
%% strong %%
\DeclareRobustCommand{\strong}[1]{%
\textbf{#1}%
}
%% dédicace %%
\DeclareRobustCommand{\dedicace}[1]{%
\clearemptydoublepage
\thispagestyle{empty}
\vspace*{\stretch{1}}\par
{\begin{flushright}\emph{#1}\end{flushright}\par}
\vspace*{\stretch{2}}
}
%% sur-paragraphe (ligne entre deux groupes de paragraphes) %%
\DeclareRobustCommand{\surparagraph}{%
\par\medskip
}
%% raccourcis %%
\newcommand\avc{H.264}
\newcommand\ituCC{ITU-R BT.500-11~\cite{itu-bt500-11}}
\newcommand\ituNfDx{ITU-T P.910~\cite{itu-bt910}}

%%% Paramétrages du document
%% url dans la même police que le reste
\urlstyle{rm}
%% profondeur de la table des matières
\setcounter{tocdepth}{2}
% \setcounter{secnumdepth}{8}
% on définit l'interligne pour tout le document
\onehalfspacing
% modification de la table des matières -- options titletoc
\usepackage{titletoc}
\titlecontents{part}
[3pc]
{\Large\textbf}
{\Large\textbf}
{}
%% redéfinition des labels (tableaux, figures, etc.) % voir french.cfg
%% définition des en-têtes et pieds de page
\pagestyle{fancy}
\fancyhf{} % on efface tout
\fancyfoot[RO,LE]{\ifthenelse{\value{page}=42}{\strong{--~\reflectbox{\thepage}~--}}{\strong{--~\thepage~--}}} % h2g2 style
\fancypagestyle{plain}{ % pour les pages de chapitre
\fancyhf{} % on efface tout
\fancyfoot[RO,LE]{\ifthenelse{\value{page}=42}{\strong{--~\reflectbox{\thepage}~--}}{\strong{--~\thepage~--}}} % h2g2 style
%% on enlève le pied et l'en-tête d'une page paire vide
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
\clearpage
{\pagestyle{empty}\origdoublepage}%
}
\let\cleardoublepage\clearemptydoublepage

%%% On attaque le vif du sujet
\title{Qualité d'usage en télévision haute définition : \\évaluations subjectives et métriques objectives}
\author{Stéphane Péchard}
\date{\datesoutenance}

\begin{document}
...
\end{document}


If you're interested in seeing the result, you can find it here: http://tel.archives-ouvertes.fr/tel-00348586/fr/

-
excellent, merci –  Mermoz Feb 3 '11 at 14:18
@Mermoz: some stuff are very specific (Garamond Pro is a pain to install for example), and to be honest, I spent a lot of time to design it (I even defined my own BibTeX style), so if you only have 3 months, stay focused on content :-) –  Stéphane Péchard Feb 3 '11 at 16:00
Wow. The result is excellent. I will certainly borrow a lot of things for mine in a couple of years. –  YuppieNetworking Feb 3 '11 at 19:56
@Stéphane: the optional argument pdftex in some packages is not needed –  Herbert Feb 8 '11 at 16:18
@Herbert: thanks for the remark, I corrected the code –  Stéphane Péchard Feb 8 '11 at 16:32

work with included files for each chapter one. Then you can uncomment single chapters in the list of \includeonly{} to speed up your compilation and the single files are less large which makes the navigation inside the code easier. All references, page numbers will be correct. In this examples code I name the files intro.tex, chap1.tex, chap2.tex and bib.tex. And using memoir or scrbook maybe a better choice.

\documentclass{book}
\input{preamble}% no \include here possible!

\includeonly{%
intro,
chap1,
chap2,
bib
}
\begin{document}

\include{intro}
\include{chap1}
\include{chap2}
\include{bib}

\end{document}

• An \include can have several \input but no other \include and cannot be used in the preamble part of the document
• An \input can be used anywhere and also be nested; the code will be exactly inserted at the place where \input appears
-
I agree with Herbert, scrbook or memoir are better choice than book. The "classic" classes are for US or UK users but in other cases, the Koma classes are excellent choices. With memoir, you avoid to use a lot of packages, because a lot of tools are available inside the class memoir.cls –  Alain Matthes Jan 31 '11 at 11:21
Memoir also has the advantage of being superbly documented –  Seamus Jan 31 '11 at 12:45
I remember now. In the \inludeonly approach one would have to edit one file e.g. chapter1.tex but run another one (this would be main.tex or something like that). I found this a bit annoying so I made the custom flags. This way I would only have to edit and run one file at one time. –  romeovs Feb 2 '11 at 9:32
@romeovs, there is also an \excludeonly. And it is much more simpler in usind as your custom flags –  Herbert Feb 2 '11 at 9:36
@Mermoz: where is your \bibligraphystyle{...} command? –  Herbert Feb 8 '11 at 16:15

Use some sort of version control. This has already helped me numerous times.

It's especially handy when working with someone else (also using google projects), but it can provide life-saving resques when working alone too (for eg. when you changed a paragraph whilst tired/drunk and want to change it back).

I also like the way I can hide the excess files tex creates (for referencing, figures (gnuplot), toc, tos,...). These files should not be added to your repository, so they wont clutter up the folder that much.

I use Cornerstone for Subversion, which isn't free but it's super awesome. You'll be able to find free apps too with a quick google search.

subversion ftw!

Another thing to consider is using modified headers making it possible to generate the separate chapter/section files when you're working on them.

I use:

\providecommand{\setflag}{\newif \ifwhole \wholefalse}
\setflag
\ifwhole\else

\documentclass[10pt,a4paper,oneside]{book}

\input{package.tex}
\input{tweak.tex}
\input{commando.tex}
%\input{font}

\usepackage{MnSymbol}
\usepackage{esint}

\begin{document}

\fi


END.TEX:

\ifwhole\else
\end{document}
\fi


MAIN.TEX:

   \input{header.tex}

\author{Romeo Van Snick}
\title{Thesis 1}
\date{\today}

\renewcommand{\setflag}{\newif \ifwhole
\wholetrue}

%DOCUMENT
\maketitle
\tableofcontents

\include{CHAPTER1.TEX}
\include{CHAPTER2.TEX}
...

\end{document}


CHAPTER1.TEX:

\input{header.tex}
this is chapter 1...
\input{end.tex}


So I can write and typeset each chapter separatly, and in the end add them all to the MAIN.TEX file. This way I don't have to wait as long when I'm editing chapter 10 and I want to check my changes.

The package.tex, commando.tex and tweaking.tex files contain all the stuff that is normally in my preamble. I've got the preamble nicely tucked away in these files so that I can use them later if I need to write another paper in the same style.

greets, Romeo

-
+1 for version control. But why not use \includeonly instead of custom flags? –  Matthew Leingang Jan 31 '11 at 14:55
thanks, I'm used to git as version controller but i was scared that the diff command would be unreadable since a tex document doesn't have a line-per-line structure as would a piece of code. Or maybe you don't use return inside paragraphes? –  Mermoz Jan 31 '11 at 15:02
@Mermoz: Git works fine with LaTeX. You may want to take a look at the vc package ( ctan.org/tex-archive/help/Catalogue/entries/vc.html ), which allows you to include version control information (from Git, Bazaar, or Subversion) in LaTeX documents. –  las3rjock Jan 31 '11 at 19:43
@Mermoz write with a strict "one sentence per line" structure and git can diff perfectly well. –  Seamus Feb 1 '11 at 13:49
@Matthew It's been a while now since I've started working using this setup. Can't remember exactly why I \includonly didn't do what I want. It had something to do with not being able to nest the \include commands if I remember correclty. –  romeovs Feb 1 '11 at 14:36

As far as the formatting of your magnum opus goes, ask around or google "<university name> latex thesis class" to see if there's a class file already written. Use that first. If your university has formatting rules from the typewriter era and you want to produce a document that you are pleased to look at, you can develop your own class file that provides the same commands with your implementation.

You should definitely use the \include and \includeonly mechanism to format only the part of the document that you are currently writing.

I would also agree with others that bibtex or biblatex is necessary for large bibliographies.

As for writing, I would follow the YAGNI principle. Just start writing. If you realize you need some special functionality, and you don't know how to implement it, stop and google, or come back here.

-
'.. has formatting rules from the typewriter era'. Indeed... –  Martin Tapankov Jan 31 '11 at 13:54

It would certainly be very difficult for us to give you any specific recommendations, as a lot could depend on your university's preferred styles and templates -- mine is very specific how a thesis dissertation should look like in terms of typefaces, page design, title and chapter formatting etc., and there is not much room for improvement or improvisation.

That being said, I'd recommend you start with some of the versatile classes such as memoir and KOMA-Script. They tend to be quite exhaustive in the amount of functionality and customization they include (memoir includes 25+ other packages for common operations such as glossaries, bibliography, indices, comprehensive front- and back-matter, etc.), but could be a bit restricting if you plan to go beyond what's offered from them.

-

buddy. I think you may consider checking beforehand what extra packages you will need to help you writing your thesis, e.g. code samples, long tables, custom indexes, endnotes, and so forth. That saved me a lot of research when I got to write my master thesis, as everything was ready, so I could focus only in my text.

I also agree with Herbert, create a separated file for each chapter and include them in your master document. You probably may also create some folder hierarchy to help you keeping track of figures and/or other files, e.g., figures/chap1 and so forth.

I also recommend you to use BibTeX in order to keep your references clean and concise.

On a sidenote, though I agree that memoir class is powerful enough and thus a better choice, I have been using the good old book class without problems.

Cheers!

-

For my PhD-Thesis I've used the excellent classicthesis package, which made most of the decisions regarding style obsolete. This was only possible, because my University has very lax restrictions on the layout. André Miede, the creator of the package, was also a great help in responding to a minor problem I had.

Obviously, other items from this thread apply

• Use a version control system, git or SVN or anything else, but use it!
• TikZ and PGF are great for grahps and figures (see my thesis, all (non-photo) figures were TikZed)
• \include and \includeonly are your friend for large compilation sessions
• add \usepackage{some package} for special needs as you go on with your writing
• Use a version control system. Did I already say this? :)
-

I don’t really like \include and \input so I’ve defined an \includechapter command for my master thesis. It works similar to \include but it also defines a new chapter so it can be used as follows:

% thesis.tex

% … preamble, document begin

\includechapter*{introduction} % unnumbered chapter

\includechapter{background}

\includechapter{outline}

…

% background.tex:

\title{Background and Related Work}

Lorem ipsum dolor sit amet …


And the command is defined as follows:

\newcommand*\includechapter{\thesis@includechapter}

\WithSuffix{\newcommand*}\includechapter*{\thesis@includechapter[*]}

\newcommand*\thesis@includechapter[2][]
{\begingroup
\ifx#1*
\def\title##1
{\chapter* {##1}
\else
\let\title\chapter
\fi
\input{#2.tex}
\clearpage
\endgroup}


This has the advantage of being extensible. For example, \clearpage could be exchanged for \cleardoublepage, you could automatically define a label for each chapter etc.

(\WithSuffix requires the suffix package.)

-
You wrote that it works similiar to \include. I cannot see where the *.aux file will be created. –  Herbert Feb 2 '11 at 21:55
@Herbert: not similar in that regard, sorry, shouldn’t have brought \include into the game at all. –  Konrad Rudolph Feb 2 '11 at 22:18

TikZ and PGF were indispensable for graphs and figures in my dissertation. Beamer was a hit for my defense.

Years ago, I saw a sign in a coffee shop across from university - "Lost: one floppy disk labeled 'Dissertation'". Thus, I will heartily second the above comment regarding version control, and I suggest regular, often use of it.

-

The main thing you need to do is to find out what your university requires. It can be quite a challenge meeting formatting demands. In case it's of any help, this latex style for MSc/PhD theses at Dalhousie University comes close to fulfilling the requirements at the university where I teach. Please feel to clone it, and modify it as desired, so long as you follow an open-source license.

-