Math & Science ⇒ Number for in-line Equations
Number for in-line Equations
Hello. I would like to insert equations in regular text (so that it doesn't span separate lines) and continue the numbering scheme from 'equation' environments. Is it possible? I tried
$x^2=3 \tag$ which doesn't work.
By the way, is this the preferred way to do this? I also tried to just use 'equation' environment and insert text with \text{} but the problem is that the text is justified to the middle of the line, unlike other regular text in the document.
thanks
$x^2=3 \tag$ which doesn't work.
By the way, is this the preferred way to do this? I also tried to just use 'equation' environment and insert text with \text{} but the problem is that the text is justified to the middle of the line, unlike other regular text in the document.
thanks
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Number for in-line Equations
No.Willie wrote:[…] By the way, is this the preferred way to do this? […]
Please clarify with a proper minimal example what you are after.Willie wrote:[…] I also tried to just use 'equation' environment and insert text with \text{} but the problem is that the text is justified to the middle of the line, unlike other regular text in the document. […]
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Number for in-line Equations
example:
Code: Select all
\documentclass[a4paper,10pt,english]{article}
\begin{document}
This is my first numbered equation:
\begin{equation}
x^2=9
\end{equation}
Now I want the following equation: $x=5$ and also the following: $y=8$ to be numbered.
\end{document}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Number for in-line Equations
I was sure that this has been discussed here already. After a forum search I found something that might be useful [1]. Unfortunately the OP didn't respond in that topic. So it's not sure if the provided solution works as expected.
[1] View topic: Numbering in-line Equations
[1] View topic: Numbering in-line Equations
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Number for in-line Equations
Thanks for your reply. In the referred forum post the author assigns a new counter for the inline-text equations. However, I am looking to use the same number scheme in my text-inline equations (math enviroment) as in the equation enviroment.localghost wrote:I was sure that this has been discussed here already. After a forum search I found something that might be useful [1]. Unfortunately the OP didn't respond in that topic. So it's not sure if the provided solution works as expected.
[1] View topic: Numbering in-line Equations
i.e. in my example, if
\begin{equation}
x^2=9
\end{equation}
assigned the number (1), I want the $x=5$ to be number (2) and $y=8$ to be number (3).
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Number for in-line Equations
Then you have to use the given equation counter in the new command.
Code: Select all
\documentclass[11pt]{article}
\usepackage{amsmath}
\newcommand{\ilmath}[1]{%
\refstepcounter{equation}%
\(#1\)\enspace(\theequation)%
\ignorespacesafterend
}
\begin{document}
This is my first numbered equation:
\begin{equation}
x^2=9
\end{equation}
Now I want the following equation: \ilmath{x=5} and also the following: \ilmath{y=8} to be numbered.
\end{document}
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Number for in-line Equations
Thanks, it does work in that example. However, when I try it in my big document it produces errors. I would post a picture but I don't see an option here.localghost wrote:Then you have to use the given equation counter in the new command.Code: Select all
\documentclass[11pt]{article} \usepackage{amsmath} \newcommand{\ilmath}[1]{% \refstepcounter{equation}% \(#1\)\enspace(\theequation)% \ignorespacesafterend } \begin{document} This is my first numbered equation: \begin{equation} x^2=9 \end{equation} Now I want the following equation: \ilmath{x=5} and also the following: \ilmath{y=8} to be numbered. \end{document}
Also, is it possible to use \equation enviroment but have it aligned to the left, and not center-adjusted?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Number for in-line Equations
Then you have to reduce your document to a minimal example that still reproduces the error(s) and present it here.Willie wrote:[…] However, when I try it in my big document it produces errors. […]
Pictures can simply be attached by upload to the forum server while composing a message. But a picture is not as informative as code which can be tested (see above).Willie wrote:[…] I would post a picture but I don't see an option here. […]
Set the »fleqn« option for the document class and modify the length \mathindent accordingly.Willie wrote:[…] Also, is it possible to use \equation environment but have it aligned to the left, and not center-adjusted?
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Number for in-line Equations
About the code - I may look for producing a shorter version later, but it's long, and it will take time. anyway I think the error message will help, but I can't find how to attach a picture fle. I see only [img]tag which is for URL.
I know about the option of fleqn, but I want to do this only for one equation, not for all of them.
I know about the option of fleqn, but I want to do this only for one equation, not for all of them.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Number for in-line Equations
You've got all the time in the world.Willie wrote:About the code - I may look for producing a shorter version later, but it's long, and it will take time. […]
Right beneath the input window while composing a message you will find a tab "Upload attachment". The rest should be self-explanatory. But I think that regarding error messages attaching the corresponding log file is much better. Nevertheless it's best to have a minimal example.Willie wrote:[…] anyway I think the error message will help, but I can't find how to attach a picture fle. I see only [img]tag which is for URL. […]
Search the amsmath manual for the flalign environment. Useful information can also be found in the »Math mode« document.Willie wrote:[…] I know about the option of fleqn, but I want to do this only for one equation, not for all of them.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10