LaurentRDC / pandoc-plot

Render and include figures in Pandoc documents using your plotting toolkit of choice
https://laurentrdc.github.io/pandoc-plot/
GNU General Public License v2.0
224 stars 8 forks source link

Half-width or text-wrapped figures? #65

Closed mgajda closed 9 months ago

mgajda commented 1 year ago

It would be nice to add an option to select the environment that changes the figures into half-width or text-wrapped.

Now it may be only achieved by using a generic re-definition of environment, as far as I know.

mgajda commented 10 months ago

A similar option for figure-less inline images would be useful.

Either of these just change headers/trailers in either LaTeX or HTML.

mgajda commented 10 months ago

For half-width figures, we may use the following:

\begin{minipage}{\columnwidth}
\includegraphics[width=\linewidth,height=0.28\textheight]{...}
\caption{ ... }
\label{...}
\end{minipage}

For text-wrapped figure, we need the following (see https://www.overleaf.com/learn/latex/Wrapping_text_around_figures):

\begin{wrapfigure}[lineheight]{position}{width}
...
\end{wrapfigure}

And add this to header-includes list:

\usepackage{wrapfig}

For inline images, we just dispense with \begin{figure} and \end{figure}.

One could make mutually exclusive options style=wrapfigure, style=inline, style=figure, and style=table.

LaurentRDC commented 9 months ago

pandoc-plot strictly generates a Pandoc Image block; the modification of this image block should be the domain of another Pandoc filter.

mgajda commented 7 months ago

@LaurentRDC The problem with pandoc image block is that it needs to be generated differently for a wrapped figure, and for half-width figure.