5

I have an equation that is slightly wider than the width of my document. I want to center the equation, but do not want to change the geometry of my document. I have tried the method mentioned in this question: Center figure that is wider than \textwidth. However, it does not apply to equation environment. How can I center the equation? enter image description here

The above picture is generated by my MWE, which is shown as follows:

\documentclass[a4paper, 10pt]{article}

\usepackage{amsmath}           
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}

\begin{document}

This is an equation:
\begin{align}
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_1}}  \\
Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(\mathrm{TC}_k^{\mathrm{up}}-\mathrm{TC}_k^{\mathrm{lo}}\right) \\
T_m^{\mathrm{ed}} \geq \mathrm{TC}_k^{\mathrm{up}} 
\end{gathered}
\right]          \vee
%
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_2}}  \\
Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(T_m^{\mathrm{ed}} - \mathrm{TC}_k^{\mathrm{lo}}\right) \\
\mathrm{TC}_k^{\mathrm{lo}} \leq T_m^{\mathrm{ed}} \leq \mathrm{TC}_k^{\mathrm{up}} 
\end{gathered}
\right]          \vee
%
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_3}}    \\
Q_{m,k}^{\mathrm{ws}} = 0  \\
T_m^{\mathrm{ed}} \leq \mathrm{TC}_k^{\mathrm{lo}} 
\end{gathered}
\right]          &  \quad \forall m, \; \forall k \in \mathrm{WM}
\end{align}

\end{document}
Nick
  • 761
  • One method may be placing \forall m, \; \forall k \in \mathrm{WM} on the next word line. This can be done by saying "....for all $m$ and $k \in \mathrm{WM}$. – Leucippus Aug 09 '15 at 15:18
  • @Leucippus m and k belong to this equation. If I put them on the next world line, it may cause confusion since there are more than 60 equations in my paper. there are 5 equations that are slightly wider than textwidth. – Nick Aug 09 '15 at 15:24
  • did you try cmhughes's answer using changepage package in link? – touhami Aug 09 '15 at 15:25
  • @Nick maybe you could try changing the sizefont for that equation ... – juanuni Aug 09 '15 at 15:26
  • @touhami Yes, I just added changepage package in my .tex. But it changes nothing, still the same output format. – Nick Aug 09 '15 at 15:28
  • you can't just add the package you need to use widepage environment or something like that please read the full answer – touhami Aug 09 '15 at 15:32
  • As an aside, \forall is supposed to go before, not after, the statement to which it applies. – JPi Aug 10 '15 at 13:16

3 Answers3

11

this equation is really not wider than the page, but it is wide enough that there isn't enough space to put the equation number on the same line if the equation is considered as a rectangular box.

however, since there is a gap at the bottom, and the equation number has been moved automatically out of the "usual" location, you can take advantage of the amsmath feature \raisetag:

\documentclass[a4paper, 10pt]{article}

\usepackage{amsmath}           
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}

\begin{document}

This is an equation:
\begin{align}
\raisetag{1\baselineskip}
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_1}}  \\
Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(\mathrm{TC}_k^{\mathrm{up}}-\mathrm{TC}_k^{\mathrm{lo}}\right) \\
T_m^{\mathrm{ed}} \geq \mathrm{TC}_k^{\mathrm{up}} 
\end{gathered}
\right]          \vee
%
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_2}}  \\
Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(T_m^{\mathrm{ed}} - \mathrm{TC}_k^{\mathrm{lo}}\right) \\
\mathrm{TC}_k^{\mathrm{lo}} \leq T_m^{\mathrm{ed}} \leq \mathrm{TC}_k^{\mathrm{up}} 
\end{gathered}
\right]          \vee
%
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_3}}    \\
Q_{m,k}^{\mathrm{ws}} = 0  \\
T_m^{\mathrm{ed}} \leq \mathrm{TC}_k^{\mathrm{lo}} 
\end{gathered}
\right]          &  \quad \forall m, \; \forall k \in \mathrm{WM}
\end{align}

\end{document}

enter image description here

full documentation is in the amsmath user's guide: texdoc amsmath.

edit: an alternate method of dealing with this wide equation is to artificially shift it left, making latex think it's narrower than it really is. there's only a limited amount of space available for this before the result starts to project into the left margin, which is not desirable. here is the result from replacing the command

\raisetag{1\baselineskip}

in the above code by

\mspace{-30mu}

(and adding some text following the example to show where the left margin is located):

enter image description here

  • I got your idea. It will make (1) much closer to WM. But is there any possibility that (1) could be put just after WM without changing page geometry? – Nick Aug 09 '15 at 15:49
  • 1
    the only other approach i can think of is to make the equation stick out beyond the left margin. to do that, insert \mkern-30mu just before the first \left[; i think that's enough negative skip, but it may need more. if you prefer that approach, i'll add an example to the answer. – barbara beeton Aug 09 '15 at 15:53
  • Yes, could you show me how to achieve that? Thanks. – Nick Aug 10 '15 at 01:58
  • To barbara: I insert \mspace{-30mu} before the first \left[, and the problem is solved. – Nick Aug 10 '15 at 04:18
2

The other answer has a higher generality, but for this specific example you could also go the trivial way and make the equation less wide. Here, it suffices (at least on my system) to change the two really wide elements marginally to

Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(\mathrm{TC}_k^{\mathrm{up}}{-}\mathrm{TC}_k^{\mathrm{lo}}\right) \\

and

Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(T_m^{\mathrm{ed}} {-} \mathrm{TC}_k^{\mathrm{lo}}\right) \\

respectively. (I.e. putting curly braces around the - which changes the spacing around it as it no longer is handled as a binary operator (at least thats the explanation i remember), you could do the same with the = or any operator/relation symbol that comes with spacing (say the \vee))

alternate version

As I said before: this is not suited for a general approach and, also, it will directly lead to wrong, inconsistent spacing, but sometimes you have to take such measures.

Bort
  • 492
2

A very simple solution here is to replace the gathered environments with bmatrix. In addition, all brackets will have the same height here.We can make the same interrow spacing as in gathered by adjustingarraystretch`:

\documentclass[a4paper, 10pt]{article}

\usepackage{amsmath}           
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}

\begin{document}

This is an equation:
\begin{align}
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_1}}  \\
Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(\mathrm{TC}_k^{\mathrm{up}}-\mathrm{TC}_k^{\mathrm{lo}}\right) \\
T_m^{\mathrm{ed}} \geq \mathrm{TC}_k^{\mathrm{up}} 
\end{gathered}
\right]          \vee
%
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_2}}  \\
Q_{m,k}^{\mathrm{ws}} = \mathrm{cp} Fw_m \left(T_m^{\mathrm{ed}} - \mathrm{TC}_k^{\mathrm{lo}}\right) \\
\mathrm{TC}_k^{\mathrm{lo}} \leq T_m^{\mathrm{ed}} \leq \mathrm{TC}_k^{\mathrm{up}} 
\end{gathered}
\right]          \vee
%
\left[
\begin{gathered}
Y_{m,k}^{\mathrm{ws_3}}    \\
Q_{m,k}^{\mathrm{ws}} = 0  \\
T_m^{\mathrm{ed}} \leq \mathrm{TC}_k^{\mathrm{lo}} 
\end{gathered}
\right]          &  \quad \forall m, \; \forall k \in \mathrm{WM}
\end{align}

\end{document}

enter image description here

Bernard
  • 271,350