Moving equations and aligns into outer margin

I have rather narrow text width, so sometimes I have to move floats to the outer margin. In case of drawings and tables I use command \widefloat defined below

\documentclass[11pt]{scrbook}
\usepackage{lipsum}

\newcommand{\widefloat}[1]{%
\ifthispageodd{\makebox[\textwidth][l]{#1}}{\makebox[\textwidth][r]{#1}}}

\begin{document}

\lipsum[1-3]

\begin{table}[h]
\widefloat{\begin{tabular}{lll}
really really really really really & large large large large large & table table table table table \\
really really really really really & large large large large large & table table table table table \\
\end{tabular}}
\end{table}

$\frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y}\\$

\lipsum[1-3]

\begin{table}[h]
\widefloat{\begin{tabular}{lll}
really really really really really & large large large large large & table table table table table \\
really really really really really & large large large large large & table table table table table \\
\end{tabular}}
\end{table}

$\frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y}\\$

\lipsum[1]

\end{document}


However, when I try to apply it to \equation, I get errors and equation is transformed into inline-type of equation.

Is there any way to create a similar command for equations?

• Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs Oct 26 '13 at 20:05
• @Jubobs Better? :-) – Pygmalion Oct 26 '13 at 20:20
• Yes, much better :) – jub0bs Oct 26 '13 at 20:25

You can use the same method; but it would be much preferable to split long equations with the help of amsmath environments (split for aligning pieces, multline for the non aligned case).

\documentclass[11pt]{scrbook}
\usepackage{lipsum}

\newcommand{\wideeq}[1]{%
\ifthispageodd
{\makebox[\textwidth][l]{$\displaystyle#1$}}
{\makebox[\textwidth][r]{$\displaystyle#1$}}%
}

\begin{document}

\lipsum*[1]
$\wideeq{% \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} }$
\lipsum[2]
\clearpage
\lipsum*[1]
$\wideeq{% \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} }$
\lipsum[2]

\end{document}


Note that you should never leave a blank line before a displayed equation. This is why I used \lipsum* before the equation (it doesn't end the paragraph).

Using \\ inside $...$ is meaningless.

• The designer specified textwidth of only 120 mm and margin of 55mm, so it makes sense pushing wide equations, pictures and tables into margin, like in Tufte style. Wouldn't you agree? Unfortunately, your method isn't working with \align. Is something like that possible for \align too? – Pygmalion Oct 26 '13 at 21:21
• @Pygmalion With equation numbers? No way. – egreg Oct 26 '13 at 21:40
• I am sorry, I meant align*, no equation numbers. – Pygmalion Oct 26 '13 at 21:44
• @Pygmalion Use aligned inside \wideeq – egreg Oct 26 '13 at 21:47
• aligned within equation using the method above. Of course, stupid me. facepalm – Pygmalion Oct 26 '13 at 21:51

As an alternative you can use KOMA-Script's environment addmargin* to define an environment that additionally uses the margin note column in the outer margin. Such an environment can be used as container for tables, figures, equations etc.:

\documentclass[11pt]{scrbook}
\usepackage{lipsum}
\usepackage{showframe}% illustrate the text area, margin note column etc.

\newenvironment{wide}{%
}{%
}

\begin{document}

\lipsum*[1]
\begin{wide}
$\frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y}$
\end{wide}
\begin{table}[h]
\begin{wide}
\centering
\begin{tabular}{@{}lll@{}}
really really really really really & large large large large large & table table table table table \\
really really really really really & large large large large large & table table table table table \\
\end{tabular}
\end{wide}
\end{table}

\lipsum[2]
\clearpage
\lipsum*[1]
\begin{wide}
$\frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y} = \frac{x}{y}$
\end{wide}
\lipsum[2]

\end{document}


• Thanks for the elegant solution. Still one question. The difference between your and egreg's solution is that egreg's solution "aligns" wide equation/table toward the internal margin, thus taking as little outer marginal space as possible. In your case, wide equation/table is centred within body text + marginal space. Is it possible to modify your solution so it works like egreg's? – Pygmalion Jun 13 '17 at 9:09
• For equations this wouldn't be easy, because you would need an equation environment, that align equations left, and an equation environment, that align equations right. For tables etc. this would be easy using \ifthispagewasodd\raggedright\else\raggedleft\fi. – Schweinebacke Jun 21 '17 at 5:45