Missing number, treated as zero when using renewcommand
up vote
1
down vote
favorite
I am trying to temporarily get read of marginpars in my paper.
I tried to simply renewcommand{marginpar}{}
but I get:
! Missing number, treated as zero.<to be read again>} renewcommand{marginpar}{}
I don't know why I am getting this error since it usually compiles my pdf without errors. Do you guys have any idea?
Thanks in advance
macros margins marginpar
add a comment |
up vote
1
down vote
favorite
I am trying to temporarily get read of marginpars in my paper.
I tried to simply renewcommand{marginpar}{}
but I get:
! Missing number, treated as zero.<to be read again>} renewcommand{marginpar}{}
I don't know why I am getting this error since it usually compiles my pdf without errors. Do you guys have any idea?
Thanks in advance
macros margins marginpar
You'll want to tryrenewcommand{marginpar}[2]{}
. The first optional argument gives the number of arguments the (re)defined command has. If there is a second optional argument to(re)newcommand
the first argument of the (re)defined command is optional. You may leave out the first optional argument (it is optional after all), but if it is present it must be a number.marginpar
has two arguments: An optional one and a mandatory one in that order, hence[2]
does what you need.
– moewe
14 hours ago
tex.stackexchange.com/q/117358/107497 and tex.stackexchange.com/q/280527/107497 are similar questions aboutnewcommand
.renewcommand
has the same syntax.
– Teepeemm
14 hours ago
@moewe that did it. Thanks for that. Please post as an answer with the explanations. Will accept right away :)
– LBes
14 hours ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to temporarily get read of marginpars in my paper.
I tried to simply renewcommand{marginpar}{}
but I get:
! Missing number, treated as zero.<to be read again>} renewcommand{marginpar}{}
I don't know why I am getting this error since it usually compiles my pdf without errors. Do you guys have any idea?
Thanks in advance
macros margins marginpar
I am trying to temporarily get read of marginpars in my paper.
I tried to simply renewcommand{marginpar}{}
but I get:
! Missing number, treated as zero.<to be read again>} renewcommand{marginpar}{}
I don't know why I am getting this error since it usually compiles my pdf without errors. Do you guys have any idea?
Thanks in advance
macros margins marginpar
macros margins marginpar
asked 14 hours ago
LBes
1086
1086
You'll want to tryrenewcommand{marginpar}[2]{}
. The first optional argument gives the number of arguments the (re)defined command has. If there is a second optional argument to(re)newcommand
the first argument of the (re)defined command is optional. You may leave out the first optional argument (it is optional after all), but if it is present it must be a number.marginpar
has two arguments: An optional one and a mandatory one in that order, hence[2]
does what you need.
– moewe
14 hours ago
tex.stackexchange.com/q/117358/107497 and tex.stackexchange.com/q/280527/107497 are similar questions aboutnewcommand
.renewcommand
has the same syntax.
– Teepeemm
14 hours ago
@moewe that did it. Thanks for that. Please post as an answer with the explanations. Will accept right away :)
– LBes
14 hours ago
add a comment |
You'll want to tryrenewcommand{marginpar}[2]{}
. The first optional argument gives the number of arguments the (re)defined command has. If there is a second optional argument to(re)newcommand
the first argument of the (re)defined command is optional. You may leave out the first optional argument (it is optional after all), but if it is present it must be a number.marginpar
has two arguments: An optional one and a mandatory one in that order, hence[2]
does what you need.
– moewe
14 hours ago
tex.stackexchange.com/q/117358/107497 and tex.stackexchange.com/q/280527/107497 are similar questions aboutnewcommand
.renewcommand
has the same syntax.
– Teepeemm
14 hours ago
@moewe that did it. Thanks for that. Please post as an answer with the explanations. Will accept right away :)
– LBes
14 hours ago
You'll want to try
renewcommand{marginpar}[2]{}
. The first optional argument gives the number of arguments the (re)defined command has. If there is a second optional argument to (re)newcommand
the first argument of the (re)defined command is optional. You may leave out the first optional argument (it is optional after all), but if it is present it must be a number. marginpar
has two arguments: An optional one and a mandatory one in that order, hence [2]
does what you need.– moewe
14 hours ago
You'll want to try
renewcommand{marginpar}[2]{}
. The first optional argument gives the number of arguments the (re)defined command has. If there is a second optional argument to (re)newcommand
the first argument of the (re)defined command is optional. You may leave out the first optional argument (it is optional after all), but if it is present it must be a number. marginpar
has two arguments: An optional one and a mandatory one in that order, hence [2]
does what you need.– moewe
14 hours ago
tex.stackexchange.com/q/117358/107497 and tex.stackexchange.com/q/280527/107497 are similar questions about
newcommand
. renewcommand
has the same syntax.– Teepeemm
14 hours ago
tex.stackexchange.com/q/117358/107497 and tex.stackexchange.com/q/280527/107497 are similar questions about
newcommand
. renewcommand
has the same syntax.– Teepeemm
14 hours ago
@moewe that did it. Thanks for that. Please post as an answer with the explanations. Will accept right away :)
– LBes
14 hours ago
@moewe that did it. Thanks for that. Please post as an answer with the explanations. Will accept right away :)
– LBes
14 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
In order to get rid of marginpar
properly (assuming its usual definition) you will want to try
renewcommand{marginpar}[2]{}
The exact syntax of (re)newcommand
has been explained elsewhere (for example in newcommand argument confusion) far better than I could, so let me just recap shortly that the usual syntax for (re)newcommand
is
newcommand{<command>}[<number of arguments>][<optional value>]{<definition>}
where the both arguments in square brackets are optional - if there is only one optional argument it is interpreted as the first optional argument.
<number of arguments>
gives the number of arguments <command>
accepts and must be a number if it is present. That is what caused the error in your example, it is not acceptable to leave the square brackets empty. If additional <optional value>
is present, the first argument of <command>
becomes optional and is assumed to be <optional value>
if it is not present (optional arguments are commonly given in square brackets, mandatory arguments in curly brackets).
This means that commands defined with (re)newcommand
will always have one of the following argument structures
foo % no argument at all
foo{m_1} % one mandatory argument
foo[o_1] % one optional argument
foo{m_1}{m_2}...{m_n} % n leq 9, two to nine mandatory arguments
foo[o_1]{m_1}...{m_n} % n leq 8, one optional argument and one to eight mandatory arguments
Other argument structures are possible in (La)TeX, but they have to be coded differently. Ironically, newcommand
itself uses a very different structure.
marginpar
has the following argument specification
marginpar[<LTEXT>]{<RTEXT>}
which means that its structure can be redefined with renewcommand
directly as a macro with two arguments of which the first is optional.
Ulrich Diez made a good point in the comments that one needs to be careful about the spacing. The default definition of marginpar
uses @bsphack...@esphack
to avoid unwanted white space, see How to make a command completely empty / invisible / non-existent?. If you want to replicate that behaviour to not change spacing when you disable marginpar
, you'll need the more involved
makeatletter
renewcommand{marginpar}[2]{@bsphack@esphack}
makeatother
Whether or not that is necessary will depend on how exactly you used marginpar
and what your requirements and intentions are for disabling it. If it's just for a quick test you needn't bother, if it's for the final print version that's a different matter.
Thanks for the recap. Very nice answer. Answer accepted!
– LBes
13 hours ago
@UlrichDiez Ah yes, thanks for the hint. Added a short edit.
– moewe
9 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
In order to get rid of marginpar
properly (assuming its usual definition) you will want to try
renewcommand{marginpar}[2]{}
The exact syntax of (re)newcommand
has been explained elsewhere (for example in newcommand argument confusion) far better than I could, so let me just recap shortly that the usual syntax for (re)newcommand
is
newcommand{<command>}[<number of arguments>][<optional value>]{<definition>}
where the both arguments in square brackets are optional - if there is only one optional argument it is interpreted as the first optional argument.
<number of arguments>
gives the number of arguments <command>
accepts and must be a number if it is present. That is what caused the error in your example, it is not acceptable to leave the square brackets empty. If additional <optional value>
is present, the first argument of <command>
becomes optional and is assumed to be <optional value>
if it is not present (optional arguments are commonly given in square brackets, mandatory arguments in curly brackets).
This means that commands defined with (re)newcommand
will always have one of the following argument structures
foo % no argument at all
foo{m_1} % one mandatory argument
foo[o_1] % one optional argument
foo{m_1}{m_2}...{m_n} % n leq 9, two to nine mandatory arguments
foo[o_1]{m_1}...{m_n} % n leq 8, one optional argument and one to eight mandatory arguments
Other argument structures are possible in (La)TeX, but they have to be coded differently. Ironically, newcommand
itself uses a very different structure.
marginpar
has the following argument specification
marginpar[<LTEXT>]{<RTEXT>}
which means that its structure can be redefined with renewcommand
directly as a macro with two arguments of which the first is optional.
Ulrich Diez made a good point in the comments that one needs to be careful about the spacing. The default definition of marginpar
uses @bsphack...@esphack
to avoid unwanted white space, see How to make a command completely empty / invisible / non-existent?. If you want to replicate that behaviour to not change spacing when you disable marginpar
, you'll need the more involved
makeatletter
renewcommand{marginpar}[2]{@bsphack@esphack}
makeatother
Whether or not that is necessary will depend on how exactly you used marginpar
and what your requirements and intentions are for disabling it. If it's just for a quick test you needn't bother, if it's for the final print version that's a different matter.
Thanks for the recap. Very nice answer. Answer accepted!
– LBes
13 hours ago
@UlrichDiez Ah yes, thanks for the hint. Added a short edit.
– moewe
9 hours ago
add a comment |
up vote
2
down vote
accepted
In order to get rid of marginpar
properly (assuming its usual definition) you will want to try
renewcommand{marginpar}[2]{}
The exact syntax of (re)newcommand
has been explained elsewhere (for example in newcommand argument confusion) far better than I could, so let me just recap shortly that the usual syntax for (re)newcommand
is
newcommand{<command>}[<number of arguments>][<optional value>]{<definition>}
where the both arguments in square brackets are optional - if there is only one optional argument it is interpreted as the first optional argument.
<number of arguments>
gives the number of arguments <command>
accepts and must be a number if it is present. That is what caused the error in your example, it is not acceptable to leave the square brackets empty. If additional <optional value>
is present, the first argument of <command>
becomes optional and is assumed to be <optional value>
if it is not present (optional arguments are commonly given in square brackets, mandatory arguments in curly brackets).
This means that commands defined with (re)newcommand
will always have one of the following argument structures
foo % no argument at all
foo{m_1} % one mandatory argument
foo[o_1] % one optional argument
foo{m_1}{m_2}...{m_n} % n leq 9, two to nine mandatory arguments
foo[o_1]{m_1}...{m_n} % n leq 8, one optional argument and one to eight mandatory arguments
Other argument structures are possible in (La)TeX, but they have to be coded differently. Ironically, newcommand
itself uses a very different structure.
marginpar
has the following argument specification
marginpar[<LTEXT>]{<RTEXT>}
which means that its structure can be redefined with renewcommand
directly as a macro with two arguments of which the first is optional.
Ulrich Diez made a good point in the comments that one needs to be careful about the spacing. The default definition of marginpar
uses @bsphack...@esphack
to avoid unwanted white space, see How to make a command completely empty / invisible / non-existent?. If you want to replicate that behaviour to not change spacing when you disable marginpar
, you'll need the more involved
makeatletter
renewcommand{marginpar}[2]{@bsphack@esphack}
makeatother
Whether or not that is necessary will depend on how exactly you used marginpar
and what your requirements and intentions are for disabling it. If it's just for a quick test you needn't bother, if it's for the final print version that's a different matter.
Thanks for the recap. Very nice answer. Answer accepted!
– LBes
13 hours ago
@UlrichDiez Ah yes, thanks for the hint. Added a short edit.
– moewe
9 hours ago
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
In order to get rid of marginpar
properly (assuming its usual definition) you will want to try
renewcommand{marginpar}[2]{}
The exact syntax of (re)newcommand
has been explained elsewhere (for example in newcommand argument confusion) far better than I could, so let me just recap shortly that the usual syntax for (re)newcommand
is
newcommand{<command>}[<number of arguments>][<optional value>]{<definition>}
where the both arguments in square brackets are optional - if there is only one optional argument it is interpreted as the first optional argument.
<number of arguments>
gives the number of arguments <command>
accepts and must be a number if it is present. That is what caused the error in your example, it is not acceptable to leave the square brackets empty. If additional <optional value>
is present, the first argument of <command>
becomes optional and is assumed to be <optional value>
if it is not present (optional arguments are commonly given in square brackets, mandatory arguments in curly brackets).
This means that commands defined with (re)newcommand
will always have one of the following argument structures
foo % no argument at all
foo{m_1} % one mandatory argument
foo[o_1] % one optional argument
foo{m_1}{m_2}...{m_n} % n leq 9, two to nine mandatory arguments
foo[o_1]{m_1}...{m_n} % n leq 8, one optional argument and one to eight mandatory arguments
Other argument structures are possible in (La)TeX, but they have to be coded differently. Ironically, newcommand
itself uses a very different structure.
marginpar
has the following argument specification
marginpar[<LTEXT>]{<RTEXT>}
which means that its structure can be redefined with renewcommand
directly as a macro with two arguments of which the first is optional.
Ulrich Diez made a good point in the comments that one needs to be careful about the spacing. The default definition of marginpar
uses @bsphack...@esphack
to avoid unwanted white space, see How to make a command completely empty / invisible / non-existent?. If you want to replicate that behaviour to not change spacing when you disable marginpar
, you'll need the more involved
makeatletter
renewcommand{marginpar}[2]{@bsphack@esphack}
makeatother
Whether or not that is necessary will depend on how exactly you used marginpar
and what your requirements and intentions are for disabling it. If it's just for a quick test you needn't bother, if it's for the final print version that's a different matter.
In order to get rid of marginpar
properly (assuming its usual definition) you will want to try
renewcommand{marginpar}[2]{}
The exact syntax of (re)newcommand
has been explained elsewhere (for example in newcommand argument confusion) far better than I could, so let me just recap shortly that the usual syntax for (re)newcommand
is
newcommand{<command>}[<number of arguments>][<optional value>]{<definition>}
where the both arguments in square brackets are optional - if there is only one optional argument it is interpreted as the first optional argument.
<number of arguments>
gives the number of arguments <command>
accepts and must be a number if it is present. That is what caused the error in your example, it is not acceptable to leave the square brackets empty. If additional <optional value>
is present, the first argument of <command>
becomes optional and is assumed to be <optional value>
if it is not present (optional arguments are commonly given in square brackets, mandatory arguments in curly brackets).
This means that commands defined with (re)newcommand
will always have one of the following argument structures
foo % no argument at all
foo{m_1} % one mandatory argument
foo[o_1] % one optional argument
foo{m_1}{m_2}...{m_n} % n leq 9, two to nine mandatory arguments
foo[o_1]{m_1}...{m_n} % n leq 8, one optional argument and one to eight mandatory arguments
Other argument structures are possible in (La)TeX, but they have to be coded differently. Ironically, newcommand
itself uses a very different structure.
marginpar
has the following argument specification
marginpar[<LTEXT>]{<RTEXT>}
which means that its structure can be redefined with renewcommand
directly as a macro with two arguments of which the first is optional.
Ulrich Diez made a good point in the comments that one needs to be careful about the spacing. The default definition of marginpar
uses @bsphack...@esphack
to avoid unwanted white space, see How to make a command completely empty / invisible / non-existent?. If you want to replicate that behaviour to not change spacing when you disable marginpar
, you'll need the more involved
makeatletter
renewcommand{marginpar}[2]{@bsphack@esphack}
makeatother
Whether or not that is necessary will depend on how exactly you used marginpar
and what your requirements and intentions are for disabling it. If it's just for a quick test you needn't bother, if it's for the final print version that's a different matter.
edited 9 hours ago
answered 13 hours ago
moewe
82.8k8106317
82.8k8106317
Thanks for the recap. Very nice answer. Answer accepted!
– LBes
13 hours ago
@UlrichDiez Ah yes, thanks for the hint. Added a short edit.
– moewe
9 hours ago
add a comment |
Thanks for the recap. Very nice answer. Answer accepted!
– LBes
13 hours ago
@UlrichDiez Ah yes, thanks for the hint. Added a short edit.
– moewe
9 hours ago
Thanks for the recap. Very nice answer. Answer accepted!
– LBes
13 hours ago
Thanks for the recap. Very nice answer. Answer accepted!
– LBes
13 hours ago
@UlrichDiez Ah yes, thanks for the hint. Added a short edit.
– moewe
9 hours ago
@UlrichDiez Ah yes, thanks for the hint. Added a short edit.
– moewe
9 hours ago
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
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%2f461149%2fmissing-number-treated-as-zero-when-using-renewcommand%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');
});
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');
});
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');
});
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
You'll want to try
renewcommand{marginpar}[2]{}
. The first optional argument gives the number of arguments the (re)defined command has. If there is a second optional argument to(re)newcommand
the first argument of the (re)defined command is optional. You may leave out the first optional argument (it is optional after all), but if it is present it must be a number.marginpar
has two arguments: An optional one and a mandatory one in that order, hence[2]
does what you need.– moewe
14 hours ago
tex.stackexchange.com/q/117358/107497 and tex.stackexchange.com/q/280527/107497 are similar questions about
newcommand
.renewcommand
has the same syntax.– Teepeemm
14 hours ago
@moewe that did it. Thanks for that. Please post as an answer with the explanations. Will accept right away :)
– LBes
14 hours ago