# Replacing figure with figure* globally in Pandoc-created documents

I use Pandoc to create TeX files as chapter templates that are then fed back into Pandoc to create the final PDF. This sets some limitations, since some of the ways Pandoc writes TeX is hard-coded.

One problem I encountered with this is with figures in two-column documents. I would like to have figures that span both columns. I know this could be achieved with using figure* instead of figure, but since Pandoc writes the figure code, I'm stuck with figure everywhere in the document. Can I globally define that figure, is replaced by figure* instead? I've tried various ways of trying to redefine the command, but haven't been able to get them to work.

I found that somebody had change the default settings for figure floats in Pandoc-created documents with the following code:

% Overwrite \begin{figure}[htbp] with \begin{figure}[H]
\usepackage{float}
\let\origfigure=\figure
\let\endorigfigure=\endfigure
\renewenvironment{figure}[1][]{%
\origfigure[H]
}{%
\endorigfigure
}


I tried changing this to

\usepackage{float}
\let\origfigure=\figure
\let\endorigfigure=\endfigure
\renewenvironment{figure}[1][]{%
\origfigure*
}{%
\endorigfigure*
}


But the \renewenvironment seems to change only the arguments, not the command itself. Is there better solution? Am I simply using the wrong syntax?

• use \begin{figure*} not \origfigure* (which is not the same thing at all) – David Carlisle Jan 22 '16 at 13:26
• Where, exactly, should I use \begin{figure*} in my redefinition? – krax Jan 22 '16 at 13:52
• where you have \origfigure* (and same for the end) – David Carlisle Jan 22 '16 at 17:03

The correct solution is

\usepackage{float}
\let\origfigure=\figure
\let\endorigfigure=\endfigure
\renewenvironment{figure}[1][]{%
\begin{figure*}
}{%
\end{figure*}
}

• Does it really worked with you? It keeps asking me for /begin{document}. – lf_araujo Mar 13 '17 at 21:19
• It does. There is probably some other problem with you template. You typically see the /begin{document} error when some other environment is not ended properly. – krax Mar 24 '17 at 6:38