4

I'm trying to use the 'newcommand' in the environment 'align', for that I created the 'newcommand' \rbel that is an 'arrow' with a 'n' below It. I put all the packages that I'm using.

     \documentclass[A4,12pt]{article}
        \usepackage{amsmath,amsfonts,amscd,amssymb,amsthm,amsbsy}
        \usepackage[english]{babel}
        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{graphicx}
        \usepackage{abraces}
        \usepackage{upgreek}
        \usepackage{mathrsfs}   
        \usepackage{dsfont}
        \usepackage[hang,small,labelfont=bf,up,textfont=it,up]{caption} 
        \usepackage{dsfont,float}
        \usepackage{color}
    \newcommand{\rbel}{
        \mbox{\;\rightarrow_{\hspace*{-0.3cm}{\small n}}\;~}
        }
    \begin{document}
    \begin{align}
   \theta_n>1, \quad 
\dfrac{1}{\theta_n^2} \rbel 0
    \end{align}
    \end{document}

That gives these messages

"Missing } inserted. \end{align}"
"Missing \cr inserted. \end{align}"
"Missing $ inserted. \end{align}"
"Extra }, or forgotten $. \end{align}"
  • 1
    Your \rbel-command contains an \mbox. Even in math-mode the content of \mboxes isn't in math-mode any more as \mboxes switch to text-mode... – Ulrich Diez Feb 9 at 16:18
  • 2
    For avoiding linebreaks in math-mode usually nesting things in curly-brace-groups is sufficient. I.e., just do without the \mbox: \newcommand{\rbel}{{\;\rightarrow_{\hspace*{-0.3cm}{\small n}}\;~}} – Ulrich Diez Feb 9 at 16:26
  • This is not causing your issue but with your preamble the dsfont package is loaded twice. – Ulrich Diez Feb 9 at 16:28
  • There is also \mathmbox from mathtools. – John Kormylo Feb 9 at 16:43
4

It seems you want an arrow with “n” underneath:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}

\newcommand{\rbel}{\xrightarrow[n]{}}

\begin{document}

\[
\theta_n>1, \quad \dfrac{1}{\theta_n^2} \rbel 0
\]

\end{document}

The error is because you're exiting from math mode when in \mbox.

I removed all the unnecessary package; please, take note that the option for A4 paper is called a4paper, not A4.

enter image description here

3

It works if the \mbox is replaced by ensuremath. Furthermore the code causes some warnings. A4 is no valid option for the article class and \small is ignored in math mode.

\documentclass[12pt]{article}
\usepackage{amsmath,amsfonts,amscd,amssymb,amsthm,amsbsy}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{abraces}
\usepackage{upgreek}
\usepackage{mathrsfs}   
\usepackage{dsfont}
\usepackage[hang,small,labelfont=bf,up,textfont=it,up]{caption} 
\usepackage{dsfont,float}
\usepackage{color}
\newcommand{\rbel}{
\ensuremath{\;\rightarrow_{\hspace*{-0.3cm}{n}}\;~}
}
\begin{document}
\begin{align}
\theta_n>1, \quad 
\dfrac{1}{\theta_n^2} \rbel 0
\end{align}
\end{document}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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