Math & Science ⇒ How to mix text with math
-
- Posts: 17
- Joined: Fri Sep 24, 2010 8:50 pm
How to mix text with math
Sorry but I'm new to Latex and self taught from The Latex Companion.
I now understand how to mix math within text but I don't know how to mix text within math. For example, if I want to add text within a \begin{equation} . . .\end{equation}. It would help if I could turn off the line feed following the \end{equation} or if I could overprint.
I have seen a \begin{overprint} . . \end{overprint} on the web but I don't know what package to add.
Thanks, Clark
I now understand how to mix math within text but I don't know how to mix text within math. For example, if I want to add text within a \begin{equation} . . .\end{equation}. It would help if I could turn off the line feed following the \end{equation} or if I could overprint.
I have seen a \begin{overprint} . . \end{overprint} on the web but I don't know what package to add.
Thanks, Clark
Last edited by mikkelstuff on Thu Oct 14, 2010 4:31 pm, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

How to mix text with math
The amsmath package adds a command \text{..} which can be used inside a math environment (like \begin{equation} ... \end{equation}) to put a portion in text mode. (If all you need are upright characters, builtins like \mathrm{...} or \textup{...} might suffice too.) Is that the kind of thing you are looking for?
I'm afraid I don't really understand what you have in mind by this:
The only overprint environment I know of comes from the beamer document class, but I'm not sure it's what you have in mind. I don't think it has much to do (in particular) with mixing math and text. (Instead it has to do with making sure that a certain portion of a presentation slide takes up the same amount of room even if it changes from one overlay to another.)
I'm afraid I don't really understand what you have in mind by this:
Could you be more specific by what you have in mind here?mikkelstuff wrote:
It would help if I could turn off the line feed following the \end{equation} or if I could overprint.
I have seen a \begin{overprint} . . \end{overprint} on the web but I don't know what package to add.
The only overprint environment I know of comes from the beamer document class, but I'm not sure it's what you have in mind. I don't think it has much to do (in particular) with mixing math and text. (Instead it has to do with making sure that a certain portion of a presentation slide takes up the same amount of room even if it changes from one overlay to another.)
-
- Posts: 17
- Joined: Fri Sep 24, 2010 8:50 pm
Re: How to mix text with math
\text{...} is helpful but all, equation and text, are centered on the line.
Is there any position control I can use with this? For the most part, all I want to do is center an equation with \begin{equation} . . .\end{equation} and add either a comma or period spaced off to the right for good English composition.
Thanks
Is there any position control I can use with this? For the most part, all I want to do is center an equation with \begin{equation} . . .\end{equation} and add either a comma or period spaced off to the right for good English composition.
Thanks
How to mix text with math
But that would look odd. It is customary to place the punctuation signs right after the formulae, as in the following example:mikkelstuff wrote:...For the most part, all I want to do is center an equation with \begin{equation} . . .\end{equation} and add either a comma or period spaced off to the right for good English composition.
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
A = \bigl\{\, \{a_i\}_{i\in I} \mid a_i = 0, \text{ for all but a finite number of } i\in I \,\bigl\}.
\end{equation*}
\begin{align}
\psi_{1}(\theta) &= \dfrac{m-1}{p}\psi(\theta), \\
\psi_{2}(\theta) &= \dfrac{p-m+1}{p}\psi(\theta).
\end{align}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 17
- Joined: Fri Sep 24, 2010 8:50 pm
Re: How to mix text with math
Well I suppose it's a matter of taste.
Now suppose I want to add a parenthetical remark after an equation and on the same line but with only the equation centered. Seems like I should have control of the text separately from the equation.
Now suppose I want to add a parenthetical remark after an equation and on the same line but with only the equation centered. Seems like I should have control of the text separately from the equation.
How to mix text with math
In that case, you can do something like this:mikkelstuff wrote:...Now suppose I want to add a parenthetical remark after an equation and on the same line but with only the equation centered. Seems like I should have control of the text separately from the equation.
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
a &= b+c. && \text{(by Axiom 3.)}
\end{align}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
How to mix text with math
If you don't want the text put afterwards to affect the horizontal spacing/centering of the math stuff, you might be interested in this old thread, where we discussed the issue.
But I have to agree that if it's just a period or comma, it would indeed be very strange not to put it immediately right after the end of the equation or formula.
But I have to agree that if it's just a period or comma, it would indeed be very strange not to put it immediately right after the end of the equation or formula.
-
- Posts: 17
- Joined: Fri Sep 24, 2010 8:50 pm
Re: How to mix text with math
Thanks frabjous. I've been looking for something like this.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to mix text with math
Now that the problem is solved, please be so kind and mark the topic (not the last post) accordingly as clearly written in Section 3 of the Board Rules (to be read before posting). Please keep that in mind for the future so that a reminder will not be needed any more.
Best regards
Thorsten
Best regards
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