# Span figure across margin and textbody in twoside: Shift L/R based on odd/even page

This is a follow-up to Span figure across margin and textbody in twoside: Assigning savebox locally. But all necessary info should be here.

I am trying to make wide images/tables span across margin and text body in a twoside-document. I've got some help, but would like to assign a macro which deals with changing [l],[r] for odd or even pages, so that it fits correctly. Also, for odd pages, it need to add something like the commented line \hspace{-\marginandsep}.

\documentclass[11pt, twoside]{article}
\usepackage{xparse, graphicx, showframe}
\newlength\marginandtext
\newlength\marginandsep
\NewDocumentCommand{\fullwidth}{smo}{%
\makebox[\textwidth][l]{%
\begin{minipage}{\marginandtext}
%\hspace{-\marginandsep}%
#2%
\end{minipage}}}%
\begin{document}
foo\\
\begin{figure}[b]
\fullwidth{\includegraphics[width=\marginandtext, height=4cm]{example-image-a}}
\end{figure}
\clearpage
baz\\
\begin{figure}[t]
\fullwidth{\includegraphics[width=\marginandtext, height=4cm]{example-image-a}}
\end{figure}
\end{document}


By use of package of package changepage and help of package calc it is simple:

\documentclass[11pt, twoside]{article}
\usepackage{xparse} %not used in this MWE
\usepackage{graphicx, showframe}
% new packages
\usepackage{calc}
\usepackage[strict]{changepage}

\newlength\marginandtext
\setlength{\marginandtext}{\textwidth+\marginparwidth+\marginparsep}
\newlength\marginandsep
\setlength{\marginandsep}{\marginparwidth+\marginparsep}

\begin{document}
some text
\begin{figure}[b]
\includegraphics[width=\marginandtext, height=4cm]{example-image-a}
\end{figure}

\clearpage
\begin{figure}[t]

• Thank you Zarko, this is perfect. Guess I'll have to make myself familier with the changepage package. – Runar Jan 4 '16 at 14:46