A short hyphen in a math formula
Here are three suggestions. The first is my own, and the second and third are adapted from (http://www.logic.at/staff/salzer/etc/mhyphen/). Note that the first and second both output "math italic" text, but the third outputs "upright" text.
\documentclass{article}
\begin{document}
\newcommand\rnumber{\mathop{\mbox{$r$-$\mathit{number}$}}}
\[
\rnumber(5) = 120
\]
\end{document}
\documentclass{article}
\usepackage{amsmath}
\mathchardef\mhyphen="2D % Define a "math hyphen"
\begin{document}
\newcommand\rnumber{\mathop{r\mhyphen number}}
\[
\rnumber(5) = 120
\]
\end{document}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\newcommand\rnumber{\operatorname{r-number}}
\[
\rnumber(5) = 120
\]
\end{document}
LyX users should put the definitions (\usepackage
, \newcommand
, \mathchardef
, etc.) in Document -> Settings -> LaTeX Preamble, and the usage (e.g. \rnumber(5) = 120
) inside math-mode (Ctrl+M).
I think this is simpler.
$r{\text -}number(5)=120$
My first shot would be \DeclareMathOperator
; but it depends on the meaning of "r": if it represents a math variable it should be in italics. I'll show both possibilities, take your pick.
\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\rnumberA}{r-number}
\DeclareMathOperator{\rnumberB}{\mathnormal{r}-number}
\begin{document}
$\rnumberA(2)$
$\rnumberB(2)$
\end{document}