Help in Passing Tabs Into Pandoc/docx (Using Scrivomatic)

I hope this is the place to ask for help with a vexing issue I’m having. I’ve been practicing the use of Scrivener to compile a Markdown file, which is then post-processed using pandoc (wrapped in pandocomatic, using the excellent scrivomatic script, developed by forum user nontroppo).

My end product is a .docx file, styled using a pandoc reference-file. For this particular document format I need to include tabs (that is, tab stops). Specifically, I have to include (several times) on a single line, some information (xxxxxxx), then 2 tab characters (i.e. \t or in ascii), then the related information (yyyyy). As in:
xxxxx xxxxxx xxxxxxx \t \t yyyyyy yyyyy

Since markdown smashes extra space and tabs, the only way I found to potentially handle this was to use the “preserve tabs” option on pandoc, which does what it says on the tin. However, preserve tabs only works on code formatted blocks. Which results in text styled as “Verbatim Char” or “Source Code” in Microsoft Word. Because of the way M$ created the .docx format, it’s not possible to set the text styles in the pandoc reference-file.

Somebody in a metafilter question (from someone with a very similar issue) gave a clever solution, suggesting that they convert \t tabs into ascii - then use pandoc -s -S (smart typography), which will reconvert the ascii back into the typographic character. Unfortunately, it appears as though the smart extension has changed since then, and no longer works with the pandoc .docx writer.

In summary:

  • Scrivener+scrivomatic = good! I use it to produce .docx using pandoc reference-file for text styling
  • markdown won’t allow tabs
  • except in 1 specific case
  • that specific case won’t allow template styling using pandoc
  • I’m losing my mind over 2 friggin tabs.

Help me Obi Wan Kenobis?

Oof, Solved it like 30 minutes after posting this.

The key was putting the ascii code ( ) in the scriv/text/markdown, and applying the paragraph style I wanted to use from the docx reference-file. It hadn’t worked for me because when I initially tried using the ascii code in Scrivener, the text was styled using Source Code, so of course the ascii code just passed through and showed up in the docx. When I used a different style, pandoc converted it automatically.

If you don’t want to litter everywhere, you could set up a replacement:

The caveat with this of course is if you also use TABs in code blocks etc. they will now not work as expected…

Hi, I would be very interested in how you did that, because that’s exactly what I need and I’ve been looking for something like that!

Did I get it right that you just put “&#9” into the text? That doesn’t work for me. When trying to run pandoc with -s -S I’m told that --smart/-S has been removed.

Did I miss anything? I’d appreciate your help very much!!!

Smart got turned into an extension:

It seems to be on by default at least for markdown input…

thats amazing