md and pandoc processing: convert tables and rich text and preserve bibliography?

I am trying to get my first scientific paper work with Scrivener. So far I have managed to set up a pandoc process that works with my bibliography file (.bib). It will all be compiled to a docx. Everything is ok when I write with md syntax in Scrivener.
Next I tried to write some part in rich text and make a table in Scrivener. I hooked the option: Convert rich text to MultiMarkdown and Convert tables and list to MultiMarkdown. The rich text appeared like I wanted to in the docx, but all the citations did not. Do I have to choose or is it possible to write in rich text and still get my pandoc citations converted to docx?
The tables I tried did not appear in the docx.
I can see that footnotes written in Scrivener is handled ok.
Any help is appreciated.

If you enable “Convert rich text to MultiMarkdown” then Scrivener escapes the temporary citation markers: so you end up with [@myref2018] which breaks Pandoc being able to scan. You could replace these back in the markdown file before you convert to DOCX, or use “Treat as raw markup” for each citation block. I have asked that we should have an “escaping” toggle for that option so that a user can use “Convert rich text to MultiMarkdown” but still be able to generate refs or maths or many other markdown details that rich text alone cannot provide:


But the real question here is: why use only rich text when you can use styles? I write all my work using styles (so I use emphasis instead of italics, make a strong style to replace bold). You can make styles for inline maths, subscript/superscript, combine bold and emphasis and anything else. The document in the scrivener editor uses rich text for display, but on compile you can now transform the styles into Pandoc. You can even rebind ⌘i and ⌘b to toggle the style rather than the rich text. Using this workflow you can still use “Convert tables and list to MultiMarkdown” but can now disable “Convert rich text to MultiMarkdown” so you can use these natively in the editor and still get nice Pandoc out. You can download my compile format here to see how to transform styles to markdown on compile.

So you could work around this problem (treat as raw, post-processing), or move to Styles and not have to deal with it at all 8)

Thanks again for a very helpful comment. Of course styles is the way to go! I have set it up and am ready to go.

Can you provide more details on how you bind ⌘B /⌘I to styles?

I create Strong and “Strong Emphasis” character styles, then personally I use BetterTouchTool configured like so:

BetterTouch needs the full menu path, so for example: Format > Style > Strong allows BTT to toggle Strong style with ⌘B etc.

But you can use the built-in keyboard settings, where [normally] just the final menu entry name is sufficient (System Preferences > Keyboards):

As a small aside you can see some “impossible” key bindings like ⌘⌃⌥⇧A — I am using Karabiner Elements to remap my capslock key (which I hardly ever use) to provide this “Hyper” key. This gives me an additional key binding which never interferes with other keys. Pressed by itself it becomes [return] (as I’m left handed and single hand typing means the normal [return] requires a bigger move), and with ⇧ I can still make it toggle caps lock.

Thanks nontroppo. I wondered if you were using BTT or Keyboard Maestro to achieve the mapping.

I really like BTT, but actually for quite a while I just used System Prefs as it always worked well for me and I liked having it “native” (I can backup the plist and easily restore on different machines etc.). But now that BTT can sync via Dropbox, given all its other benefits (I have always love old school mouse gestures, like drawing an ‘r’ to reload a page) I now use it for all my keybindings.

Keyboard Maestro of course looks totally awesome, but I’ve never made the jump to using it, and I’m happy with Karabiner + BTT + Alfred (perhaps ignorance is bliss?) :laughing:

The main thing I like about BTT over System Preferences is that it can hit blind spots in the system. For example I have ⇧⌃B set to switch to Binder, via the Navigate ▸ Collections ▸ Binder command. Even if you specify that path fully in System Preferences, with “Navigate->Collections->Binder”, macOS doesn’t pick up the assignment until you physically go into that menu once and just look at it—then you’re good to go until tomorrow when it forgets again. Same with Revision Modes. I spent years having to look at that menu once a day, before switching over.

It’s also good for some kinds of commands that won’t target for some reason. Format ▸ Lists ▸ 1. 2. 3.. I can get to that one with “Format;Lists;(10)”, as it’s the tenth entry in the menu. I don’t actually bind that one to a shortcut, I bind it to sequence, “:leftwards_arrow_with_hook:1.⇥` in this case—which is another thing to like about it. :smiley:

On the other hand, on account of how BTT doesn’t have blind spots like that, I’ve found sometimes its assignments don’t update the menu entries themselves. Small price to pay though in my opinion.