Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xnos addition #94

Merged
merged 20 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 17 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ INPUTDIR=$(BASEDIR)/source
OUTPUTDIR=$(BASEDIR)/output
TEMPLATEDIR=$(INPUTDIR)/templates
STYLEDIR=$(BASEDIR)/style
SCRATCHDIR=$(BASEDIR)/scratch

BIBFILE=$(INPUTDIR)/references.bib

Expand All @@ -18,41 +19,44 @@ help:
@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 '

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" \
Expand All @@ -61,6 +65,8 @@ docx:
html:
pandoc "$(INPUTDIR)"/*.md \
-o "$(OUTPUTDIR)/thesis.html" \
--filter=pandoc-shortcaption \
--filter=pandoc-xnos \
--standalone \
--template="$(STYLEDIR)/template.html" \
--bibliography="$(BIBFILE)" \
Expand All @@ -72,4 +78,5 @@ html:
mkdir "$(OUTPUTDIR)/source"
cp -r "$(INPUTDIR)/figures" "$(OUTPUTDIR)/source/figures"

.PHONY: help pdf docx html tex

.PHONY: help pdf docx html tex
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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.

Expand All @@ -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 ```bash install.sh``` in the main direcotry
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean this bash script? I don't see it! Should the install instructions be added to the makefile instead? (e.g. with a make install recipe)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that script didn't make it to a later release, since the Dockerfile made it redundant. I've added it back in. Having a make install recipe is an interesting idea. I'm going to put both in, as I don't want the lack of a shebang in the Makefile causing anyone headaches.

dendrondal marked this conversation as resolved.
Show resolved Hide resolved
- 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.

Expand Down
Binary file removed output/source/figures/example_figure.pdf
Binary file not shown.
Loading