# Starting a PhD; Any guides to setting up a 'system'?

I'm starting a PhD and am being overwhelmed with the different possible ways people do things, and how they very rarely mix.

I'm (obviously) sold on TeXing it, and have a ViM background I intend on continuing, and am using Mendeley for article tracking.

Can anyone suggest/recommend a 'system' guide for managing a thesis-size work in TeX including citing/referencing/bibliography, images and charts etc?

Another nice aid would be a way of integrating a project diary in the same system, but I'm open to experienced ideas about that.

I used TeX for my MEng thesis but I'll admit that at the end it was barely holding together with the equivalent of duct-tape and love, would like to start off this with a bit more contributed-wisdom.

Either way, unless the guide you recommend has already done an exemplary job, I plan on writing up my own 'guide' to hopefully help someone else down the line.

-
I can only speak for myself, as I am in the process of writing my own thesis. I try to keep everything broken down into separate files (sections and figures alike) and read some guidelines already posted here, on TeX.SX. I am awaiting your guide, could be really useful! I think it's a bold idea and wish you good luck! :) –  Count Zero Oct 10 '11 at 11:36
–  Werner Oct 10 '11 at 17:57
Minor comment: Git isn't the only DVCS, despite what all the answers might suggest! If you go that route (and I recommend it) you should work out which is the best for you. Take a look at: tex.stackexchange.com/q/1118/86 for more on DVCS and LaTeX. –  Loop Space Oct 11 '11 at 18:57
My other piece of "sage advice" would be: don't spend so long on getting the perfect set-up that you don't do any actual research! And as you work, you'll discover more of what does and doesn't work for you (it took me about 10 years to find a reference system that I liked), so be flexible and prepared to change (but not too prepared: see the start of this comment). –  Loop Space Oct 11 '11 at 19:02

• Universities normally have poorly written guides and badly designed template requirements. Most of these are remnants of solutions to problems caused by typewriters. If your University does not have one and you are free to use your own style consider yourself lucky.

Start fresh from a good base class. book, memoir or Koma and modify as you need.

• Use a version control such as Github early.

• Write clean tex files. See, for example Will Robertson's Github page, which I recommend you use as a guide. You can also find a lot of information here at tex.sx (e.g., see Writing and managing thesis in LaTeX).

• Last but not the least, start typing your thesis immediately. When I wrote mine I had two extra files, one called journal.tex and another todo.tex, but that was a long way ago and there are better ways for this sort of thing now. Currently at work I use a localhost with a wordpress installation for these. I also use Jabref for managing references.

As my late professor used to say "... anyone that writes a thesis using LaTeX deserves a PhD for this alone", good luck!

-
My advisor used to say: "There are two kinds of theses: a good thesis and a done thesis." –  Matthew Leingang Oct 10 '11 at 17:07
Although it's interesting that Will's thesis is in a public GIT repository, I'm not sure that this is wise advice generally. One's individual research probably shouldn't be open sourced while in progress for any number of reasons. Since most science is collaborative, I would also check carefully with your advisor before putting any such research in an open repository. Github private repositories are cheap (~\$60/yr), so although I heartily recommend using it, I would strongly suggest keeping it in a private repository. –  Alan Munn Oct 11 '11 at 15:07
One other comment: since social coding isn't the goal for your thesis (I hope) and therefore the number of site users is less relevant, BitBucket provides free private repositories, and offers similar functionality to GitHub. –  Alan Munn Oct 11 '11 at 15:19
In fact, GitHub offers free private repositories for students as well. –  Alan Munn Oct 11 '11 at 19:27
–  eykanal Oct 11 '11 at 20:45

• Use Git and comment prodigiously. It's always nice to know why you added something (e.g., "added section on blabbidy blab because Prof X wanted it there.")
• Consider splitting chapters/sections/thoughts into separate files and use the \input{file} function to combine them in one main file.
• Early on, find a good bibtex solution and learn to use it.
• If you're on a Mac, get to know TexShop, as it is awesome and will make things much easier.
• I put all my figures in a images/ folder to make things cleaner. You could consider using subfolders to organize even more according to your personal level of OCD.
• Use the todo package to keep track of what you need to do. You will end up with LOTS of notes to yourself; keep track of them somehow.
• This may not be a great idea, but consider never delete anything. Even with version control. Just add a \begin{comment}, \end{comment} block around text you decide not to use. You may come back to it later. Alternatively (and probably better), find some way of keeping track of your snippets of text... chances are, if you spent time writing it, you will be able to make use of it, if not now then later.
-
If you have an academic association (Which I assume everyone doing a thesis has) you can use either Git or Mercurial for free on bitbucket.org in private. I've got an archive for each of my classes & my undergrad thesis. (Copy of above comment) –  Canageek Oct 11 '11 at 22:14

Thought I'd chime in here with a piece of surprisingly unmentioned yet super-critical advice. I strongly suggest you coming up with at least two backup plans. Hard drive failures and laptop thefts will set you back to the stone age the week before you hand in your dissertation. I'm a 3rd year PhD chemistry student. I manage our lab's computer cluster on a daily basis yet even I was dumb enough not to perform a backup in nearly 8 months only to be hit with a primary drive failure only 4 days ago. Thankfully I didn't lose any of my actual thesis stuff as I have a Dropbox account linked to 3 computers. With 2GB of space, this should be more than enough for any thesis plus revisions you may have to make (if you are using an unwieldy amount of high-res graphics), keep them backed up on some physical drives.

Backup your stuff at least once every week or two.

-
Thanks for this; I am using bitbucket as a VCS for both my thesis, bib's, lit-review notes and using commit messages as a journal. –  Andrew Bolster Oct 17 '11 at 9:21
very good point indeed. However, the 2 GB might be enough for the thesis files itself, but not for numerical data, literature etc. –  Martin Jan 23 '12 at 0:17

• I generated a lot of numerical results for my PhD thesis, plotted the results in Matlab and then included the graphics. I put a lot of details in my latex code immediately after the figures/tables describing how the parameters were set so that I could regenerate the results without too much trouble. For example

\begin{figure}[!h]
... figure code ...
\end{figure}
% Parameters used to generate figure
%
%  a = 4
%  b = 3
%  etc....

• I wish that the cleveref package had been available- it's well worth reading the documentation.

The following fixthis command was very useful to me

%   - it puts a comment in the margin
%   - it writes to the log file
\newcommand{\fixthis}[1]%
{%
\marginpar{\huge \framebox{FIX}}%
\typeout{FIXTHIS: p\thepage : #1^^J}%
}%

-
I would say that the todos package by far the better solution instead of fixthis –  Dror Mar 9 '12 at 8:17

Use Git as often and specifically as possible. Important note: you can get a free Github academic micro plan that can be used for thesis or other research work.

To simplify review of specific chapters, instead of \input{}, use the \include{} command. This allows you to compile the entire document but only include material from a specified chapter (via \includeonly{}) in the pdf. The following produces a file with page numbers, table of contents, and references from all chapters, but only includes chapter 4 in the pdf output. It's as if you compiled the entire document and deleted out everything except chapter 4 from the pdf.

\documentclass[]{your-thesis}
\includeonly{chap4}
\begin{document}
\include{chap1}
\include{chap2}
\include{chap3}
\include{chap4}
\include{chap5}
\include{chap6}
\end{document}

-
You can also go with bitbucket and a free plan- I think that one is a bit more generous, and private. If you are truly paranoid there is nothing stopping you from making a free account with each and syncing to both of them, in case one goes down. Really wouldn't take much extra work. –  Canageek Oct 11 '11 at 22:17

I'm moving towards completion of a doctorate in Philosophy of Education (so my thesis is pure text). From the outset I was determined to avoid proprietary products for reasons that are well-rehearsed elsewhere on this forum. I have settled on using Eclipse with texlipse and subversion. Eclipse is useful because it allows me to have an editor, outline, problems and console (under the hood) views readily available. I find subversion to be essential. Since the server is hosted by my University I need never worry about losing my thesis with a week to go and I can easily branch a chapter to make a conference or journal paper. Another advantage of Eclipse is that I can work cross-platform. Path information needs system specific sections that can be easily commented out but that is a small price to pay for portability.

Like you I use Mendeley. This does require you to be a little organised since you cannot make changes in Eclipse to the Mendeley-generated bibs and have them read across to Mendeley. My preferred solution is to use Men. as my authoritative source but I keep an temp bib file which I use as a working copy. Once a chapter is signed off I then have some reflective, housekeeping time where I update Men. from the working bib file.

-

Signed up for a tex account just so I could post a quick little note here. Besides the excellent answers above, I would suggest using make. You'll probably end up with various "processing" things that you do to set up and build your output files every time you change your sub files.

I've got no idea what commands you'd want to run, but make allows for arbitrary commands in its pipeline. It will allow you to define how you build everything once, then forget about it. Make a change to some subfile, and just type make to get a new output file.

For an example of how to do the same thing with pdf files, as well as a good walkthrough of make, I recommend Managing projects with Gnu Make by Oreilly. The link is to a fork that's easier to read. This website includes additional links and info.

-
It might be even better to use latexmk. –  N.N. Oct 11 '11 at 14:50
I like scons, though I think I'm in a minority. A good choice if you know Python and don't mind doing a bit of Python scripting as part of your build process. And a scons + Python combo is much more powerful than make imo. –  Faheem Mitha Jan 28 '12 at 2:12
make, however, is an awful awful awful uncooperative monster --- the choking on tab/space distinctions is not even the worst of it. So +1 for a makefile of some sort for 'one command compiles everything', but boo to make itself. I don't know about latexmk and scons, but I picked up rake in an hour and I don't even know Ruby. Here's an introductory presentation and article. –  Esteis Jun 5 '12 at 11:37

In the case of bibliographies here is what I do.

I keep track of papers in a joint effort using Mendeley synch with my citeulike account.

One of the properties of citeulike libraries is that you can add tags to each article. So I tag articles with things related to the article itself or tags like CV or paperX. Citeulike offers you the option of exporting a particular tag set as a bibtex file.

The nice part is that you can download the bibtexfile as a text file from the command line using wget.

I usually have a small compilation script which fetches the latest version of the bibtexfile and compiles the .tex file, all done through vim. The main advantage of this method is that you can just focus on adding the proper articles to citeulike (one bookmark button;have a look on their website) and the compiling step will update everything and put it into its place.

In addition as I mention above, Mendeley is used as a graphical interface so you don't have to stop using it if you like it.

I hope this makes sense.

Here an example of my compilation script. It fetches first the bibtex files with a particular tag from my library and then runs the latex commands. I am using linux and hence evince to visualize the output file. The .tex file is called CV on this example.

wget -q -O cv.bib http://www.citeulike.org/bibtex/user/polivares/tag/*cv?do_username_prefix=0\&key_type=4\&incl_amazon=0\&clean_urls=1\&skip_private=t\&smart_wrap=1\&q= ;
/usr/bin/pdflatex -interaction=nonstopmode --src-specials CV.tex ;
bibtex CV;
/usr/bin/pdflatex -interaction=nonstopmode --src-specials CV.tex ;
/usr/bin/pdflatex -interaction=nonstopmode --src-specials CV.tex ;
evince CV.pdf &


I just have these lines saved in e.g compile.sh and run it from vim to save, compile and display it.

:w | ! sh compile.sh

-

Also came across another possibility for anyone else coming to this area. I highly recommend this from OpenWetWare as a LaTeX template for PhD stuffs.

-
Instead of posting a “Thank you” as an additional answer, you should thank users by upvoting their answers (with the upward pointing arrow to the left of the answer; you need 15 reputation points before you can upvote) and accepting one if you feel it is 'best' (by clicking on the checkmark). We want to keep the answer space reserved for actual answers, so this non-answer will be removed from public view soon. –  Joseph Wright Oct 19 '11 at 12:45
@JosephWright If you'll notice, I already had checked an answer, and upvoted all the answers that I investigated to a positive outcome, and that my answer contained a previously un-mentioned possibility. Edited to make it less thankful. –  Andrew Bolster Oct 19 '11 at 15:08