1
votes

Is there a way to tell Pandoc to set \jobanme to a specific value while converting and compiling single markdown file to PDF (via LaTeX)? -Preferably the name of the source *.md file.


background:

I have my own LaTeX document class defined which uses \jobname. It prints it in the document footer, so that it's easy for me to find source file/repo having a printed PDF. I set jobname in my compile scripts as pdfLaTeX argument.

I am currently trying to use my document class as LaTeX template for documents processed by Pandoc from Markdown source. It seems, Pandoc sets \jobname always as 'input'. I can set any variable in Markdown's yaml header which may be then printed into PDF, but being able to set it based on true md file name will be much less error prone.

1
you'll have to make your own template, see pandoc.org/MANUAL.html#templatesmb21
That's exactly what I'm doing, and I'm using the \jobname in my LaTeX template. The only thing I need is to enforce Pandoc (who calls pdfLaTeX) to specify the value of \jobname I need. Could you provide more details, @mb21 ?MaciekS
did you read the MANUAL? it sounds like you want to use pandoc template variables instead of LaTeX commands...mb21
@mb21, who said that? Once again: I've got my own LaTeX class 'mydoc' based on article. If I compile a LaTeX document begining with \documentclass{mydoc} it looks like article but with my logo at the top and the value of \jobname at the bottom of each page. If I compile the document as pdflatex some_file.tex I have 'some_file` printed in the footer. If I compile a bigger document which is inside of a git repo, I use command with --jobname=repo_x. I want to set the documentclass in my markdown yaml header to "mydoc", and get the md file name printed in the footer of my document.MaciekS
There is the option --latex-engine-opt which may be used to set the --job-name argument to whatever I need. Sadly this do not work. Using pandoc --latex-engine-opt=--job-name=xxx <...> I get pandoc: Error producing PDF. I expect pandoc looks for input.pdf as the temporary input file is hard coded let file = tmpDir </> "input.tex", and jobname changes the name of the produced PDF file. As a solution I changed my class to use srcrepo var. I set it with pandoc -V srcrepo:xx.MaciekS

1 Answers

0
votes

I solved my problem by redefining my LaTeX template and using sourcefile pandoc variable instead of \jobname in case of using pandoc.