-
Notifications
You must be signed in to change notification settings - Fork 14
Files Make File
This section describes the makefile in detail with all variables and commands
defined in it. The first variable in the makefile is the name of the main
document, which is set to open_science_paper.Rnw. Right below that, you can
find the dependencies of the main file. If anything changes in one of these
files, the call of make in your repositories directory recompiles the whole
document.
# Maindocument
DOCUMENT = open_science_paper
# Dependencies maindocument
DEPENDENCIES = $(DOCUMENT).Rnw subdocuments/open_science_paper.* subdocuments/*.Rnw
The programs used for certain tasks are defined via variables. So you can simply change them to your needs by changing the variables. Right at the moment the commands are adapted for a Unix like system and need to be changed if you like to use the makefile on a Windows machine.
# Used Programs
KNITR = knit
BIBTEX = biber
PDFLATEX = pdflatex
PACKER= tar -czf
REMOVER = @-rm -r
PRINTER = @-echo
GREPPER = @-grep
COPY = @-cp
PDFVIEWER = okular
DATE = $(shell date +%y%m%d)
The variables below define folders that contain the empty document and the
document filled with example data. These definitions are used in the make tasks
expldoc and tmpdoc explained below.
# Folders
AIMFOLDER = subdocuments/
EXMPLDOCS = subdocuments/exmpl/*
TEMPDOCS = subdocuments/temp/*
The makefile can help you archiving your document. You can adapt the archive
name, date of storage and the files you wish to add to the archive. The archiver
can be changed under used programs. The program used to get the date is a Linux
program called date and would need adaption on other systems.
# Archive document
DATE = $(shell date +%y%m%d)
ARCHNAME = $(DOCUMENT)-$(DATE).tar.gz
ARCHFILES = $(DOCUMENT).pdf $(DOCUMENT).Rnw subdocuments data graphics makefile
The following variable defines the files to clean from the repository. All this files can be removed because they are generated on the compilation process. If you extend the Open-Science-Paper to use more LaTeX packages it is possible that they create additional runtime files that remain in the directory. If you like to remove them you can add them here to the makefile.
# Clean up the document folder
CLEANFILES = Bilder/*.tikz cache/* *.xdy *tikzDictionary *.idx *.mtc* *.glo *.maf *.ptc *.tikz *.lot *.dpth *.figlist *.dep *.log *.makefile *.out *.map *.pdf *.tex *.toc *.aux *.tmp *.bbl *.blg *.lof *.acn *.acr *.alg *.glg *.gls *.ilg *.ind *.ist *.slg *.syg *.syi minimal.acn minimal.dvi minimal.ist minimal.syg minimal.synctex.gz *.bcf *.run.xml *-blx.bib
Below you find the default rule which is used when you call make without any options.
-
Call:
make -
Executed workflow:
- Knitr
- PDF-LaTeX
- BibTeX
- PDF-LaTeX
# Default rule
all: $(DOCUMENT).pdf
$(DOCUMENT).pdf: $(DOCUMENT).Rnw subdocuments/open_science_paper.cls subdocuments/*.tex
$(KNITR) $(DOCUMENT).Rnw $(DOCUMENT).tex --pdf
$(PDFLATEX) $(DOCUMENT).tex
$(BIBTEX) $(DOCUMENT)
$(PDFLATEX) $(DOCUMENT).tex
You can call the tasks defined in the makefile when you use their name as option
on the make call (e.g make showpdf). The rule showpdf displays the compiled
PDF using the PDF viewer defined under the used programs.
# Special rules
showpdf:
$(PDFVIEWER) $(DOCUMENT).pdf &
The rule "warnings" displays the warnings that occurred on the last compilation
run. This warnings are written into the documents log file (call: make warnings).
# Print warnings
warnings:
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Multiple defined lables!"
$(PRINTER) ""
$(GREPPER) 'multiply defined' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Undefined lables!"
$(PRINTER) ""
$(GREPPER) 'undefined' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Warnings!"
$(PRINTER) ""
$(GREPPER) 'Warning' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
$(PRINTER) "Over- and Underfull boxes!"
$(PRINTER) ""
$(GREPPER) 'Overfull' $(DOCUMENT).log
$(GREPPER) 'Underfull' $(DOCUMENT).log
$(PRINTER) "----------------------------------------------------o"
The "archive" rule creates a document archive with a name defined under the "ARCHNAME" variable. It adds all folders and files defined under the "ARCHFILES" variable.
# Archive the document
archive:
$(PACKER) $(ARCHNAME) $(ARCHFILES)
The rule "clean" removes the files defined under the variable "CLEANFILES" from your document folder.
# Clean document
clean:
$(REMOVER) $(CLEANFILES)
The Open-Science-Paper comes filled with example content by default. You can
use it to learn from or adapt to your needs. If you like to start with an empty
document you do not need to remove all that content by hand. You can simply
issue make tmpdoc and you are done.
The only content that remains is the header text because it is defined inside
the class file and two example entries in the BibTeX file. If you like to revert
to the default example content of the document you can issue the make task make expldoc. But note that this will overwrite all your changes to the sub document
chapter files.
# Switch contents
expldoc:
$(COPY) $(EXMPLDOCS) $(AIMFOLDER)
tmpdoc:
$(COPY) $(TEMPDOCS) $(AIMFOLDER)
The last rule inside of the makefile copies changes to the example and temporary file folders. It is a development helper and not thought to be used by the end user.
# Prepare subfolder documents
prep:
$(COPY) subdocuments/open_science_paper.cls subdocuments/open_science_paper.sty subdocuments/exmpl/
$(COPY) subdocuments/open_science_paper.cls subdocuments/open_science_paper.sty subdocuments/temp/
- If you spot a typo, feel free to edit the wiki directly
- If you don't understand something, please email ctpfaff
- If you have have a longer contribution, please contact me first
Installation
Structure and Files
Typesetting
- The title header
- The footer
- Sectioning
- Lists
- Citations
- Figures
- Tables
- Math
- Code chunks
- Code listings
Workflow