iandol / scrivomatic

A writing workflow using Scrivener's style system + Pandoc for output…

Home Page:https://iandol.github.io/scrivomatic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TOC generation howto

madeinoz67 opened this issue · comments

As a new scrivener user I have your workflow up and running successfully. Thanks so much for sharing. I'm really excited about how this will help me with my study, less mucking around with formatting and references, more focus on my work!

My issue now revolves around customising and creating templates to suit my needs.

As an example. I'm attempting to create a format required for my essay submission that my institution requires. So far so good and have it as a docx with correct fonts and styling mostly in the correct format along with working integration for my referencing.

Where I'm really struggling is integrating of a Table of Contents on the correct page. How is this templated? From what I can see is Pandoc can generate a TOC with the --toc flag, however has can I define in scrivener, does it even need to be defined in scrivener?

Enable/disable TOC generation is indeed specified by Pandoc, which will then trigger the different ways to make a TOC in LaTeX, DOCX etc. — but the TOC itself is created from the different headings, and therefore the structure of your document in the Scrivener's Binder is what will specify the selections chosen for the TOC entries by default. But the exact placement is not easily controlled for DOCX, it is placed after the date/abstract metadata field, but currently before keywords/affiliations if you use those. You can of course move it in Word/LibreOffice manually, and add page breaks as necessary. But if you have very specific formatting requirements it may not be easy to fully automate it (well you could always write a post-processing script to edit the Word XML manually, I used to do this for LibreOffice documents to tweak things to my liking).

Thanks @iandol I'll play around more, currently I'm formatting for docx because it was the easiest for me to do as I Ive never touched LaTex before and seemed a bit daunting, however I see no reason I that I could use LaTex for PDF generation as the institution accept either pdf or docx, so will have more control around LaTex then.

So from what you're saying, I don't need to create any content or page holders in Scrivener, I leave it up to pandoc and its templates, in this case I'll look at creating a LaTex template for my requirements where I will have more control around my TOC. Then use that for my PDF generation.

Out of interest what's your workflow for creating and trouble-shooting your LaTex templates, what applications would you recommend on MacOs

I use Visual Studio Code as my main text editor now, which has a nice extension for working with LaTeX. My LaTeX knowledge is very limited, I hacked my own main template from the Pandoc default one, modified another for reports (Eisvogel) and one for writing letters with Scrivener (use metadata and it creates address, letterhead, signature etc. automagically into a spiffy PDF).

I use the MacTeX minimal installer and then add the packages I need on top (some info in scrivomatic readme). Problems get solved with Google as needed, LaTeX is totally baroque, but there are solutions online for most problems and enough users that problems can get resolved (Pandoc google group is pretty good too).

Pandoc>HTML>PDF using something like PrinceXML is an alternative, HTML+CSS is much more intelligible and rational for layout IMO, but there are still some outstanding problems (like maths), where LaTeX is still king...

lol I didn't even think of VScode and I use it all the time, right under my nose thanks its all helped me a lot @iandol