Math & ScienceText in formulas

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
kapowza
Posts: 19
Joined: Fri Jan 30, 2009 3:32 pm

Text in formulas

Post by kapowza »

Is there any way to put actual text inside a mathematical formula? I'm writing some review notes for my students, and I wanted to make a fraction expressing that probability was \frac{number of successful outcomes}{number of total outcomes}.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Text in formulas

Post by kaiserkarl13 »

The \mbox command works in many cases:

Code: Select all

\[ \frac{\mbox{number of successful outcomes}}{\mbox{number of total outcomes}} \]
However, this will produce text that's the same size as body text, which may or may not be what you want (especially if the text is used in a super- or subscript).

The amstext package (included automatically by the amsmath package) defines the \text command, which serves the same purpose but gets the sizing right:

Code: Select all

\usepackage{amstext}
\[ \frac{\text{number of successful outcomes}}{\text{number of total outcomes}} \]
Post Reply