Centering an equation that's wider than \textwidth?

\noindent
\makebox[\textwidth]{\parbox{1.3\textwidth}{%
  \begin{align}
  y &= f(x)\\
  khdakshdkashdkajhsdkjahsdkh &= ksdjhf lksjdh fkjsdh fökjH SDÖKJFH ÖDFH öDFH 
  KSHDFKS
  \end{align}
}}

enter image description here

However, it makes more sense to split the formular in pieces.


I propose three other possible layouts, with mathtools and/or nccmath:

 \documentclass{article}
 \usepackage{mathtools, nccmath}
 \usepackage{lipsum}

\begin{document}
\lipsum[11]
\begin{fleqn}[-0.75em]
 \begin{equation}
 \begin{aligned}[b]
  &\hspace{0.67em} f(x) = \\
   & \frac{\Bigl(6x-x^2 + \cfrac{x^5}{20}-\dotsm\Bigr) +\Bigl(x^3-\cfrac{x^6}{2} + \cfrac{x^9}{3}-\dotsm\Bigr) + \Bigl(x^3-\cfrac{x^6}{2} + \cfrac{x^9}{3}-\dotsm\Bigr)-6x}%
 {\Bigl(x^3-\cfrac{2x^5}{3} + \cfrac{23x^7}{45}-\dotsm\Bigr)-x^3}
 \end{aligned}
 \end{equation}
 \end{fleqn}
\bigskip

      \begin{equation}
      f(x) = \mfrac{\Bigl(6x-x^2 + \cfrac{x^5}{20}-\dotsm\Bigr) +\Bigl(x^3-\cfrac{x^6}{2} + \cfrac{x^9}{3}-\dotsm\Bigr) + \Bigl(x^3-\cfrac{x^6}{2} + \cfrac{x^9}{3}-\dotsm\Bigr)-6x}%
      {\Bigl(x^3-\cfrac{2x^5}{3} + \cfrac{23x^7}{45}-\dotsm\Bigr)-x^3}
      \end{equation}
\bigskip

      \begin{equation}
      f(x) = \frac{\splitfrac{\Bigl(6x-x^2 + \cfrac{x^5}{20}-\dotsm\Bigr) +\Bigl(x^3-\cfrac{x^6}{2} + \cfrac{x^9}{3}-\dotsm\Bigr)} {+ \Bigl(x^3-\cfrac{x^6}{2} + \cfrac{x^9}{3}-\dotsm\Bigr)-6x}}%
      {\Bigl(x^3-\cfrac{2x^5}{3} + \cfrac{23x^7}{45}-\dotsm\Bigr)-x^3}
      \end{equation}

\end{document} 

enter image description here


Here is an another way to centre an equation that is too wide to fit within the text area. It is similar to the solution proposed by Skillmon in this comment, but it wraps your equation in a box whose width is exactly the maximal of the equation instead of one of width zero. This causes the equation number to be pushed to the next line, as desired.

\documentclass{article}

\usepackage{showframe} %% <- Makes the text margins visible
\usepackage{amsmath}

\begin{document}

\begin{equation}
    \makebox[\displaywidth]{$\displaystyle
      f(x) =
        \frac{
          \Bigl( 6x - x^2 + \dfrac{x^5}{20} - \dotsb \Bigr)
          + \Bigl( x^3 - \dfrac{x^6}{2} + \dfrac{x^9}{3} - \dotsb \Bigr)
          + \Bigl( x^3 - \dfrac{x^6}{2} + \dfrac{x^9}{3} - \dotsb \Bigr)
          - 6x
        }{
          \Bigl( x^3 - \dfrac{2x^5}{3} + \dfrac{23x^7}{45} - \dotsb \Bigr) - x^3
        }
    $}
\end{equation}

\end{document}

output

The code is probably mostly self-explanatory, but here is a short explanation anyway:

  • \makebox[<width>]{<content>} creates a box of width <width> that contains <content> (centred).
  • \displaywidth is the maximum width of the current display math environment.
  • $\displaystyle <equation>$ produces an equation set in display style (with large fractions, summation symbols etc.).

Alternative: reduce the amount of empty space in the equation

As an alternative to allowing your equations to stick out of the margins, I suggest reducing the amount of space between its constituents. This can be done as follows:

\documentclass{article}
\usepackage{showframe} %% <- Makes the text margins visible
\usepackage{amsmath}

\newcommand*\squeezespaces[1]{% %% <- #1 is a number between 0 and 1
  \thickmuskip=\scalemuskip{\thickmuskip}{#1}% %% <- around =, \rightarrow, etc.
  \medmuskip=\scalemuskip{\medmuskip}{#1}%     %% <- around +, \times, etc.
  \thinmuskip=\scalemuskip{\thinmuskip}{#1}%   %% <- around \sum, \sin, etc.
  \nulldelimiterspace=#1\nulldelimiterspace    %% <- around fractions
  \scriptspace=#1\scriptspace                  %% <- after sub-/superscripts
}
\newcommand*\scalemuskip[2]{% %% <- scales muskips, including stretch/shrink
  \muexpr #1*\numexpr\dimexpr#2pt\relax\relax/65536\relax
} %% <- based on  https://tex.stackexchange.com/a/198966/156366

\begin{document}

\begin{equation}
    \squeezespaces{.6}
    f(x) =
      \frac{
        \Bigl( 6x - x^2 + \dfrac{x^5}{20} - \dotsb \Bigr)
        + \Bigl( x^3 - \dfrac{x^6}{2} + \dfrac{x^9}{3} - \dotsb \Bigr)
        + \Bigl( x^3 - \dfrac{x^6}{2} + \dfrac{x^9}{3} - \dotsb \Bigr)
        - 6x
      }{
        \Bigl( x^3 - \dfrac{2x^5}{3} + \dfrac{23x^7}{45} - \dotsb \Bigr) - x^3
      }
\end{equation}

\end{document}

Squeezed to 60%

The three lengths \thickmuskip, \medmuskip and \thinmuskip determine the amount of space that is inserted between various types of math atoms (see this answer for a nice overview of when each is used). \nulldelimiterspace and \scriptspace are inserted around fractions and after sub-/superscripts respectively. I'm reducing each of them to 60% of their original values (within this equation only).

If you want the equation number to appear on the same line you can of course compress the equation even further. The following image was produced by replacing .6 by .45 in the previous document.

Squeezed to 45%