Looking for advice about using Scrivener for writing a scientific PhD thesis

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac

Sun Jun 09, 2019 3:55 pm Post

Hi everyone,

I've used Scrivener compiling to MMD to LaTeX, then to PDF before, but abandoned it for pure LaTeX due to frustrations with Scrivener (mainly due to my own lack of knowlege and being too short of time to learn what I needed to know).

My PhD thesis isn't due for another 2 years so I have plenty of time to get to grips :) My old workflow was Scrivener and MMD -> Latex, using Mendeley outputting a BibTex file as a citations manager. I had quite a bit of pure LaTeX embedded in my text, but is seemed to work OK.

So, questions.

1) Is this still the best workflow? I need to include equations, figures with multiple plots, tables and references in my thesis. Pandoc looks interesting but I've never used it and not sure what it gives over MMD.

2) Has anyone got a good tutorial on how to set up Scrivener for this kind of workflow? The ones I used originally are out of date, and the videos I can find on Youtube are not relevant.

Thanks, just trying to make the (re)-learning curve as painless as possible.
Emma

User avatar
nontroppo
Posts: 1246
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Mon Jun 10, 2019 12:48 am Post

I personally think Pandoc adds substantial added value over MMD alone. In particular, direct support of DOCX (many supervisors and editors still use Word...) and full bibliographic support in any output format for a thesis is worth it alone. The MMD or Pandoc workflows are very similar, both work best using Scrivener Styles and the compiler, and post-processing can fully automate final document production. Scrivener's manual is a great example of a complex MMD > LaTeX workflow, you can download and read through the scrivener project to see how it all works, and my Pandoc workflow is detailed in my signature...

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac

Fri May 01, 2020 9:31 am Post

Hi,
Thanks for the advice - I checked out your workflow and a couple of others and have started to build my own, currently simpler, workflow to ensure that I can do everything I require before I commit to it.

I'm using Zotero with Better BibTex plugin as my reference manager, and have installed the zotpick applescript Application, which works fine.
I compile my document to plain text.
I've installed Pandoc and various filters (citeproc, fignos, eqnos etc), and have a simple Pandoc command that converts the plain text to PDF.

I still have to get to grips with styles, but I've done quite a lot of webpage/css development so hope it is relatively straightforward.
I have 2 things that I need to get working though: figures and equations. I'm a bit confused by the Scrivener/Pandoc images documentation. I've tried using 'Image linked from File', the image appears in the document but it doesn't appear in my PDF. How do I get it to appear in the PDF?

For figures - I'm going to have a lot, this is a science PhD thesis, so the figures are the most important part. I'd like to have a link to an external file, so if I change them (they are produced using Python), the figure in the document is automatically updated. I also need to be able to reference them within the text, and have that reference update automatically if the order of figures changes (i.e. Fig 2 changes to Fig. 3). I can do this with LaTeX, can I do it in Scrivener? Also, can I edit the size of images using Markdown.

Equations - what's the easiest way to get numbered, propertly formatted equations that I can reference in similar fashion to figures?

thanks, I hope this is clear,
Emma

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac

Fri May 01, 2020 2:55 pm Post

Answering my own question here after a whole day of googling and experimenting:

I've created my own Pandoc-style format.
For figures, they are in a directory on the same level as my *.scriv, *.md files. I'm using the Pandoc and pandoc-fignos format to put them into the document, e.g.:

Code: Select all

![Caption](figures/my_fig.png){#fig:fig_id}

and referencing it using clever referencing (needed the cleveref.sty package installed), like +@fig:fig_id.

Equations were similar, using pandoc-eqnos, so in the document:

Code: Select all

 $$ y = mx + c $$ {#eq:eq_id}

referenced like +@eq:eq_id.

I've put my bibliography in the same directory, and added a script to do the Pandoc md -> pdf conversion. The only things I've found were that unlike the command line, I needed to put the full pathnames for pandoc-citeproc and pandoc-xnox.
I also had to add a --pdf-engine option with the full path of pdflatex.

I wanted to avoid the Scrivomatic approach as it seems incredibly complicated and I don't really have the time to work out what it's doing. This seems to be working OK so far.

User avatar
nontroppo
Posts: 1246
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Fri May 01, 2020 3:47 pm Post

Sounds good, glad you have a workflow that works for you. You can refine this as you go along.

A couple of things, Figures can be given specific sizes:

Code: Select all

![Caption](figures/my_fig.png){#fig:1 width=50% }


See link_attributes here: https://pandoc.org/MANUAL.html#images

And why don't you use the pandoc fig-nos method to reference figures (@fig:1), as this should be more generic and work with outputs other than LaTeX?

Note that if you use Python to generate your figures, there are supposed to be some Pandoc filters that run code live, so you can generate images as the document is being converted. I use MATLAB (which generates more ugly figures without huge amounts of fiddling) and I usually have to finesse my figures in Illustrator so never went down this road, but it does seem great if the script-generated figures are close to top-copy...

el
elw2u16
Posts: 28
Joined: Tue Nov 28, 2017 9:29 am
Platform: Mac

Fri May 01, 2020 4:04 pm Post

Thanks, I'll check the Pandoc filters out, the Python figures one sounds very useful.

I'm very new to Pandoc, so I only know what I come across while searching for help!

User avatar
nontroppo
Posts: 1246
Joined: Mon Mar 05, 2007 5:22 pm
Platform: Mac
Location: Airstrip One

Tue Aug 18, 2020 5:39 am Post

elw2u16 wrote:Thanks, I'll check the Pandoc filters out, the Python figures one sounds very useful.


Sorry for the late reply, this is the filter I referred to above: https://github.com/LaurentRDC/pandoc-plot — works with many plotting libraries to convert code to graphics during compile...