2

I have seen the answers to How can I center text/math inside a list environment. The accepted solution there, however, does not allow me to reference displayed equations. Another solution given there is a "crude" solution, requiring me to insert a command in each displayed equation.

Is there a way to modify the accepted solution to the above question so that displayed equations can be labelled and then referenced? (My MWE is similar to that presented in answer to linked Q)

3

If you're comfortable with the macro-use in How can I center text/math inside a list environment?, then you could use

\def\NLine#1{\par\hspace*{-\leftmargin}\parbox{\textwidth}{\begin{equation}#1\end{equation}}}

This inserts the argument inside a numbered math display and allows referencing in the usual way.

enter image description here

\documentclass{article}
\usepackage{amsmath,bm}% http://ctan.org/pkg/{amsmath,bm}
\def\MLine#1{\par\hspace*{-\leftmargin}\parbox{\textwidth}{\[#1\]}}
\def\NLine#1{\par\hspace*{-\leftmargin}\parbox{\textwidth}{\begin{equation}#1\end{equation}}}
\begin{document}

\noindent\rule{\textwidth}{2pt}

\begin{itemize}
\item The quadratic formula 
  \MLine{x=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a}}
\item The freshman's dream
  \MLine{(a+b)^n=a^n+b^n}
\item The freshman's dream
  \NLine{(a+b)^n=a^n+b^n\label{xyz}}
\end{itemize}
See~\eqref{xyz}.

\[(a+b)^n=a^n+b^n\]

\end{document}

Perhaps a more intuitive definition might be

\makeatletter
\def\MLine{\par\hspace*{-\leftmargin}\@ifstar\MLineNoNum\MLineNum}
\def\MLineNoNum#1{\parbox{\textwidth}{\[#1\]}}
\def\MLineNum#1{\parbox{\textwidth}{\begin{equation}#1\end{equation}}}
\makeatother

that allows you to use \MLine for numbered equations and \MLine* for unnumbered ones (mirroring other numbered/unnumbered environments/macros).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.