# How to make temporarily center-aligned math equation, when using option [fleqn] for amsmath

I am using fleqn for amsmath. So the euqation is default left-aligned.

Now I want to teamporarily make one equation center-aligned. How to do this?

Thank you all.

MWE

\documentclass{article}
\usepackage{ragged2e}
\usepackage[fleqn]{amsmath}

\begin{document}
\section{left-align}
$$y = x$$

\section{center-align}
$$\centering y = x + x$$

\end{document}


This is what the ceqn environment, from nccmath is for. Conversely, it defines a fleqn environment for temporarily left-aligned groups of equations in the default context:

\documentclass{article}
\usepackage{ragged2e}
\usepackage[fleqn]{amsmath}
\usepackage{nccmath}

\begin{document}

\section{left-align}
$$y = x$$

\section{center-align}

\begin{ceqn}
$$\centering y = x + x$$
\end{ceqn}

\end{document}