Scrivener forum member @nontroppo has developed Scrivomatic, a system for technical writing that allows Scrivener to automatically access pandoc to produce documents containing typeset mathematics, footnotes, and bibliographic citations (with a wide selection of citation styles). The system depends upon pandoc-style markdown.
To familiarize people with the system @nontroppo has created a sample workflow.scrv project along with instructions for compilation within Scrivener. Upon compilation, output files with a range of formats are produced, demonstrating the versatility of the system. One of the output formats generated by Scrivomatic is LaTeX (
.tex). With this
.tex file it should be possible to use a program like TeXShop on the Mac to typeset a high-quality PDF. Within the TeXShop editor it would also be possible to tweak the
.tex file before typesetting, were that to be necessary.
However, in order to get the
.tex file to successfully compile to a PDF within TeXShop on my M1 MacBook Air, I had to complete the following steps:
- Update to TeXLive 2022 (though not sure this was strictly necessary)
- Move Calabri and the other Microsoft fonts to my font library
- Set the character encoding preferences in TeXShop to Unicode (UTF-8)
- Within TexShop, compile using the LuaLaTeX method rather than the LaTeX method
- Replace a superscript-minus sign (U+207b) with a hyphen-minus sign (U+002d) in the original Scrivener workflow document
I am not an expert in these typesetting issues but nevertheless I attempt to provide a bit more information on these steps below with the hope that it might be helpful to those, like myself, who are not (yet) LaTeX experts. More experienced users are welcome to correct any mistakes or elaborate on these topics.
To fix the “missing-font errors” generated by TexShop’s typesetting system I duplicated the Microsoft fonts from their location within Word’s directory to my library, as described in this Stack Exchange post. Specifically, I duplicated the fonts in
(Keep in mind, to get to a folder, even a hidden one, use Go > Go To Folder within finder.)
Some characters in the Pandoc generated .tex file would not render correctly within the TexShop editor until I changed the character encoding to Unicode (UTF-8) under TexShop > Preferences (I think it had originally been set to ASCI). Choosing the Preferences menu item in TeXShop brings up the preferences panel and then, from there, choose Source. The Encoding selector appears at the top right column; select “UTF-8”.
LuaLaTeX updates the character encoding of LaTeX. Evidently other typesetting systems accomplish this too (e.g., XeTeX).
Even with the above changes, a character still failed to render properly, namely the minus sign in the exponent of the number appearing in the Introduction of the Workflow.scrv document. In particular, a box appeared instead of the minus sign in both the TeXShop editor and the LuaLaTeX generated pdf. This was fixable by editing the Workflow.scrv file and then re-compiling this revised document within Scrivener as described in the Scrivomatic instructions [^1]. Specifically, within Scrivener I deleted the exponent
-48 by hitting the backspace key then re-typed the
-48 directly using the keyboard, then block-selected this
-48 and imparted to it the superscript style (i.e., selected Format > Style > Superscript). The number correctly renders within the subsequently compiled
.tex file as
[^1]: I don’t understand precisely why retyping
-48 and then applying the superscript style fixes the problem. It must have to do with a subtlety of the internal representation of the exponent in Scrivener. I suspect @nontroppo may have pasted the number into Scrivener from another source rather than typing it directly using the keyboard.