Pandoc: two questions: Blockquotes and Citations

After Pandoc converts a note into a .docx it doesn’t do anything with the “>” blockquotes. I tried the argument “-f markdown-blank_before_blockquote” but that doesn’t seem to do anything.

Is there a way to have an argument so that in the .docx blockquotes have a greater indent than the rest of the text?


And also, I’m having trouble with citations. I tried the Citations plugin but I can’t get it to work the way I’d like. I’m trying to work in MLA style, so you have the parenthetical (author-last-name page-number) thing and then at the end of the document you have an “automatic” bibliography. Effectively like the Zotero plugin in Word/Libreoffice. Is this possible?
I tried stuff like --citeproc and --csl and --bibliography, giving it the path to the files but I kept getting error messages (among others “error status 1”) which I can’t find anything online.

Thanks!

1 Like

@ReaderGuy42

Concerning your first issue: Pandoc should assign to all your blockquotes in the DOCX document a corresponding style, i.e., “blockquote”, or something like that, which you could change according to your preferences. You can also use --reference-doc=FILE Pandoc option to use the specified file as a style reference in producing a DOCX or ODT file. See https://pandoc.org/MANUAL.html#options-affecting-specific-writers for more details.

Concerning your second issue: Pandoc expects citations in [@citekey] or just @citekey format, like described in https://pandoc.org/MANUAL.html#citation-syntax, and a corresponding BibTeX or YAML file, which your could specify in the YAML frontmatter or as --bibliography=FILE option. You may also put your citations directly in a YAML frontmatter. For more details see https://pandoc.org/MANUAL.html#citations. If you use Zotero to manage your citations, using of Better BibTeX plugin for Zotero is recommended.

Thanks! I do already have a reference.docx file which works to a degree. Like my .md to .docx export then has the header (name and page number) and font, but not line spacing or blockquote format, which I have both set the way I’d like in the reference.docx

I tried the --citeproc thing but I don’t know what to do with it. I put it in the “Extra Pandoc arguments” field in the plugin settings but it tells me that it can’t read it or find it or something. I’m on Linux if that makes a difference. On that note I also don’t understand how or if I need to install a pandoc extension? Like it says under citation syntax “Extension: citations”. Is that something I need to add to the program somehow?

In that Extra arguments field I put in --bibliography ~/.pandoc/Library.json and when I try and convert a md to a docx I get the following error:

Pandoc export failed: Could not find bibliography file: ~/.pandoc/test.json Error running filter pandoc-citeproc: Filter returned error status 1

Even though I export my Zotero library (as “Better CSL JSON”) to that directory.
Any ideas? Thanks!

Ok, so I tried this in terminal and it worked with the bibliography:

pandoc -o test.docx test.md --bibliography ~/.pandoc/Library.json

which renders the citation in MLA style (last-name page-number). So the issue could be in the plugin?

When I switch everything over to .odt format the blockquotes get transferred to the target file but the line spacing is still not there.

First, I would check if the blockquotes are really recorgized correctly: Click on them and see which style they have in the DOCX document.

Please see https://pandoc.org/MANUAL.html#extensions. You don’t need to install anything. You basically can enable or disable extensions via command line options.

I don’t use the plugin, so I cannot say. However, is your bibliography file ~/.pandoc/test.json or ~/.pandoc/Library.json?

Yes, the blockquotes have the “Quotation” format :slight_smile:

I’ve seen that, but I still don’t understand it haha; e.g. I put in the “-C” option to use citation rendering but the terminal tells me it’s an unknown option.

How do you do this then? All in terminal? I was honestly hoping for a way to do this a bit simpler than having to do that which is why I was trying to use the plugin. If I use the terminal the citation rendering works simply by using “–bibliography” and the directory.

The error message where it says “test.json” I had just copied from my post in the pandoc google discussion board; there someone had asked me to send a sample .json file which I called test.json; the same happens with my real library though…

If you have issues concerning reference doc, you can search the pandoc-discuss mailing list on Google Groups.

From my link above:

An extension can be enabled by adding +EXTENSION to the format name and disabled by adding -EXTENSION.

I.e., you basically write

pandoc --from markdown+citations --to docx ... 

The most Markdown extensions, however, are enabled by default, so in the example above you can skip the +citations part. Pandoc will also try to determine the source and output format from the corresponding file extensions, so you actually can skip the --from and --to options as well.

Yes, I do it in terminal or via shell scripts or makefiles.

In your case the terminal command would be something like:

pandoc --citeproc --bibliography ~/.pandoc/Library.json -o test.docx test.md 

The option --bibliography will probably enable the option --citeproc automatically, when converting to certain formats like DOCX.

If it works in terminal, but you still have issue with the pandoc plugin, I would perhaps suggest to contact the author(s) of the plugin.

Thank you so much! I’ll do it this way then :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.