[Tex/LaTex] How to use pandoc-citeproc in raw latex block of a markdown document

pandoc

I'm at a loss. It's probably not possible out of the box, so I'm looking for a workaround.

In my markdown document, that I use with pandoc to generate a PDF, I want to include a figure with subfigures like this:

\begin{figure}[t]
\centering
\subfigure[fig 1]
      {\includegraphics[]{figa.pdf}\label{fig:figa}
}
\hspace{0.5cm}%
\subfigure[fig 2]
     {\includegraphics[]{figb.pdf}\label{fig:figb}
}
\caption[fig 1 and 2]{caption [@ref]}
    \label{fig:figs}
\end{figure}

Is there a way to make pandoc-citeproc parse the reference [@ref] in the raw latex environment? Or substitute the reference with another command that would still allow me to go from markdown to pdf directly without converting to tex first and then compile with pdflatex and bibtex?

I am using pandoc with the xelatex switch, a custom template, .bibtex + .csl files and the pandoc-crossref filter.

Best Answer

I am afraid there is no solution with pandoc-citeproc. Pandoc does not support direct PDF output if you pass the option -R (parse raw LaTeX). I would rather pipe the output as follows.

pandoc -s -S --include-in-header=foo.txt --biblatex markdown_rawlatex.md -o Ref_rawlatex.tex | xelatex Ref_rawlatex.tex | biber Ref_rawlatex | xelatex Ref_rawlatex.tex | xelatex Ref_rawlatex.tex

This command is under the assumption that use use biber as the backend of biblatex.

(There is a lot of potential in making a nice script or makefile out of this.)