Scrivomatic: How to make figure/table title above content

ch
christoski
Posts: 5
Joined: Fri Aug 30, 2019 11:03 pm
Platform: Mac

Tue Mar 17, 2020 6:40 pm Post

With the recent changes in APA 7th edition, tables and figures are supposed to have a title above the table or figure. My current work flow is writing everything in Scrivener in mostly plain/rich text with some compile replacements into MM (e.g., Figure <$n:figure:$@>) and occasional raw markup, and then I use Scrivomatic to export/convert into docx. I'm leveraging the auto-numbering placeholders in Scrivener, and since this is a long document (dissertation) I'm trying to avoid manually fiddling in Word after export where possible. Currently, everything exports fine but the figure/table titles are showing up below the figure/table.

My question: Where in the workflow do I need to make an adjustment (and how) to have the figure/table titles appear above the figure/table? Scrivener? YAML file? Docx reference file? Other?

I know I can manually do this in Word afterwards, but it's clunky and cumbersome. I'm currently formatting these as "caption" so they are recognized by Word styles in the export.

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

Wed Mar 18, 2020 11:24 pm Post

I think neither Scrivener nor Pandoc has any understanding of caption position in relation to the associated content being variable. With LaTeX you can simply adjust the LaTeX template settings to assign caption position. For Word, I don't know if there is a style setting (if there is then just edit the reference DOCX), but off the top of my head I don't ever remember seeing a caption placement setting in Word? What happens if you place captions above associated content directly in Scrivener?

One other solution would be Pandoc filters, which should be able to reposition captions during processing. You would need to ask on the Pandoc google group to see if someone could help create such a filter.

ch
christoski
Posts: 5
Joined: Fri Aug 30, 2019 11:03 pm
Platform: Mac

Thu Mar 19, 2020 6:05 pm Post

Thanks for the comments. A possible workaround is to just create a custom style , such as FigN (anything that's not called "Figure" or "Caption" to avoid confusing Word), using the normal auto-numbering replacements in Scrivener and just place them above the figures as desired, Then in the docx reference file, create a matching custom paragraph style (FigN). From there, if desired, in Word you can create a custom TOC that uses the custom style, FigN. APA now also has the title text (FigT below) on a separate line and an optional caption too, which means now there's 3 components. So in scrivener this looks like,

Code: Select all

 \n::: {custom-style=“FigN”} :::\n
Figure <$n:figure:$@>
\n:::\n

\n::: {custom-style=“FigT”} :::\n
Title text
\n:::\n

The actual figure
![Caption text][linked_image]



Where, \n is a return, done by typing option+return. APA also requires some bold and italics formatting, but I left those out in the above for clarity.

I'm also using compile replacements for the fence div notation so it's cleaner when I'm writing, and the standard Captions Style: Caption in the Pandoc compile options. It's a bit of a hack, but it seems to be working.

ch
christoski
Posts: 5
Joined: Fri Aug 30, 2019 11:03 pm
Platform: Mac

Thu Mar 19, 2020 6:20 pm Post

nontroppo wrote: I don't ever remember seeing a caption placement setting in Word? What happens if you place captions above associated content directly in Scrivener?


In Word, when you select an image and use the "insert caption" function, it offers you the option to place it above or below, but you have to do this manually for each image. It's really meant for if you're doing everything in Word rather than importing something in. So far, I haven't found any way to adjust the default or bulk edit this.

Scrivener allows you to put the caption above or below the content, but the exported MM file has no concept of above or below (as far as I can tell), so Word just defaults to placing it below.

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

Thu Mar 19, 2020 8:55 pm Post

Glad you found a solution using styles. If you create a simple word document with 2 figures, one caption above and another caption below, save the document and then unzip it (DOCX is just a bunch of XML files zipped up); you should be able to see the XML that controls this, and possibly a way to handle this if you have the skill to parse XML in a scripting language...

ch
christoski
Posts: 5
Joined: Fri Aug 30, 2019 11:03 pm
Platform: Mac

Thu Mar 19, 2020 9:53 pm Post

nontroppo wrote: if you have the skill to parse XML in a scripting language...


That's above my pay-grade. :P