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

How to force position of plot like latex "figure" #29

Closed VolkovIlia closed 3 years ago

VolkovIlia commented 3 years ago

In latex I can specify position of figure by:

   \begin{figure}[htpb]
    ... figure contents...
    \end{figure}

How to do that in pandoc-plot?

LaurentRDC commented 3 years ago

Hi Ilia,

I'm not sure how to do this. pandoc-plot converts a code block to a figure block. In the conversion, some information is lost by pandoc. The precise information which is kept depends on the source format.

Are you converting from latex or to latex?

LaurentRDC commented 3 years ago

I don't think this question is directly related to pandoc-plot. I'll close this for now but don't hesitate to re-open if you need more help.

VolkovIlia commented 3 years ago

Sorry for waiting.

I use pandoc with pandoc-plot for writing articles. My workflow is markdown --> pdf + docx. But when I trying to add some plot (matplotlib) it appears somewhere in text after but not in direct place where I want. So, my question is how determine place for the plot? Command that I use:

pandoc -F pandoc-plot -F pandoc-crossref  -F pandoc-chem-struct --highlight-style=kate -s -C -o  "$base".pdf "$file" | pandoc -F pandoc-plot -F pandoc-crossref   -F pandoc-chem-struct --highlight-style=kate -s -C -o  "$base".docx "$file" ;;

Structure that I use:

{.python .matplotlib caption="XRD" preamble=include.py #fig:XRD}
LaurentRDC commented 3 years ago

No worries.

There's no way to control figure placement with pandoc-plot. Figure placement is based on which input format pandoc understands. For example, if your source document is in Markdown, then there's no way to set figure placement. See for example https://github.com/jgm/pandoc/issues/845.

I hope this helps. Keep an eye on https://github.com/jgm/pandoc/issues/3177. What you're looking for will be implemented in the near future.

VolkovIlia commented 3 years ago

Thanks! It working for me!)