0

Need to use a variable "n_" in mathmode, which returns error in case to be coded like $n_{ _}$

| improve this question | | | | |
  • Welcome to TeX.SX! Please always show a minimal but working example instead of only a code snippet and please always cite the exact error message you get. Without those information we need to speculate instead of being able to analyze the problem and show you a verified solution. – Schweinebacke Oct 14 '17 at 13:38
0

If you need the symbol _ you can use, e.g., \_ or an \underline with a proper white space argument:

\documentclass{article}

\begin{document}
$n\_$ vs. $n\underline{\enskip}$
\end{document}

enter image description here

| improve this answer | | | | |
1

IMHO, $n_-$ is most simple and sufficient.

| improve this answer | | | | |
0

You can use \mathunderscore or \text{$\mathunderscore$}: they are equivalent if the symbol is only used in text style and not in subscripts/superscripts. Take your pick.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\usvarA}[1]{#1\mathunderscore}
\newcommand{\usvarB}[1]{#1\text{$\mathunderscore$}}

\begin{document}

$\usvarA{n}$ and $X_{\usvarA{n}}$

$\usvarB{n}$ and $X_{\usvarB{n}}$

\end{document}

enter image description here

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.