I've seen similar threads with centering problems, but could not find the right solution to mine. I'm using the report
class (onesided).
I have a float figure (object width=1.3\textwidth
here, may change for other figures). By default it is flushed left and spills into the right margin. I want it to grow into both margins. The problem is my left margin is smaller than my right margin, so when I center it using e.g. \makebox
the left margin is filled too much.
I want the figure to expand unevenly, e.g. 2cm right for every 1cm left.
First I used \hspace{-0.1\textwidth}
to pull it into the left margin. My current solution is to adjust the margins (make them equal) with a changemargins
environment I found in another thread. Then the \makebox
or \centerfloat
solutions work fine.
But I'm not happy I have to hardcode numbers. So I thought if I could center it with respect to the page (A4) instead of the uneven margins, it would spill into the margins properly. Anyone know how to do this?
EDIT: Added MWE, see below
\documentclass[10pt,a4paper]{report}
\usepackage{blindtext}
\usepackage[demo]{graphicx}
\usepackage[bottom=1in,left=1.22in,right=1.63in]{geometry}
\begin{document}
\blindtext
%before
\begin{figure}[bht]
\includegraphics[width=1.4\textwidth,height=4cm]{myPictureName.png}
\end{figure}
%after margin centering
\begin{figure}[bht]
\noindent\makebox[\textwidth]{%
\includegraphics[width=1.4\textwidth,height=4cm]{myPictureName.png}
}%
\end{figure}
%desired output: equal whitespace both sides
\begin{figure}[bht]
\hspace{-0.2\textwidth}\hspace{0.2in}
\includegraphics[width=1.4\textwidth,height=4cm]{myPictureName.png}
\end{figure}
\end{document}
Best Answer
For one sided setting you just have to take account of
\oddsidemargin
and the default1in
offset: