Math & Sciencethesis and chapters

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
bmomo
Posts: 1
Joined: Wed Jan 20, 2010 12:06 pm

thesis and chapters

Post by bmomo »

Hi all,

I'm a phd student and I'm writing my thesis.I need help:
first, I need a makefile to compile my files thesis (chapters): make thesis.ps (example).
second, I need to compile each chapter in separation inside the same makefile:
make chapter1.ps (of course of the same thesis)

Thanks,
mb

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

thesis and chapters

Post by php1ic »

Here is the make file I use to compile my thesis (There are a few if you google it, I have borrowed the bits I need). It runs latex/bibtex as many times as necessary to get all cross referencing right.

Code: Select all

FILE=thesis
TEX=latex
RETEX="Rerun to get cross-references right"
BIB=bibtex
REBIB="There were undefined references"
PAPER=a4
FIGS=Figures/Chapter*/*.*ps*

$(FILE).dvi: *.tex $(FIGS) $(FILE).bib
	$(TEX) $(FILE)
	grep -q $(REBIB) $(FILE).log && $(BIB) $(FILE) ; true
	while ($(TEX) $(FILE) && grep -q $(RETEX) $(FILE).log) do true ; done

#Create ps
$(FILE).ps: $(FILE).dvi
	dvips -Ppdf -t$(PAPER) $< -o

ps: $(FILE).ps
When you say compile each chapter, do you mean only include that chapter but still include all of the front and back matter ie. table of contents and bibliography?

You could add the line \includeonly{} to the main file then add a rule something like this for each chapter

Code: Select all

chapter1: chapter1.tex
	sed 's/\includeonly{.*}/\includeonly{$@}/' $(FILE).tex > temp && mv temp $(FILE).tex
	$(TEX) $(FILE)
	grep -q $(REBIB) $(FILE).log && $(BIB) $(FILE) ; true
	while ($(TEX) $(FILE) && grep -q $(RETEX) $(FILE).log) do true ; done
Post Reply