I thought I had posted this but it seems to have disappeared. Please forgive me if this is a double post.
I write in mmd in Scrivener, compiling to plain-text mmd that I then convert to Latex via Pandoc.
Upon compiling, I’d like to convert in-line footnotes that have square brackets at their edges to nonfootnotes, that is, make them just the square brackets, while leaving other footnotes alone. So, (using the plain-text double curly brackets formatting Scrivener uses for plain-text sync to indicate footnotes), I’d like to change
Based on my testing, it seems that Scrivener does not treat in-line footnotes as using double curly brackets when compiling, as trying to replace
does not work.
Any ideas or suggestions?
For those who are interested, my reasons for doing this: Pandoc has specific requirements for citations so that they can convert either to footnotes or in-line citations. I’d like to meet the Pandoc requirements while keeping all my footnotes as footnotes in Scrivener for both highlighting and word count.
The double curly-brackets are only used in plain-text syncing, that’s why nothing is happening with the compiler. I’m not sure what role they would have in compilation that isn’t already provided by other mechanisms already.
Another problem you’re going to run into is that footnote syntax is not generated until fairly late in the process, after Replacements have already run, so you can’t modify their syntax that way. Setting up a post-processing automation chain isn’t difficult however. If you install a copy of the MultiMarkdown support package, you’ll get a MultiMarkdown/bin folder in Application Support with a number of scripts in it. Scrivener will make use of some of these helper scripts under some conditions, and since they are just shell scripts, that gives you complete control over what happens to the MMD file after it leaves Scrivener—including executing Pandoc instead of MMD. In short, you can set up single-click Pandoc->TeX output.
The trick is to enable the “Use XSLT post-processing” flag in the Compatibility compile option pane, while MMD-TeX is selected. All this does is cause Scrivener to use the mmd2tex-xslt script in that bin folder. So feel free to edit that to do whatever you want, using whatever scripting language you prefer.
Coming back to the brackets, there is perhaps something you could try: linked comments happen to do exactly what you are looking for if they are left in with your compile settings: they wrap the content of the note in a single pair of square brackets, after the highlighted text. So you could use linked/inline footnotes as well as linked comments to get two different styles of output like this. Of course that does mean you’d need to use inline annotations for all internal comments to yourself, since linked comments would now be an output mechanism.
Thanks so much! I think I can work with the postprocessing scripts.