0

I am attempting to center two subfigures relative to the page. However due to \setlength\oddsidemargin{15mm}, the figures are slightly shifted to the right. I have uploaded the current output in the first output below. The second figure is the output I wanted. Thank you for your help. Current output

Wanted output

1 Answers1

0

Since floats may not appear on the same page they are created on, I used the ifoddpage package. It may take two runs to get the left margin correct.

Note: your desired image showed the caption in the text area, but it would also go into the \fullwidth field. You can also use \centering etc. inside.

\documentclass{book}
\usepackage{graphicx}
\usepackage{ifoddpage}
\usepackage{lipsum}% MWE only

\newcommand{\fullwidth}[1]% #1 = text for full width
{\bgroup% for local \dimen0
  \checkoddpage
  \ifoddpage \dimen0=\oddsidemargin
  \else \dimen0=\evensidemargin
  \fi
  \advance\dimen0 by 1in
  \parskip=0pt% overkill
  \par\noindent\rlap{\hskip-\dimen0\parbox{\paperwidth}{#1}}\par
\egroup}

\begin{document}
\begin{figure}
\fullwidth{%
  \includegraphics[width=0.45\paperwidth]{example-image-a}\hfill
  \includegraphics[width=0.45\paperwidth]{example-image-b}}
\caption{\LipsumPar{1}}
\end{figure}

\lipsum[1-5]
\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120