diff --git a/.travis.yml b/.travis.yml index 7e79e51e..75cc0184 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,8 @@ before_install: - brew install pandoc-citeproc - brew cask install mactex - tlmgr info fontspec + - sudo pip3 install pandoc-fignos pandoc-eqnos pandoc-tablenos \ + pandoc-secnos pandoc-shortcaption # Attempt to create a PDF script: diff --git a/Makefile b/Makefile index f000825c..5fb87e8e 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ INPUTDIR=$(BASEDIR)/source OUTPUTDIR=$(BASEDIR)/output TEMPLATEDIR=$(INPUTDIR)/templates STYLEDIR=$(BASEDIR)/style +SCRATCHDIR=$(BASEDIR)/scratch BIBFILE=$(INPUTDIR)/references.bib @@ -14,45 +15,52 @@ help: @echo 'Makefile for the Markdown thesis ' @echo ' ' @echo 'Usage: ' - @echo ' make html generate a web version ' + @echo ' make install install pandoc plugins + @echo ' make html generate a web version @echo ' make pdf generate a PDF file ' @echo ' make docx generate a Docx file ' @echo ' make tex generate a Latex file ' - @echo ' ' @echo ' ' @echo ' ' @echo 'get local templates with: pandoc -D latex/html/etc ' @echo 'or generic ones from: https://github.com/jgm/pandoc-templates ' +install: + sh $(BASEDIR)/install.sh + pdf: - pandoc "$(INPUTDIR)"/*.md \ + pandoc \ + --filter=pandoc-shortcaption \ + --filter=pandoc-xnos \ + --template="$(STYLEDIR)/template.tex" \ + "$(INPUTDIR)"/*.md \ -o "$(OUTPUTDIR)/thesis.pdf" \ -H "$(STYLEDIR)/preamble.tex" \ - --template="$(STYLEDIR)/template.tex" \ --bibliography="$(BIBFILE)" 2>pandoc.log \ --csl="$(STYLEDIR)/ref_format.csl" \ - --highlight-style pygments \ -V fontsize=12pt \ -V papersize=a4paper \ -V documentclass=report \ - -N \ --pdf-engine=xelatex \ --verbose tex: pandoc "$(INPUTDIR)"/*.md \ - -o "$(OUTPUTDIR)/thesis.tex" \ - -H "$(STYLEDIR)/preamble.tex" \ + --filter=pandoc-shortcaption \ + --filter=pandoc-xnos \ + --template="$(STYLEDIR)/template.tex" \ --bibliography="$(BIBFILE)" \ -V fontsize=12pt \ -V papersize=a4paper \ -V documentclass=report \ -N \ --csl="$(STYLEDIR)/ref_format.csl" \ - --latex-engine=xelatex docx: - pandoc "$(INPUTDIR)"/*.md \ + pandoc \ + --filter=pandoc-shortcaption \ + --filter=pandoc-xnos \ + "$(INPUTDIR)"/*.md \ -o "$(OUTPUTDIR)/thesis.docx" \ --bibliography="$(BIBFILE)" \ --csl="$(STYLEDIR)/ref_format.csl" \ @@ -61,6 +69,8 @@ docx: html: pandoc "$(INPUTDIR)"/*.md \ -o "$(OUTPUTDIR)/thesis.html" \ + --filter=pandoc-shortcaption \ + --filter=pandoc-xnos \ --standalone \ --template="$(STYLEDIR)/template.html" \ --bibliography="$(BIBFILE)" \ @@ -72,4 +82,5 @@ html: mkdir "$(OUTPUTDIR)/source" cp -r "$(INPUTDIR)/figures" "$(OUTPUTDIR)/source/figures" -.PHONY: help pdf docx html tex + +.PHONY: help install pdf docx html tex diff --git a/README.md b/README.md index 9c789fa4..fbc56d40 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Markdown is a super-friendly plain text format that can be easily converted to a - it automatically handles the table of contents, bibliography etc with Pandoc. - comments, drafts of text, etc can be added to the document by wrapping them in <!-- --> - it works well with Git, so keeping backups is straightforward. Just commit the changes and then push them to your repository. +- it is able to take advantage of autocompletion capabilities for figures and citations in several text editors (VSCode, Sublime, etc.) - there is no lock-in. If you decide that Markdown isn't for you, then just output to Word, or whatever, and continue working in the new format. ## Are there any reasons not to use Markdown? @@ -37,6 +38,7 @@ There are some minor annoyances: - Makefile => contains instructions for using Pandoc to produce the final thesis. - output/ => directory to hold the final version. - source/ => directory to hold the thesis content. Includes the references.bib file. +- scratch/ => directory to hold tables which can be converted between different formats. - source/figures/ => directory to hold the figures. - style/ => directory to hold the style documents. @@ -45,25 +47,13 @@ There are some minor annoyances: 1. Install the following software: - A text editor, like [Sublime](https://www.sublimetext.com/), which is what you'll use write the thesis. - A LaTeX distribution (for example, [MacTeX](https://tug.org/mactex/) for Mac users). - - [Pandoc](http://johnmacfarlane.net/pandoc), for converting the Markdown to the output format of your choice. You may also need to install [Pandoc cite-proc](http://pandoc.org/demo/example19/Extension-citations.html) to create the bibliography. - - Install @martisak's shortcaption module for Pandoc, with `pip install pandoc-shortcaption` + - [Pandoc](http://johnmacfarlane.net/pandoc), for converting the Markdown to the output format of your choice. + - Pandoc plugins by running ```make install``` - Git, for version control. 2. [Fork the repository](https://github.com/tompollard/phd_thesis_markdown/fork) on Github 3. Clone the repository onto your local computer (or [download the Zip file](https://github.com/tompollard/phd_thesis_markdown/archive/master.zip)). 4. Navigate to the directory that contains the Makefile and type "make pdf" (or "make html") at the command line to update the PDF (or HTML) in the output directory. -**In case of an error** (e.g. `make: *** [pdf] Error 43`) run the following commands: - ``` - sudo tlmgr install truncate - sudo tlmgr install tocloft - sudo tlmgr install wallpaper - sudo tlmgr install morefloats - sudo tlmgr install sectsty - sudo tlmgr install siunitx - sudo tlmgr install threeparttable - sudo tlmgr update l3packages - sudo tlmgr update l3kernel - sudo tlmgr update l3experimental - ``` +**In case of an error** (e.g. `make: *** [pdf] Error 43`), consult [this article](https://dalwilliams.info/lessons-learned-from-writing-a-phd-dissertation-in-markdown.html) for possible fixes. Most importantly, make sure tlmgr is properly installed, then run ```install.sh`` 5. Edit the files in the 'source' directory, then goto step 4. diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..3ec66165 --- /dev/null +++ b/install.sh @@ -0,0 +1,16 @@ + +#!/usr/bin/env bash + +sudo apt-get install pandoc-citeproc && +sudo tlmgr install truncate && +sudo tlmgr install tocloft && +sudo tlmgr install wallpaper && +sudo tlmgr install morefloats && +sudo tlmgr install sectsty && +sudo tlmgr install siunitx && +sudo tlmgr install threeparttable && +sudo tlmgr update l3packages && +sudo tlmgr update l3kernel && +sudo tlmgr update l3experimental && +pip3 install pandoc-fignos pandoc-eqnos pandoc-tablenos \ + pandoc-secnos pandoc-shortcaption diff --git a/output/source/figures/example_figure.pdf b/output/source/figures/example_figure.pdf deleted file mode 100644 index dcffff1d..00000000 Binary files a/output/source/figures/example_figure.pdf and /dev/null differ diff --git a/output/thesis.html b/output/thesis.html index 176f805a..abe9bf39 100644 --- a/output/thesis.html +++ b/output/thesis.html @@ -5,9 +5,72 @@ - + 01_title_page - +