markdown-thesis-builder

Tool for building a PDF document from markdown files, using LaTeX styles and features.

https://github.com/instantiator/markdown-thesis-builder

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary
Last synced: 8 months ago · JSON representation ·

Repository

Tool for building a PDF document from markdown files, using LaTeX styles and features.

Basic Info
  • Host: GitHub
  • Owner: instantiator
  • Language: TeX
  • Default Branch: main
  • Size: 604 KB
Statistics
  • Stars: 13
  • Watchers: 1
  • Forks: 2
  • Open Issues: 1
  • Releases: 1
Created almost 5 years ago · Last pushed over 4 years ago
Metadata Files
Readme Citation

README.md

Template thesis

The things I'll do to avoid learning LaTeX.

This is a template for building a thesis PDF that's written in markdown, using features and styles from LaTeX.

  • Runs in a Docker container for portability.
  • Allows you to write primarily in Markdown for simplicity.

Markdown is easy to write, and will help you to write the bulk of your document. This project supports a few additional features you may also need:

  • Includes support for a cover page (not numbered).
  • Includes support for building a table of contents.
  • Numbers the various main sections of the document.
  • Includes support for LaTeX mathematics / formulae.
  • Includes support for citations, and a BibTex bibliography.

The whole document is built from source markdown files using a Docker container that contains everything it needs. The output is a PDF document.

Prerequisites

The build takes place in a Docker container.

Instructions for installing Docker are available below for OS X. Feel free to submit a PR with extra information for other systems.

OS X

On OS X, you can install Docker Desktop using homebrew.

  1. Install homebrew:

bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  1. Install docker:

bash brew install --cask docker

Building your document

Build the document with the build-project.sh script:

bash ./build-project.sh

On its first run, Docker will attempt to build the container before executing the build script that then converts your markdown to a single PDF document.

The final line of a successful build indicates where to find the final output PDF:

text Output document: source/build/Sample-Project_Your-Name.pdf

Sample output

Cover page and table of contents

Illustrating cover page and automated table of contents.

Methodology and bibliography

Illustrating footnotes, citations, formulae, figures, and automated bibliography.

Source files

Place your source files in the source/ directory. The build script expects to find:

  • cover/cover-page.md - the cover page of your thesis.
  • Markdown files with prefixes (eg. 01 to 08) - the main sections of your thesis.
  • bibliography.bib - a BibTex bibliography for your sources.

The main sections of your thesis will be sorted alphabetically (and so also numerically), concatenated with page breaks between them, before conversion to the output format.

NB. See sample files 05-XX-* for an example of how to split out a large section into smaller files to make them a little easier to edit.

Being cited

Repositories, such as this, can be made easy to cite using the CITATION.cff file. Find out more about how to edit CITATION.cff in the Citation File Format documentation.

Footnotes

Refer to your footnote with [^1] and provide the text of it anywhere in the document as:

text [^1]: this is the text

Citing other papers

bibliography.bib is a BibTex file containing your references.

An easy way to obtain BibTex reference information is to search for the reference on Google Scholar. You can then obtain a BibTex reference using the " symbol beneath your chosen search result.

To refer to something in your bibliography, use @-notation, and refer to the name of the entry in your bibliography, eg.

text this paper about Paralysis Proofs @ParalysisProofs

You can also modify your references, eg.

  • @Something
  • @Something [p. 45]
  • @Something [p. 45, and a suffix]
  • @Something [see also @SomethingElse]

Citation styles

Citations are styled according to source/util/citation-style.csl. You can see by inspection that this is a minor modification to oxford-university-press-scimed-numerical.csl, also in that directory.

CSL styles are available at the GitHub repository: citation-style-language/styles

The Zotero Style Repository is a nice facility to help you find, preview, and download different citation styles.

Formulae

The build script invokes pandoc with the markdown+tex_math_dollars option - which interprets LaTeX formulae surrounded by $ signs. There should be no space after the opening $ and no space before the closing $. eg.

latex $C_K = K + a^{2^t} \mod{n}$

There are plenty of resources for writing LaTeX formulae online. I found LaTeX/Mathematics quite helpful.

Figures

To include a figure in your document, provide it as a Markdown image. The alternative text will be used as the figure's description, eg.

text ![Here is an aperture icon](resources/aperture.png)

(This aperture icon comes from Google Fonts.)

If you do not provide alternative text, the image will be included but not as a figure (as seen in the cover page).

To adjust the size of your image, you can provide some information in a suffix to the image markdown, eg. { width=100px }

The build script

The docker image contains build.sh from scripts/build.sh. It's a bash script that does the following things:

  • Clears out any previous output in source/build.
  • Prepares the cover page markdown with a following page-break.
  • Prepares the main document markdown by combining the additional sections, separated by page-breaks.
  • Converts the cover page to a PDF, using pandoc.
  • Converts the main document to a PDF, using pandoc.
    • Numbers the sections.
    • Prefixes a table of contents.
    • Builds formulae using tex math.
    • Builds and appends citations from the bibliography.
  • Combines the cover page and main document using pdfunite.
  • Prints word counts from each section.
  • Prints the location of the final document PDF in source/build.

Outputs from the script are found in: source/build

NB. The script expects to find section 00 (the cover), and sections 01 to 08 (for each of the main sections). If diverging from this structure, you may need to alter the main for I loop in the script.

Troubleshooting

Pandoc may crash without a very meaningful error. This could indicate that you have not assigned enough memory for Docker containers. Try increasing this assignment in Docker Desktop's Preferences / Resources page.

Contributing

If you've an improvement or modification, please submit a PR.

If you have any issues or suggestions, please create an issue.

Feel free to fork, improve, modify, or do whatever you please with this repository.

Owner

  • Name: Lewis Westbury
  • Login: instantiator
  • Kind: user
  • Location: London, UK

Senior dev / tech lead

Citation (CITATION.cff)

abstract: "This is a template for building a thesis PDF that's written in markdown, using features and styles from LaTeX."
authors: 
  - affiliation: "University of Oxford"
    family-names: Westbury
    given-names: Lewis
    orcid: "https://orcid.org/https://orcid.org/0000-0002-5919-8942"
cff-version: "1.1.0"
message: "If referring to this template, please update CITATION.cff. If you use this template for your own thesis, you may wish to update CITATION.cff so that your thesis is easily cited."
repository-code: "https://github.com/instantiator/markdown-thesis-builder"
title: "Markdown Thesis Builder"

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 12
  • Total Committers: 1
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Lewis Westbury l****s@c****t 12
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ghost (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

Dockerfile docker
  • pandoc/latex latest build