3

EDIT: I ended up using the method outlined here and was able to resolve the problem. Big thanks to the answerer of that question!

I am using LyX, and am trying to center two images next to each other. They are both positioned in a float right now, each in their own box minipage. I have used the paragraph settings to center the float, the images inside, as well as the boxes, but for some reason their position is still shifted to the right (see screenshot). Any idea how to fix this?

This is what I see in the code prevew pane:

\begin{center}
\begin{figure}[H]
\centering{}%
\begin{minipage}[t]{0.45\linewidth}%
\begin{center}
\includegraphics[width=0.42\paperwidth,height=0.45\textheight,keepaspectratio]{../Figures/Consumption}
\par\end{center}
\caption{Consumption}
%
\end{minipage}\hspace*{0.05\paperwidth}%
\begin{minipage}[t]{0.45\linewidth}%
\begin{center}
\includegraphics[width=0.42\paperwidth,height=0.45\textheight,keepaspectratio]{\string"../Figures/Agg Capital\string".jpg}
\par\end{center}
\caption{Aggregate Capital}
%
\end{minipage}
\end{figure}
\par\end{center}

1

cruijf
  • 41
  • Watching the LaTeX code (View > Code Preview Pane) – Fran Mar 15 '21 at 01:50
  • Added code to main post – cruijf Mar 15 '21 at 02:30
  • The width of the images should be the 100% of the \linewidth (the 100% of the 45% of the minipage), not relative to \paperwidth, and moreover, without fix height (and therefore, without keepaspectratio) . – Fran Mar 15 '21 at 03:13
  • That fixed this problem, but now the right image is a little below the left image. Any idea why? – cruijf Mar 15 '21 at 03:37
  • Using the same image for the two figures the problem disappear? In this case the images have not the same proportions or the graphs are cropped at different points. Otherwise, check the code ... – Fran Mar 15 '21 at 05:01

0 Answers0