1

I would like a command that takes two arguments, one a number and one an equation, and the command displays the equation (in displayed mode) and puts the number right justified centred on the equation. I want the position of the equation to be unaltered by the placing of the right justified number; so, if I just \begin{equation*}...\end{equation*} with the same equation it would put the equation in the exact same place, both horizontally and vertically. I have no clue where to start. Any suggestions would be appreciated. Thanks

  • 1
    Welcome to TeX.SE! I don't really understand where you want to have this extra number. Can you post a picture (hand-written or ascii-art) of what you want to achieve? – gernot Mar 9 '17 at 21:55
  • 4
    why are you using equation* (which is for un-numbered equations) if you want an equation number? – David Carlisle Mar 9 '17 at 22:02
  • @ gernot: I want the number vertically centred on the equation like an equation number, and right justified. So this equation would go exactly where it would go without my modification, but there would be a number to the right of it right justified. @ David: I don't want an equation number. I want a number of my choosing, and then I want it right justified, likely in square brackets. I see that everyone is attaching tex produced code, but I don't know how. I can look this up. But I hope my description makes sense. – Hammar Mar 9 '17 at 23:17
  • 1
    perhaps you are just looking for \tag{XXX} from amsmath – David Carlisle Mar 10 '17 at 0:08
  • read the documentation for amsmath (texdoc amsmath) and look for \tag. – barbara beeton Mar 10 '17 at 2:00
3

If I understand you correctly, you want \tag* as in the equation a=2.

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

zzz
\begin{equation}
  a= 1\tag{this}
\end{equation}

zzz
\begin{equation}
  a=2 \tag*{[this]}
\end{equation}

zzz
\begin{equation}
  a=3
\end{equation}

zzz
\begin{equation*}
  a=4
\end{equation*}

\end{document}
  • Yes! Simple and works! However..., is it possible to put this in a command that takes two arguments, one argument is the equation and the other argument is the \tag*? I can certainly live with the solution you provide, but I would prefer (for various complicated reasons) to have a command that does it with two arguments. – Hammar Mar 10 '17 at 11:13
  • Ok. Figured it out. \newenvironment{myenv}[1]{\begin{equation*}\tag*{[#1]}} – Hammar Mar 10 '17 at 12:05
  • Sorry, what I haven't figured out is how to comment properly. my code is \newenvironment{myenv}[1]{\begin{equation*}\tag{[#1]}}{\end{equation*}}. Interesting, if I put the \tag part of the code with the second argument of newenvironment it gives me an error. Sorry for making a mess of the comments here, I am just learning to comment. – Hammar Mar 10 '17 at 12:16
  • @Hamar yes of course the arguments to newcommand only declare #1 etc for the begin code not for the end code. that is a general feature of latex environments nothing to do with equation – David Carlisle Mar 10 '17 at 12:42
0

If I understand what you are asking for correctly you could try something like this...

reqno makes the numbering of the equations be on the right, and \newtagform{brackets}{[}{]} and \usetagform{brackets} make the square brackets.

Code:

\documentclass[reqno]{amsart}
\usepackage{mathtools}
\newtagform{brackets}{[}{]}
\newcommand\example[2]{\setcounter{equation}{#1}\addtocounter{equation}{-1}\begin{equation}\usetagform{brackets}#2\end{equation}\addtocounter{equation}{-#1}}
\begin{document}

\example{3}{y=mx+b}

\begin{equation*}
y=mx+b
\end{equation*}
\end{document}

Yields:

enter image description here

Note: this approach does make the numberings for all equations on the right.

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.