Does anyone know how to put an equation tag in $$ line?

  • Thread starter guv
  • Start date
  • Tags
    solution
In summary: For reasons I stated in post #3:Thanks, I know the proper math mode works. There is a tool I am using that only supports the $ and $$ environment to render equations. That's where I need the right-aligned equation...In summary, the conversation discusses the issue of using the \$\$ math mode to write equations and the desire to have a right-aligned equation tag, which is not possible with that mode. Several solutions are proposed, including using the \tag and \tag* commands, as well as using the \begin{align} environment. The conversation also mentions a tool that only supports the \$ and \$$ environment for rendering equations.
  • #1
guv
123
22
This has bothered me for a while and I have not found a good solution, it's convenient to write math equations using the \$\$ on the fly and occasionally we want to put a tag for an equation. tag works for the equation environment but not for \$\$. For example I would like to have [1] displayed all the way on the right. Is there a way to do this? Thanks,

$$v = v_0 + a t [1]$$
 
Physics news on Phys.org
  • #2
Code:
\begin{align}
v&=v_0+at \\
s&=s_0+v_0t+\dfrac{1}{2}at^2
\end{align}
is a possibility, but the numbering is not an absolute one. It changes sometimes. I haven't figured out yet what the conditions are. F5 (refresh) sets it back to 1.

\begin{align}
v&=v_0+at \\
s&=s_0+v_0t+\dfrac{1}{2}at^2
\end{align}
 
  • Like
  • Informative
Likes pinball1970, Greg Bernhardt, berkeman and 2 others
  • #3
fresh_42 said:
Code:
\begin{align}
v=v_0+at
\end{align}
is a possibility, but the numbering is not an absolute one. It changes sometimes. I haven't figured out yet on which conditions.

\begin{align}
v=v_0+at
\end{align}
Thanks, I know the proper math mode works. There is a tool I am using that only supports the \$ and \$$ environment to render equations. That's where I need the right-aligned equation tag.
 
  • #4
guv said:
For example I would like to have [1] displayed all the way on the right.
Just to be clear, do you want your equation numbers to be displayed in brackets ##[1]## instead of in parentheses ##(1)##?
 
  • #5
You can use \tag to set the text to whatever you want. If you don't, the automatic counter is not reset and continues from one post to another. (The reason why it is set to ##3## in post #3 's quote.)
Code:
$$
\begin{equation}\tag{1}
v=v_0+at
\end{equation}
$$
Result:
$$
\begin{equation}\tag{1}
v=v_0+at
\end{equation}
$$
If you do not want the added parenthesis, use \tag*. You can then add your brackets.
Code:
$$
\begin{equation}\tag*{[1]}
v=v_0+at
\end{equation}
$$
Result:
$$
\begin{equation}\tag*{[1]}
v=v_0+at
\end{equation}
$$
 
  • Like
  • Informative
Likes dextercioby, Bandersnatch, DaveE and 3 others
  • #6
jack action said:
You can use \tag to set the text to whatever you want. If you don't, the automatic counter is not reset and continues from one post to another. (The reason why it is set to ##3## in post #3 's quote.)
Code:
$$
\begin{equation}\tag{1}
v=v_0+at
\end{equation}
$$
Result:
$$
\begin{equation}\tag{1}
v=v_0+at
\end{equation}
$$
If you do not want the added parenthesis, use \tag*. You can then add your brackets.
Code:
$$
\begin{equation}\tag*{[1]}
v=v_0+at
\end{equation}
$$
Result:
$$
\begin{equation}\tag*{[1]}
v=v_0+at
\end{equation}
$$
I'm always confused by the fact that 'align' automatically generates math mode and 'equation' does not.
 
  • #7
jack action said:
You can use \tag to set the text to whatever you want. If you don't, the automatic counter is not reset and continues from one post to another. (The reason why it is set to ##3## in post #3 's quote.)
Code:
$$
\begin{equation}\tag{1}
v=v_0+at
\end{equation}
$$
Result:
$$
\begin{equation}\tag{1}
v=v_0+at
\end{equation}
$$
If you do not want the added parenthesis, use \tag*. You can then add your brackets.
Code:
$$
\begin{equation}\tag*{[1]}
v=v_0+at
\end{equation}
$$
Result:
$$
\begin{equation}\tag*{[1]}
v=v_0+at
\end{equation}
$$
This would be a good addition to the LaTeX Guide.
 
  • Like
Likes berkeman
  • #8
I combined all that has been said here and finally got the ultimate equation alignment with manually set numbers for only the chosen lines:
\begin{align*}
\ddot{s}&=a_0\\
s&=s_0+v_0t+\dfrac{1}{2}at^2 \tag*{[17]} \\
v&=v_0+at \\[20pt]
a&=a_0 \tag{18}
\end{align*}

Code:
\begin{align*}
\ddot{s}&=a_0\\
s&=s_0+v_0t+\dfrac{1}{2}at^2 \tag*{[17]} \\
v&=v_0+at \\[20pt]
a&=a_0 \tag{18}
\end{align*}
 
Last edited:
  • Like
  • Love
Likes dextercioby, jack action and pinball1970
  • #9
fresh_42 said:
I combined all that has been said here and finally got the ultimate equation alignment with manually set numbers for only the chosen lines:
\begin{align*}
\ddot{s}&=a_0\\
s&=s_0+v_0t+\dfrac{1}{2}at^2 \tag*{[17]} \\
v&=v_0+at \\
a&=a_0 \tag{18}
\end{align*}

Code:
\begin{align*}
\ddot{s}&=a_0\\
s&=s_0+v_0t+\dfrac{1}{2}at^2 \tag*{[17]} \\
v&=v_0+at \\
a&=a_0 \tag{18}
\end{align*}
fresh_42 said:
I'm always confused by the fact that 'align' automatically generates math mode and 'equation' does not.
Sorry guys, again the problem is not with proper math environment like align etc. The problem is with \$ or \$$ math mode.
 
  • #10
guv said:
Sorry guys, again the problem is not with proper math environment like align etc. The problem is with \$ or \$$ math mode.
If you can type a formula like ##v=v_0+at## then why can't you type \begin{align}? However, we also solved your specific problem:
$$
v=v_0+at\tag*{[5]}
$$
came from
Code:
$$
v=v_0+at\tag*{[5]}
$$
 
  • #11
fresh_42 said:
I combined all that has been said here and finally got the ultimate equation alignment with manually set numbers for only the chosen lines:
\begin{align*}
\ddot{s}&=a_0\\
s&=s_0+v_0t+\dfrac{1}{2}at^2 \tag*{[17]} \\
v&=v_0+at \\
a&=a_0 \tag{18}
\end{align*}

Code:
\begin{align*}
\ddot{s}&=a_0\\
s&=s_0+v_0t+\dfrac{1}{2}at^2 \tag*{[17]} \\
v&=v_0+at \\
a&=a_0 \tag{18}
\end{align*}
fresh_42 said:
If you can type a formula like ##v=v_0+at## then why can't you type \begin{align}?
For reasons I stated in post #3:
Thanks, I know the proper math mode works. There is a tool I am using that only supports the $ and $$ environment to render equations. That's where I need the right-aligned equation tag.
 
  • #12
guv said:
For reasons I stated in post #3:
Thanks, I know the proper math mode works. There is a tool I am using that only supports the $ and $$ environment to render equations. That's where I need the right-aligned equation tag.
See my edit.
 
  • #13
guv said:
Thanks, I know the proper math mode works. There is a too
guv said:
Thanks, I know the proper math mode works. There is a tool I am using that only supports the \$ and \$$ environment to render equations. That's where I need the right-aligned equation tag.
fresh_42 said:
See my edit.

l I am using that only supports the \$ and \$$ environment to render equations. That's where I need the right-aligned equation tag.
Unfortunately I can't see your edit through reply, I am not sure if you are still using align there.
 
  • #14
$$
v=v_0+at\tag*{[71]}
$$
came from
Code:
$$
v=v_0+at\tag*{[71]}
$$
Inline tags here are ## so ##
v=v_0+at\tag{[5]}
## resulted from
Code:
##
v=v_0+at\tag*{[5]}
##
which means that the tag command does not work for inline equations, which makes sense.
 
  • Like
Likes guv
  • #15
fresh_42 said:
$$
v=v_0+at\tag*{[71]}
$$
came from
Code:
$$
v=v_0+at\tag*{[71]}
$$
Inline tags here are ## so ##
v=v_0+at\tag{[5]}
## resulted from
Code:
##
v=v_0+at\tag*{[5]}
##
hmm, just tried what you wrote in the tool, unfortunately it's not compiled correctly. It also didn't work on overleaf.

$$
v=v_0+at\tag*{[1]}
$$

I am guessing this is a pretty special thing about physics forums that coded around the \$\$ math mode. Thanks for your help though.
 
  • #16
guv said:
hmm, just tried what you wrote in the tool, unfortunately it's not compiled correctly. It also didn't work on overleaf.

$$
v=v_0+at\tag*{[1]}
$$

I am guessing this is a pretty special thing about physics forums that coded around the \$\$ math mode. Thanks for your help though.
In that case, you are left with quads.
 
  • #17
guv said:
There is a tool I am using
guv said:
just tried what you wrote in the tool
What tool is that?
 
  • #18
it's a tool using overleaf api, not public. Not working on overleaf is obviously the problem.
 
  • #19
First time use with overleaf, but it does work:

overleaf-test.png

But I had to specify \usepackage{amsmath}. It works with align and equation alike.

Without using additional packages, I achieve it with \hspace*{\fill} x= 2+y \hspace*{\fill} [1]:

overleaf-test-2.png

Edit: Actually you have to use \hspace*{\fill} $x= 2+y$ \hspace*{\fill} [1] to get it written as an equation. (In my example it is pure text.)
 
  • Like
Likes guv and fresh_42
Back
Top