If you want an underscore, you must write it in text mode as \_
. You also need to select a text font that supports Greek letters, such as New Computer Modern Mono or CMU Typewriter Text.
To use \alpha
in text mode, you can load \usepackage{alphabeta}
. You can also get \textalpha
from \usepackage{alphabeta}
or \usepackage{textgreek}
.
\documentclass{article}
\tracinglostchars=2
\usepackage[default]{fontsetup} % Sets the text and math fonts to New Computer Modern Book.
\usepackage{alphabeta} % Allows \alpha, etc. in text mode.
\newcommand\param[1]{\textnormal{\ttfamily #1}}
\begin{document}
\( \param{\alpha\_0} \, \param{\beta\_1} \, \param{\phi\_1}
\)
\end{document}

An alternative is to use the \mathtt
alphabet.
If you want the underscores to be subscripts, you can do this:
\documentclass{article}
\tracinglostchars=2
\usepackage[default]{fontsetup} % Sets the text and math fonts to New Computer Modern Book.
\newcommand\param[1]{\mathtt{#1}}
\begin{document}
\( \param{\mupalpha_0} \, \param{\mupbeta_1} \, \param{\mupvarphi_1}
\)
\end{document}

The correct symbol names to use are from this manual, but loading \usepackage{textgreek}
and using \textalpha
, etc. in math mode will work too.
For \mathtt
to work in 8-bit legacy PDFTeX, you would need to find (or create) a typewriter font in OML encoding and load it with isomath
. That is the only legacy TeX encoding that supports both the Greek and Latin alphabets. If you’ve loaded an 8-bit LGR font and can write \textnormal{\ttfamily\selectfont\alpha}
or \textnormal{\ttfamily\selectfont\textalpha}
in text mode, the same command will work in math mode as well.
\_
instead.alpha
written like this or you want the Greek letter? The question is a bit unclear.alpha_0
.