phyllisstein / Pandown

A powerful, versatile, highly Subliminal Pandoc build wrapper for ST2/3
64 stars 12 forks source link

What is the format for "pandoc_arguments" #11

Closed Utsira closed 10 years ago

Utsira commented 10 years ago

Hi

I would like to add the arguments that I use when I invoke Pandoc in the Terminal to the pandoc-config.json file for my project, but I'm not sure how to format them. Here is what the start of the file looks like:

{
    "pandoc_arguments": 
    {
        "-o ~/Dropbox/publications/JJKC/Rig.pdf"
        "--bibliography ~/Dropbox/Notes/nnstanp2grepbtf.bib"
        "--csl ~/Dropbox/Notes/modern-humanities-research-association.csl"
        "--latex-engine=/usr/texbin/xelatex"
        "-V geometry:margin=1in"
        "-V mainfont='Minion Pro'"
        //////////////////////////////////////////////////////////////////////
        // Arguments are explained in Pandoc's documentation:               //

I have Build System set to Pandown Markdown. But when I hit Build I get this error:

Pandown: Error constructing Pandoc command.

These arguments work fine in the Terminal. I guess I've not formatted the arguments correctly, but any pointers as to what's going wrong would be helpful (perhaps the json file should have some examples of how to format arguments in the comments?)

phyllisstein commented 10 years ago

You need to use the arguments defined in the JSON file, below where you inserted yours. The output file is determined automatically, but you'll find bibliography, csl, and latex-engine on the list. Variables are set in the variables JSON dict, with keys and values specified as JSON keys and values ("geometry": "margin=1in" and "mainfont": "'Minion Pro'").

Utsira commented 10 years ago

Thanks, I got the arguments working, and it produces HTML correctly. But how do I get pdf output? When I specify an output file with a pdf extension, I get this error in the console:

pandoc: cannot produce pdf output with html writer

phyllisstein commented 10 years ago

Search for pandown pdf in the Command Palette. One of the options, if you're building from Markdown, should be "Build: Pandown: LaTeX - PDF." The reStructuredText build system should have the same option. Building from HTML to LaTeX is not currently supported.

Utsira commented 10 years ago

Great, got it working, thanks!

So it isn't possible to include the arguments LaTeX - PDF in the JSON file?

I'd like to set up a keyboard shortcut for the command as I'll be using it a lot, but having difficulties. I've added this to Default (OSX).sublime.keymap - user:

[
{ "keys": ["alt+super+b"], "command": "build", "args": {"Pandown": "LaTeX - PDF" } }
]

but it just produces HTML, not the pdf.

Apologies for all these questions, I'm new to ST3, and thanks for all of your help so far.

phyllisstein commented 10 years ago

Not to worry! Try this:

[
    {
        "keys": ["alt+super+b"],
        "command": "pandown_build",
        "args":
        {
            "pandoc_to": ["latex", ".pdf"],
            "prevent_viewing": true
        }
    }
]

Let me know if that does---or doesn't!---the trick.

Utsira commented 10 years ago

It works, fantastic! Thank you.

phyllisstein commented 10 years ago

Excellent, glad to hear it. Be sure to let me know if you have any other questions.