joostkremers / pandoc-mode

An Emacs minor mode for interacting with Pandoc.
https://joostkremers.github.io/pandoc-mode/
178 stars 14 forks source link

template file option isn't passed on to pandoc #28

Closed plantarum closed 9 years ago

plantarum commented 9 years ago

Hi,

I'm trying to set a template file for converting from md to pdf. I've done this using the menu option, and also directly using M-x pandoc-set-template. After doing so I can see that option is set by M-: (pandoc--format-cli-options), which reveals "--template=/path/to/my/template.latex" as the first item in a list.

However, when I call pandoc via C-c / p, the pdf is produced using the default template. Walking through the code, it appears that pandoc--format-cli-options is returning an empty list, but that could be a side-effect of edebug, so maybe a red herring. In any case, my template is not being applied!

Thanks, love this package otherwise!

Tyler

joostkremers commented 9 years ago

Just to be sure, I tried setting a latex template file and creating a pdf and it works as it should. What I suspect is happening is that when you set the template file option, your output format is not set to latex.

When you create a pdf, pandoc-mode uses the settings for the latex output format, regardless of what the current output format is. This means that if you want to change the settings used for creating a pdf, you need to change to the latex output format first, change the settings and save them.

This is consistent with what you report: if you call M-: (pandoc--format-cli-options), you’ll see the settings for the current output format, but when you run C-/ p, pandoc–format-cli-options formats the latex options, which don’t include the template option.

If this is not it, let me know, then we’ll need to do a bit more debugging.

plantarum commented 9 years ago

That was the issue. Thanks very much for your quick response!