[Tex/LaTex] Environment for text to run into margins

environmentsindentationmarginsmemoir

After posting this closed question, I found a good solution for memoir on this page.

However, my margins settings are different then the ones he uses, and as a result, the widematter environment only works correctly on odd-numbered pages; on even-numbered pages, the widematter has the text run off to the wrong side, and it even goes off the page. Is there an easy way to debug this?

UPDATE:

Using @daleif's suggestion, I have the following MWE:

    \documentclass[11pt,a4paper]{memoir}

\setstocksize{297mm}{210mm}
\settrimmedsize{\stockheight}{195mm}{*}
\settypeblocksize{671.6pt}{335.8pt}{*}
%\settypeblocksize{675pt}{337.5pt}{*}
%\settypeblocksize{*}{28pc}{2}
\setlrmargins{*}{*}{4}
\setulmargins{*}{*}{2}
\setmarginnotes{5mm}{45.23mm}{\onelineskip}
\setlength{\footskip}{3.0\baselineskip}
\setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+1.0\marginparwidth\relax}
\checkandfixthelayout

\newlength{\extrawidth}
\setlength{\extrawidth}{\marginparsep}
\addtolength{\extrawidth}{\marginparwidth}

\marginparmargin{outer}
\strictpagechecktrue
\newenvironment{widematter}{
\begin{adjustwidth*}{0mm}{-\extrawidth}
\mpjustification}
{\end{adjustwidth*}}

\begin{document}
Here is some regular text that goes all the way to the margin and wraps around on the next line.
\begin{widematter}
Here is a test of the widematter environment, to see if the text is able to extend beyond the margin.
\end{widematter}
\end{document}

But this still doesn't work for even-numbered pages–the widematter text extends into the right margin, when it should be extending into the left margin…

(Also, is there any way to insert a page break into this MWE so that I can demonstrate the extra width on even-numbered pages?)

ANOTHER UPDATE:

Using Marco Daniel's fullwidth package, I have the following MWE:

\documentclass[11pt,a4paper]{memoir}

\setstocksize{297mm}{210mm}
\settrimmedsize{\stockheight}{195mm}{*}
\settypeblocksize{671.6pt}{335.8pt}{*}
%\settypeblocksize{675pt}{337.5pt}{*}
%\settypeblocksize{*}{28pc}{2}
\setlrmargins{*}{*}{4}
\setulmargins{*}{*}{2}
\setmarginnotes{5mm}{45.23mm}{\onelineskip}
\setlength{\footskip}{3.0\baselineskip}
\setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+1.0\marginparwidth\relax}
\checkandfixthelayout

\usepackage[innermargin=-2.0cm,]{fullwidth}

\begin{document}

Testing some regular text that goes on past the first line, and then repeats.
Testing some regular text that goes on past the first line, and then repeats.
Testing some regular text that goes on past the first line, and then repeats.

\begin{fullwidth}[width=\linewidth+2cm]

Testing some regular text that goes on past the first line, and then repeats.
Testing some regular text that goes on past the first line, and then repeats.
Testing some regular text that goes on past the first line, and then repeats.

\end{fullwidth}

\end{document}

The first time it compiles, there are warnings about undefined references, but the fullwidth text extends past the margin on the right, which looks good. The second time it compiles, the warnings disappear, but now the text extends past the margin on the left (the wrong side)…

To clarify: for odd-numbered pages, the margin on the left represents necessary space for binding, whereas the margin on the right is just extra space (and visa-versa for even-numbered pages). With these settings, fullwidth is making the text extend into the binding margin, which is bad–I only want it to extend into the non-binding margin. I tried changing the code to have \usepackage[innermargin=0cm,]{fullwidth} and \begin{fullwidth}[width=\linewidth-2cm], but that only seems to work for odd-numbered pages–even-numbered pages still have fullwidth text go into the binding margin

Best Answer

I would just use

\marginparmargin{outer}
\strictpagechecktrue
\newenvironment{widematter}{
  \begin{adjustwidth*}{0mm}{-\extrawidth}
    \mpjustification
  }
  {\end{adjustwidth*}}

And yes, adjustwidth* is not intended for things that cross a two pages. It is a simple environment made via list, mostly indented to enable users to make a local area (on a page) larger or smaller.

And next time please post something that actually compile, we waste a lot of time trying to find our crystal balls and figure out that people actually mean and which packages they have forgotten to include.