Writing papers with LaTeX nowacki.org

I write a fair amount, primarily in the form of journal articles or other scientific writing output. For anything more than the most minimal documents I use LaTeX. My preferred editor is TeXShop. I generally keep program defaults, although one big recommendation is to use Single Window Mode: do this by clicking Window -> Use One Window. This way there are fewer windows to clutter up your workspace, so if you have multiple documents open, all the source and preview windows won't get mixed up.


Anything that approaches the length of a paper gets its own Git repository and accompanying Git remote. At the end of each day—sometimes more often—I make sure to commit my changes to the repo and push to the remote. This helps to keep a full record of changes to your paper. When using Git in this fashion I recommend using one sentence per line, and two newlines between paragraphs. This way Git will provide readable diffs between paper versions. I generally tag releases for different milestones, like initial submission to a journal, resubmission after reviewer comments, and so on. Put everything in the repo, including things like review comments, figures, and comments from coauthors.


I use Mendeley to take care of my bibliography. I suggest creating a folder within Mendeley for your paper, and drag publications used for that paper into this folder. Then export just that folder's citations to a .bib file and save in your manuscript directory. Reference this file from your main document. Each time I add a new reference in Mendeley, I re-export the .bib file to the paper directory.


For figures, use PDF as much as possible. Have a working figures folder that is separate from your paper figure folder. As you start referencing figures in your paper, copy them into a figures/ folder within your paper folder and include in your figure code block. As you update figures (changing units, adding subplots, or whatever) copy the new version into you paper's figures/ folder. Commit the new figure versions to your Git repo just like you commit text changes.


Even though I think LaTeX is superior to word processors like Word for composing journal articles, the utility of Track Changes is undeniable, especially when working with coauthors. When a paper is nearing the point where it will be shared with coauthors for their input, I use Pandoc to create a .docx version of the paper. (I recommend installing Pandoc via Homebrew on macOS.) The pandoc-converted version will take care of simple math, tables, figures, figure references, and citations. It may still look a little wonky, but it will be totally usable for Word track-changes edits from your coauthors. And if you send both the .docx and the .pdf output from LaTeX, they can see what complex math or tables should look like in the PDF.

Here's the code I use to generate a .docx from LaTeX source:

pandoc -F pandoc-crossref -F pandoc-citeproc INPUT.tex -o OUTPUT.docx


Counting words is pretty tricky with LaTeX, but you can get a good idea using TeXcount. It's probably already on your system. Type which texcount to see.

For referencing figures and tables, I have settled on the cleveref package, replacing \ref{...} with \cref{...}.

n.o home