GeneralMath Mode Question

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
kurttodoroff
Posts: 27
Joined: Thu Feb 07, 2019 4:25 pm

Math Mode Question

Post by kurttodoroff »

I have created a few dozen macros, three of which I show here, for example.

\newcommand{\alphaactual}{$\alpha_\text{actual}$\index{a@$\alpha_\text{actual}$ (Actual Zero Sight Line Angle-Of-Attack)}}
\newcommand{\alphai}{$\alpha_\text{i}$\index{a@$\alpha_\text{i}$ (Zero Sight Line Angle-Of-Attack At Rollout)}}
\newcommand{\alphar}{$\alpha_\text{r}$\index{a@$\alpha_\text{r}$ (Zero Sight Line Angle-Of-Attack At Release)}}

From time to time, I place one of these macros inside of math mode. The following is one example of this:

$frac{\alphar}{17.45}$

Clearly, this causes an error, since it is equivalent to:

$\frac{ $\alpha_\text{r}$ }{17.45}$

I prefer to retain the opening and closing dollar signs, within the macro definition, to eliminate the need to type the dollar signs in paragraph mode.

Is there a method to persuade LaTeX to accept $frac{\alphar}{17.45}$?

Thank you.

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Math Mode Question

Post by Stefan Kottwitz »

Hi Kurt,

you could use the \ensuremath command for your macros: latex2e.org/_005censuremath.html

Stefan
LaTeX.org admin
kurttodoroff
Posts: 27
Joined: Thu Feb 07, 2019 4:25 pm

Math Mode Question

Post by kurttodoroff »

Hi, Stefan.

Thank you for the elegant solution.

Regards,

Kurt
Post Reply