written by Eric J. Ma on 2016-06-22 | tags: academia writing grad school
I finally got down to doing it! Here's my brief notes on how I set it up; it may change a bit later on, as my needs evolve, but it should be enough instructions for others to get setup.
I'm writing a white paper on genomic surveillance, so I thought I'd experiment with something new. By switching over to writing in plain text, I can ignore all distractions by other word processors. I'm looking at you, Word, Google Docs and others.
Because I get to write in plain text, I also get to version control the text. By selectively committing logical blocks, I can also easily selectively revert unwanted commits; it's rare, but once in a while it's saved my work.
Because it's plain text, I can export to anywhere with a bit of configuration.
Because it's written publicly, it's great.
What I do here is basically use Sublime Text 3 (ST3) as a word processor. BibTex libraries are used for keeping track of papers, but I like Papers for organizing more than BibDesk - automatic downloading of PDFs is the best part. My compromise, then, is to export my Papers library to a master BibTex library prior to compiling everything into a single PDF. Papers can also add in Pandoc-style citations, which Pandoc can then parse to make an automatic bibliography. Everything is kept under version control, for reasons stated above.
It basically took me one morning's worth of time invested in tooling this up, but I can already imagine the amount of time saved by minimizing the time spent on formatting references, figure numbers, versioning, and (most of all) being able to write without being distracted.
/path/to/master/library.bib
.homebrew
, or download a fresh copy of the installer binary. Note the /path/to/pandoc
.pdflatex
is bundled. Note the /path/to/pdflatex
.pandoc-fignos
plugin, to enable automatic figure numbering. Again, take note of the /path/to/pandoc-fignos
.Install:
Configure:
Pandoc
"pandoc-path": "/path/to/pandoc",
"PDF": { "scope": { "text.html": "html", "text.html.markdown": "markdown" }, "pandoc-arguments": [ "-t", "pdf", "--latex-engine=/path/to/pdflatex", "-o", "/path/to/output.pdf", "--filter", "/path/to/pandoc-fignos", "--filter=/path/to/pandoc-citeproc", "--bibliography=/path/to/master/library.bib", ] }
Apart from placing these pandoc-arguments
under the PDF
section, you may want to do the same for the HTML
and Word
sections.
CiteBibTex
Find the corresponding configuration fields, and change them to the following (making appropriate changes):
"bibtex_file": "/path/to/master/library.bib",
"autodetect_citation_style": true,
Today I learned that ST3 has a "Distraction Free Writing Mode", under the View
menu. Earlier on, I also learned that it has a pane view mode, also under View -->Layout
. Both have associated shortcut keys. My writing interface ended up looking something like what's in Figure {@fig:two-pane}.
{#fig:two-pane}
My outline is on the right, and the main text is on the left, and there's no distracting tabs, sliding preview, or directory structure (as is what I'm used to for coding).
Get started by adding the YAML headers in the document (Figure {@fig:yaml-header}).
{#fig:yaml-header}
Specifically, the format of what I have above is:
--- title: "My Title Here" author: - "Author 1 (Affiliation)" - "Author 2 (Affiliation)" date: 22 June 2016 csl: nature.csl ---
More details on what metadata can be stored in the headers can be found on the Pandoc README.
Citations are done in Markdown by inserting:
[@citekey]
where the citekey
is automatically generated by Papers, usually in the form of LastName:YYYY[2- or 3-letter hash]
. An example of what gets inserted is [@Young:2013px]
. I was reading through Papers' documentation on the generation of a "universal" citekey, and I quite like the idea. I think the specification is worth a read, and is an idea worth spreading (sorry, I like TED talks).
I intentionally configured my ST3 Pandoc package settings to use a global master library, rather than a project-specific one. I think it stemmed more from laziness than anything else; one less thing to manage is a better thing.
Note that the way I had configured Pandoc (above) for PDF outputs was to use the master .bib
library for matching up references. An additional thing I did was to keep a copy of the citation style language (CSL) markup file in the same directory as the Markdown document.
Within ST3, we can use the Command Palette to quickly generate the PDF output desired. Steps are:
Select Pandoc
Select PDF as the output
Inspect that gorgeous PDF!
Check your references!
Just to show how the figures get numbered correctly (I don't have any in the draft whitepaper I'm writing), you can inspect the source code for this blog post, and the associated pdf file. Note how I've not numbered anything except the associated files. It's pretty cool.
Alrighty - and that's it! Hope it helps others too.
@article{
ericmjl-2016-tooling-markdown,
author = {Eric J. Ma},
title = {Tooling up for Plain Text Academic Writing in Markdown},
year = {2016},
month = {06},
day = {22},
howpublished = {\url{https://ericmjl.github.io}},
journal = {Eric J. Ma's Blog},
url = {https://ericmjl.github.io/blog/2016/6/22/tooling-up-for-plain-text-academic-writing-in-markdown},
}
I send out a newsletter with tips and tools for data scientists. Come check it out at Substack.
If you would like to sponsor the coffee that goes into making my posts, please consider GitHub Sponsors!
Finally, I do free 30-minute GenAI strategy calls for teams that are looking to leverage GenAI for maximum impact. Consider booking a call on Calendly if you're interested!