Basic: How can I stop centering a text?
Note that the approach of
{\centering Text}
of the accepted answer will not work because there are not a blank line (=\par
) before of the closing brace. The same apply to\begingroup\centering ... \endgroup
Note also that the
center
environment add a noticeable vertical spacing before and after the caption (that could be or not what you want).For one line caption without additional space is enough a
\hfil
after the equation.If you left a blank line between a display math mode and
\hfil
, be aware that the text is centered taking into account the paragraph indentation.Alternatively to
\hfil
you can use also a\makebox
wide as to the line width, since its content is centered by default. Unnecessarily complicated to obtain the same, unless you want a wide\fbox
around the caption or so.
MWE (blank lines are converted to \par
to remark where they are.):
\documentclass{article}
\begin{document}
\[ a^2+b^2=c^2 \]
\hfil This is the Pythagorean Theorem.\par % works
\hfil This is the Pythagorean Theorem.\par % works if \parindent is 0pt
\begin{center}
This is the Pythagorean Theorem. % note the vertical spacing
\end{center}
{\centering This is the Pythagorean Theorem.}\par % oooooopps !
{\centering This is the Pythagorean Theorem.\par } % works
\noindent\makebox[\textwidth]{This is the Pythagorean Theorem.}\par % works too
\end{document}
Edit:
By the way, to use formula with captions I will make a new type of float or true captions without floats, MWE:
\documentclass{article}
\usepackage{amsmath,lipsum}
\usepackage{float}
\floatstyle{boxed}
\floatname{eq}{Equation}
\newfloat{eq}{H}{eqn}
\usepackage{caption}
\captionsetup[eq]{skip=20pt,position=top}
\begin{document}
\lipsum[2]
\begin{eq}
\[ a^2+b^2=c^2 \]
\caption{This is the Pythagorean Theorem.}
\end{eq}
\begin{eq}
\[\mathbf{F} = \frac{d \mathbf{p}}{dt} = \frac{d (m \mathbf{v})}{dt} = m \frac{d \mathbf{v}}{dt} = m\mathbf{a}\]
\caption{Newton's second law of motion}
\end{eq}
\lipsum*[13] Or maybe mora compact and simple fake floats:
\[ a^2+b^2=c^2 \]
\captionof{eq}{This is the Pythagorean Theorem.}
\[\mathbf{F} = \frac{d \mathbf{p}}{dt} = \frac{d (m \mathbf{v})}{dt} = m \frac{d \mathbf{v}}{dt} = m\mathbf{a}\]
\captionof{eq}{Newton's second law of motion}
\lipsum*[2]
\end{document}
Although really I prefer the classic numeration at right of formulas, without captions. ;)
Another possibility: use the gather
environment (a multiline, centred, maths environment), and put the ‘caption’ on the second line:
\documentclass{article}
\usepackage{amsmath, amssymb}
\begin{document}
\begin{gather}
a\not\equiv 0\mod p \implies a^{p-1}\equiv 1\mod p \\
\text{\small This is known as \emph{lil’Fermat}.}\notag
\end{gather}
\end{document}