7

I'm trying to put equation numbers next to text as if said text was an equation. If I use \text{} in an align* environment, it typesets the text right-aligned and the whole environment centered, but that's not what I want. I would like the text to look like in an itemize or enumerate environment (for example, indented), but still with an equation number behind it. And that equation number should come from the regular equation number "pool".

Ideally, it would look like this:

We have to make sure that:
  A is very b,             (1)
  A is not c.              (2)

How can I write this in LaTeX?

cxxl
  • 1,183

3 Answers3

8

Here's one way (taken some code from Input manually a number into \eqref):

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/
\makeatletter
\newcommand{\eqnum}{\refstepcounter{equation}\textup{\tagform@{\theequation}}}
\makeatother
\begin{document}
\begin{equation}
  f(x) = ax^2 + bx + c \label{myeqn1}
\end{equation}
See~\eqref{myeqn1}. Also
\begin{itemize}
  \item $A$ is very~$b$, \eqnum\label{myeqn2}
  \item $A$ is not~$c$. \eqnum\label{myeqn3}
\end{itemize}
There is also~\eqref{myeqn2} and~\eqref{myeqn3}.
\end{document}

The above MWE provides \eqnum which inserts the equation number using the amsmath \eqref way. A subsequent \label makes one able to reference it. Of course, the print-and\label technique could be combined, if needed:

\makeatletter
\newcommand{\eqlab}[1]{\refstepcounter{equation}\label{#1}\textup{\tagform@{\theequation}}}
\makeatother

which allows one to use \eqlab{<label>}.

For flushed-right equation numbering, use the following definition:

\newcommand{\eqnum}{\leavevmode\hfill\refstepcounter{equation}\textup{\tagform@{\theequation}}}
Werner
  • 603,163
6

This may be a little hack-ish …

Code

\documentclass{article}
\makeatletter
\newenvironment{equationate}{%
 \itemize
 \let\orig@item\item
 \def\item{\orig@item[]\refstepcounter{equation}\def\item{\hfill(\theequation)\orig@item[]\refstepcounter{equation}}}
}{%
 \hfill(\theequation)%
 \enditemize
}
\makeatother
\begin{document}
We have to make sure that:
\begin{equationate}
 \item A is very b,
 \item A is not c.
\end{equationate}
Lorem Ipsum
\end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821
2

Try this code:

\documentclass[12pt,a4paper]{book}
\usepackage{amsmath}

\begin{document} We have to make sure that: \begin{equation} \text{A is very b,} \end{equation} \begin{equation} \text{A is not c.} \end{equation}

\end{document}

Output:

enter image description here