why this newcommand doesn't work in align environment?
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}"
math-mode macros equations errors environments
New contributor
add a comment |
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}"
math-mode macros equations errors environments
New contributor
1
Yourrbel
-command contains anmbox
. Even in math-mode the content ofmbox
es isn't in math-mode any more asmbox
es switch to text-mode...
– Ulrich Diez
10 hours ago
2
For avoiding linebreaks in math-mode usually nesting things in curly-brace-groups is sufficient. I.e., just do without thembox
:newcommand{rbel}{{;rightarrow_{hspace*{-0.3cm}{small n}};~}}
– Ulrich Diez
10 hours ago
This is not causing your issue but with your preamble the dsfont package is loaded twice.
– Ulrich Diez
10 hours ago
There is also mathmbox from mathtools.
– John Kormylo
9 hours ago
add a comment |
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}"
math-mode macros equations errors environments
New contributor
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}"
math-mode macros equations errors environments
math-mode macros equations errors environments
New contributor
New contributor
edited 10 hours ago
Bernard
169k773198
169k773198
New contributor
asked 10 hours ago
JirJir
212
212
New contributor
New contributor
1
Yourrbel
-command contains anmbox
. Even in math-mode the content ofmbox
es isn't in math-mode any more asmbox
es switch to text-mode...
– Ulrich Diez
10 hours ago
2
For avoiding linebreaks in math-mode usually nesting things in curly-brace-groups is sufficient. I.e., just do without thembox
:newcommand{rbel}{{;rightarrow_{hspace*{-0.3cm}{small n}};~}}
– Ulrich Diez
10 hours ago
This is not causing your issue but with your preamble the dsfont package is loaded twice.
– Ulrich Diez
10 hours ago
There is also mathmbox from mathtools.
– John Kormylo
9 hours ago
add a comment |
1
Yourrbel
-command contains anmbox
. Even in math-mode the content ofmbox
es isn't in math-mode any more asmbox
es switch to text-mode...
– Ulrich Diez
10 hours ago
2
For avoiding linebreaks in math-mode usually nesting things in curly-brace-groups is sufficient. I.e., just do without thembox
:newcommand{rbel}{{;rightarrow_{hspace*{-0.3cm}{small n}};~}}
– Ulrich Diez
10 hours ago
This is not causing your issue but with your preamble the dsfont package is loaded twice.
– Ulrich Diez
10 hours ago
There is also mathmbox from mathtools.
– John Kormylo
9 hours ago
1
1
Your
rbel
-command contains an mbox
. Even in math-mode the content of mbox
es isn't in math-mode any more as mbox
es switch to text-mode...– Ulrich Diez
10 hours ago
Your
rbel
-command contains an mbox
. Even in math-mode the content of mbox
es isn't in math-mode any more as mbox
es switch to text-mode...– Ulrich Diez
10 hours ago
2
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
10 hours ago
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
10 hours ago
This is not causing your issue but with your preamble the dsfont package is loaded twice.
– Ulrich Diez
10 hours ago
This is not causing your issue but with your preamble the dsfont package is loaded twice.
– Ulrich Diez
10 hours ago
There is also mathmbox from mathtools.
– John Kormylo
9 hours ago
There is also mathmbox from mathtools.
– John Kormylo
9 hours ago
add a comment |
3 Answers
3
active
oldest
votes
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
.
add a comment |
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}
New contributor
add a comment |
Another simple solution for your question using tikz-cd
. You can observe from the picture that n
is more near at the arrow of same dimension of the lenght of xrightarrow
.
Here there is the MWE:
documentclass[12pt]{article}
usepackage{mathtools,tikz-cd}
begin{document}
[
theta_n>1, quad begin{tikzcd}[column sep=.4cm]
dfrac{1}{theta_n^2} arrow[r, "n"'] & 0
end{tikzcd}
]
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Jir is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f474069%2fwhy-this-newcommand-doesnt-work-in-align-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered 10 hours ago
egregegreg
718k8719053202
718k8719053202
add a comment |
add a comment |
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}
New contributor
add a comment |
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}
New contributor
add a comment |
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}
New contributor
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}
New contributor
New contributor
answered 10 hours ago
jihajiha
534
534
New contributor
New contributor
add a comment |
add a comment |
Another simple solution for your question using tikz-cd
. You can observe from the picture that n
is more near at the arrow of same dimension of the lenght of xrightarrow
.
Here there is the MWE:
documentclass[12pt]{article}
usepackage{mathtools,tikz-cd}
begin{document}
[
theta_n>1, quad begin{tikzcd}[column sep=.4cm]
dfrac{1}{theta_n^2} arrow[r, "n"'] & 0
end{tikzcd}
]
end{document}
add a comment |
Another simple solution for your question using tikz-cd
. You can observe from the picture that n
is more near at the arrow of same dimension of the lenght of xrightarrow
.
Here there is the MWE:
documentclass[12pt]{article}
usepackage{mathtools,tikz-cd}
begin{document}
[
theta_n>1, quad begin{tikzcd}[column sep=.4cm]
dfrac{1}{theta_n^2} arrow[r, "n"'] & 0
end{tikzcd}
]
end{document}
add a comment |
Another simple solution for your question using tikz-cd
. You can observe from the picture that n
is more near at the arrow of same dimension of the lenght of xrightarrow
.
Here there is the MWE:
documentclass[12pt]{article}
usepackage{mathtools,tikz-cd}
begin{document}
[
theta_n>1, quad begin{tikzcd}[column sep=.4cm]
dfrac{1}{theta_n^2} arrow[r, "n"'] & 0
end{tikzcd}
]
end{document}
Another simple solution for your question using tikz-cd
. You can observe from the picture that n
is more near at the arrow of same dimension of the lenght of xrightarrow
.
Here there is the MWE:
documentclass[12pt]{article}
usepackage{mathtools,tikz-cd}
begin{document}
[
theta_n>1, quad begin{tikzcd}[column sep=.4cm]
dfrac{1}{theta_n^2} arrow[r, "n"'] & 0
end{tikzcd}
]
end{document}
edited 5 hours ago
answered 6 hours ago
SebastianoSebastiano
9,88041858
9,88041858
add a comment |
add a comment |
Jir is a new contributor. Be nice, and check out our Code of Conduct.
Jir is a new contributor. Be nice, and check out our Code of Conduct.
Jir is a new contributor. Be nice, and check out our Code of Conduct.
Jir is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f474069%2fwhy-this-newcommand-doesnt-work-in-align-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Your
rbel
-command contains anmbox
. Even in math-mode the content ofmbox
es isn't in math-mode any more asmbox
es switch to text-mode...– Ulrich Diez
10 hours ago
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
10 hours ago
This is not causing your issue but with your preamble the dsfont package is loaded twice.
– Ulrich Diez
10 hours ago
There is also mathmbox from mathtools.
– John Kormylo
9 hours ago