# How to switch between two margin sizes?

This question led to a new package:
fullwidth

This is a followup to a similar question. The idea is to switch between two different margin sizes. The answer provided by @godbyk work very well. However, it is difficult if you are using an asymmetric page layout (e.g. \documentclass[twoside]{article} and the fullwidth environment spans over two pages. Is it possible to make it work in these cases, too?

The memoir manual states:

Note that the adjustwidth environment applies to complete paragraphs; you can’t change the width of part of a paragraph except for hanging paragraphs or more esoterically via \parshape. Further, if the adjusted paragraph crosses a page boundary the margin changes are constant; a paragraph that is, say, wider at the right on the first page will also be wider at the right as it continues onto the following page.

So, how to do it esoterically ;)

MWE:

\documentclass[twoside]{article}

% The following code should be used *after* any changes to the margins and
% page layout are made (e.g., after the geometry package has been loaded).
\newlength{\fullwidthlen}
\setlength{\fullwidthlen}{\marginparwidth}

\newenvironment{fullwidth}{%
}{%
}

\usepackage{lipsum}% provides dummy text

\begin{document}

\lipsum[1]

\begin{fullwidth}
\lipsum[2-10]
\end{fullwidth}

\lipsum[3]

\end{document}

-
Would you be able to elaborate a little more on what you mean by "an asymmetric design breaks on a new page"? –  Werner Nov 10 '11 at 16:33
@Andy I am not sure if I understand the question also. Could you post a sketch of what you are trying to achieve. Memoir when referring to esoteric mean for paragraphs only, i.e., you can make a sort of a shaped hole in a paragraph. –  Yiannis Lazarides Nov 10 '11 at 16:55
The OP is trying to adjust the left and right margins of a specific block using adjustwidth. The block of text should accommodate page breaking and be able to switch between adjusting for the left (\marginparwidth+\marginparsep) on even pages, but for the same amount on the right for odd pages. So, the adjustwidth environment should switch accordingly from one margin adjustment to another, depending on the current page. Am I correct @Andy? –  Werner Nov 10 '11 at 17:02
The problem is particularly highlighted if you add \begin{fullwidth} \lipsum[2-10] \end{fullwidth} after \lipsum[3]; perhaps the OP could do so. –  cmhughes Nov 10 '11 at 17:07
@werner, yes, you are correct. –  Andy Nov 10 '11 at 18:34
show 1 more comment

The new package fullwidth is uploaded to CTAN. The development status is available on github.

\setcounter{errorcontextlines}{999}
\documentclass[twoside]{article}
\usepackage{showframe,lipsum}
\usepackage[innermargin=-2.0cm,]{fullwidth}
\begin{document}
\lipsum

%\clearpage
\begin{fullwidth}[width=\linewidth+2cm]
Start\par
\lipsum[1] \lipsum \lipsum
ENDE
\end{fullwidth}
\end{document}


Are you looking for somethink like the following example?

\documentclass[twoside]{article}
%\usepackage{showframe}
\usepackage{mdframed}
\usepackage{lipsum}
\begin{document}

\lipsum[1]

\begin{mdframed}[outermargin=\dimexpr-\marginparwidth-\marginparsep\relax,innermargin=0pt]
\lipsum[2-10]
\end{mdframed}

\lipsum[3]
\end{document}

-
Yes, this looks very good. I guess, it would be easy to not show the frame, [hidealllines=true] shifts the box a little. Could you estimate how much of the 1000 lines in the package would be needed to achieve the behavior, without the options and other goodies you have in mdframes. –  Andy Nov 11 '11 at 6:20
@Andy: Based on my package I can create a new one which only sets the left/right or inner/outer margin. But not in the next five minutes ;-) –  Marco Daniel Nov 11 '11 at 8:33