4

Similar to $title$, $author$, and $date$, is there an $abstract$ parameter that one can pass to a latex file from the title block? Example:

\begin{abstract}
    $abstract$
\end{abstract}
  • 1
    There's been a thread about it in pandoc-discuss list – henrique Oct 5 '12 at 13:05
  • Although you've gotten an answer from Paulo here, questions about pandoc's input are generally off-topic here as they don't really involve TeX and therefore you would be more likely to get help on the pandoc mailing list that henrique links to. – Loop Space Oct 5 '12 at 13:30
11

I had a look at the documentation and found out that you can easily set new variables. Sadly, I don't think pandoc is able to automatically extract custom variables, since the documentation states that some variables are automatically set, other aren't.

We can extend default.latex from $PANDOC_HOME/templates to include an abstract verification. I made a copy from https://github.com/jgm/pandoc-templates/blob/master/default.latex and added the following code before the $body$ markup:

...    
$if(abstract)$

\begin{abstract}
$abstract$
\end{abstract}
$endif$

$body$
...

I saved my new file as article.latex. Now I can call:

$ pandoc --template=article.latex --variable abstract="I'm an abstract" INPUT -o OUTPUT.tex

The new block

\begin{abstract}
I'm an abstract
\end{abstract}

will be available in the generated file.

Hope it helps. :)

  • Gracias. Helped quite much. Not exactly what I'm looking for though, since you're passing the abstract in as arguments, whereas I want to define ALL my variables and parameters at the beginning of the .rst file in the header. – mt3 Oct 6 '12 at 7:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.