If the figure is oversized (larger than \textwidth), it needs special handling. Otherwise, in the pdf the figure will start at the end of left margin, and only overflow to the right margin. 

On Friday, 21 October 2022 at 19:40:56 UTC+3 fiddlosopher wrote:
I'm confused. The code pandoc produces already contains \centering, which should center the graphic.
Did it not do this?

> On Oct 18, 2022, at 3:17 AM, Niko <ni...-k13cyrtlpCBBDLzU/O5InQ@public.gmane.org> wrote:
>
> Hi all,
>
> I am trying to center figures on pdf. The main.md has:
>
> ![some text](some-figure.png){width=166% #fig:figlabel}
>
> The created .tex file has
>
> \begin{figure}
> \hypertarget{fig:figlabel}{%
> \centering
> \includegraphics[width=1.66\textwidth,height=\textheight]{some-figure.png}
> \caption{some text}\label{fig:figlabel}
> }
> \end{figure}
>
> I read from here that a possible solution is to use
>
> \usepackage[export]{adjustbox}[2011/08/13]
>
> in latex preamble and add "center" argument to includegraphics, like so:
>
> \includegraphics[width=1.66\textwidth,height=\textheight, center]{some-figure.png}
>
> I tested it and it works. Now, how would one add arguments to includegraphics from within markdown? Another solution I came up with would include redefining includegraphics in latex preamble to always have the "center" added, but I feel that is a bit hacky. Is there a better way?
>
> Regards,
>
> Niko
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6268051b-bc26-4c5a-a1ba-32790dbc8271n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/92231fef-1dff-4799-b934-eaf85de4dec8n%40googlegroups.com.