2

If I have a (centered) formula/equation (in my example A+B=C) in align. How can I name this formula? I want the text to be on the right side. I know that hfill doesn't work.

\begin{align*}
    A+B=C     \hfill  \text{name of the formula}     
\end{align*}


 \begin{itemize}
 \item[$(1)$] ......
 \begin{align*}
 \tag{Not Centered}
  A+B=C
 \end{align*}
 \item[$(2)$] ....
 \end{itemize}
  • \tag{name of the formula} – Sigur Jul 11 '14 at 1:03
  • But then the formula is not correctly centered. – user144921 Jul 11 '14 at 1:07
  • Using amsmath package do \[ A+B=C \eqno{\text{name of the formula}} \]. – Sigur Jul 11 '14 at 1:21
  • 1
    I don't understand what is the behavior you want if you use the itemize environment. – skpblack Jul 11 '14 at 2:39
1

Naming a formula is best achieved using \tag{<stuff>} (or the starred version which removes the surrounding parentheses). For centering an equation with regards to the text block when inside a list, you need to remove the left margin inserted by the list (\@totalleftmargin). Note that this margin is increased the deeper you nest lists.

Below I display the use of the latter using \displayinlistundent to insert a space to center the equation. Place this at the end of the equation:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\displayinlistundent}{\hspace{\@totalleftmargin}}
\makeatother
\begin{document}

\begin{align}
  A + B = C
\end{align}

\begin{enumerate}
  \item A regular \verb|align|:
  \begin{align}
    A + B = C
  \end{align}

  \item A centred \verb|align|:
  \begin{align}
    A + B = C \displayinlistundent
  \end{align}

  \item A nested list
  \begin{enumerate}
    \item A regular \verb|align|:
    \begin{align}
      A + B = C
    \end{align}

    \item A centred \verb|align|:
    \begin{align}
      A + B = C \displayinlistundent \tag{Very important}
    \end{align}

    \item A nested list
    \begin{enumerate}
      \item A regular \verb|align|:
      \begin{align}
        A + B = C \tag{My equation}
      \end{align}

      \makeatletter
      \item A centred \verb|align|:
      \begin{align}
        A + B = C \displayinlistundent
      \end{align}
      \makeatother
    \end{enumerate}
  \end{enumerate}
\end{enumerate}

\end{document}

If you wish to use \tag*, you need to insert it using \tag*{\llap{<stuff>}} if you want things to remain centred:

\item A centred \verb|align|:
\begin{align}
  A + B = C \displayinlistundent \tag*{\llap{Very important}}
\end{align}
  • whether the left margin of display math is adjusted within lists depends on the document class. the ams classes, for example, don't adjust; they always center on the whole line. this is a publisher house style decision. – barbara beeton Jul 11 '14 at 12:24
1

Not very sure what you are asking. But here is a try,

\documentclass{article}
\usepackage{kantlipsum}
\usepackage{amsmath}
\begin{document}
\kant[1]
\begin{align*}
  \tag{Not Centered}
  y = 3x
\end{align*}
\begin{center}
\begin{align*}
  \tag{Centered}
  y = 3x
\end{align*}

\end{center}
\end{document} 

enter image description here

  • Thank you, this is what I needed. But why doen't work this in the case of using align in itemize? I added an example. – user144921 Jul 11 '14 at 1:33
  • This don't works if the name is very large. For example \tag{This a larger name} doesn't center the formula. – skpblack Jul 11 '14 at 1:33
  • Hm, I see it. That's a problem. – user144921 Jul 11 '14 at 1:35
  • And it makes problems in combination with itemize... – user144921 Jul 11 '14 at 1:35
0

I thought of the following to resolve the problem:

  • Create a new command \rtag that redefines \tag for right alignment with

    \newcommand*{\rtag}[1]{\tag*{\makebox[0pt][r]{(#1)}}} 
    
  • Use \rtag instead of \tag.

This doesn't affect the alignment of the formula but if the formula or its name are very long, there is a danger of overlapping.

Here the code

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}
\newcommand*{\rtag}[1]{\tag*{\makebox[0pt][r]{(#1)}}}
\begin{document}
\lipsum[4]
\begin{align*}
  \rtag{This a name larger than normal}
  y = 3x
\end{align*}
\begin{center}
\begin{align*}
  \rtag{Centered}
  y = 3x
\end{align*}
\end{center}
\end{document} 
  • Do you need to encase the second align* environment in a center environment? – Mico Jul 11 '14 at 5:53
  • @Mico i don't think so, the center environment can be omitted. – skpblack Jul 23 '14 at 14:18
  • In other words, the center environment should be omitted, right? :-) – Mico Jul 23 '14 at 16:12

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.