Commands inside textbf
I was working on creating a small table of formulas for my Math class. Since I will be using a lot of vector related stuff I defined and redefined some commands to suit my needs. Below you see my commands
renewcommand{vec}[1]{textbf{#1}} %Vector
newcommand{scalar}[2]{langle vec{#1},vec{#2} rangle} %Scalar
newcommand{crossp}[2]{vec{#1} times vec{#2}} %Crossproduct
The problem is that using the following code results in strange behaviour I do not understand and cannot find any help on.
begin{equation}
V = scalar{u}{crossp{v}{w}}
end{equation}
I have also tried using textbf{...}
directly, without using the vec function.
I know that vec
is basically obsolete, but I use it so I can see what is bold text and what are vectors when reading my code.
The problem is also not resulting from applying vec twice, as I have also tried simple inserting v times w
, which produces the exact same behaviour.
Can anyone explain why this is happening and propose a fix?
Thanks in advance.
Mike
macros bold math-fonts
add a comment |
I was working on creating a small table of formulas for my Math class. Since I will be using a lot of vector related stuff I defined and redefined some commands to suit my needs. Below you see my commands
renewcommand{vec}[1]{textbf{#1}} %Vector
newcommand{scalar}[2]{langle vec{#1},vec{#2} rangle} %Scalar
newcommand{crossp}[2]{vec{#1} times vec{#2}} %Crossproduct
The problem is that using the following code results in strange behaviour I do not understand and cannot find any help on.
begin{equation}
V = scalar{u}{crossp{v}{w}}
end{equation}
I have also tried using textbf{...}
directly, without using the vec function.
I know that vec
is basically obsolete, but I use it so I can see what is bold text and what are vectors when reading my code.
The problem is also not resulting from applying vec twice, as I have also tried simple inserting v times w
, which produces the exact same behaviour.
Can anyone explain why this is happening and propose a fix?
Thanks in advance.
Mike
macros bold math-fonts
3
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
Dec 25 '18 at 17:44
I wouldn't sayvec
is basically obsolete, your command (with egreg's correction) is a great idea. As you say, it makes your input a bit more sane and reasonable and it allows you to change the way you notate vectors with one trivial edit. If you decide you wanna switch from bold to the arrow above you can do it instantly (although it might be a tad more complicated with your additional derivative commands to swap from boldface to an arrow above but yeah, still!)
– Au101
Dec 25 '18 at 21:54
1
if you get an error you should ask about the error message not show the typeset output (the pdf output isn't intended to be usable after an error)
– David Carlisle
Dec 25 '18 at 23:39
add a comment |
I was working on creating a small table of formulas for my Math class. Since I will be using a lot of vector related stuff I defined and redefined some commands to suit my needs. Below you see my commands
renewcommand{vec}[1]{textbf{#1}} %Vector
newcommand{scalar}[2]{langle vec{#1},vec{#2} rangle} %Scalar
newcommand{crossp}[2]{vec{#1} times vec{#2}} %Crossproduct
The problem is that using the following code results in strange behaviour I do not understand and cannot find any help on.
begin{equation}
V = scalar{u}{crossp{v}{w}}
end{equation}
I have also tried using textbf{...}
directly, without using the vec function.
I know that vec
is basically obsolete, but I use it so I can see what is bold text and what are vectors when reading my code.
The problem is also not resulting from applying vec twice, as I have also tried simple inserting v times w
, which produces the exact same behaviour.
Can anyone explain why this is happening and propose a fix?
Thanks in advance.
Mike
macros bold math-fonts
I was working on creating a small table of formulas for my Math class. Since I will be using a lot of vector related stuff I defined and redefined some commands to suit my needs. Below you see my commands
renewcommand{vec}[1]{textbf{#1}} %Vector
newcommand{scalar}[2]{langle vec{#1},vec{#2} rangle} %Scalar
newcommand{crossp}[2]{vec{#1} times vec{#2}} %Crossproduct
The problem is that using the following code results in strange behaviour I do not understand and cannot find any help on.
begin{equation}
V = scalar{u}{crossp{v}{w}}
end{equation}
I have also tried using textbf{...}
directly, without using the vec function.
I know that vec
is basically obsolete, but I use it so I can see what is bold text and what are vectors when reading my code.
The problem is also not resulting from applying vec twice, as I have also tried simple inserting v times w
, which produces the exact same behaviour.
Can anyone explain why this is happening and propose a fix?
Thanks in advance.
Mike
macros bold math-fonts
macros bold math-fonts
edited Dec 25 '18 at 22:26
Ari Brodsky
1,4241230
1,4241230
asked Dec 25 '18 at 17:42
MikeHMikeH
233
233
3
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
Dec 25 '18 at 17:44
I wouldn't sayvec
is basically obsolete, your command (with egreg's correction) is a great idea. As you say, it makes your input a bit more sane and reasonable and it allows you to change the way you notate vectors with one trivial edit. If you decide you wanna switch from bold to the arrow above you can do it instantly (although it might be a tad more complicated with your additional derivative commands to swap from boldface to an arrow above but yeah, still!)
– Au101
Dec 25 '18 at 21:54
1
if you get an error you should ask about the error message not show the typeset output (the pdf output isn't intended to be usable after an error)
– David Carlisle
Dec 25 '18 at 23:39
add a comment |
3
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
Dec 25 '18 at 17:44
I wouldn't sayvec
is basically obsolete, your command (with egreg's correction) is a great idea. As you say, it makes your input a bit more sane and reasonable and it allows you to change the way you notate vectors with one trivial edit. If you decide you wanna switch from bold to the arrow above you can do it instantly (although it might be a tad more complicated with your additional derivative commands to swap from boldface to an arrow above but yeah, still!)
– Au101
Dec 25 '18 at 21:54
1
if you get an error you should ask about the error message not show the typeset output (the pdf output isn't intended to be usable after an error)
– David Carlisle
Dec 25 '18 at 23:39
3
3
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
Dec 25 '18 at 17:44
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
Dec 25 '18 at 17:44
I wouldn't say
vec
is basically obsolete, your command (with egreg's correction) is a great idea. As you say, it makes your input a bit more sane and reasonable and it allows you to change the way you notate vectors with one trivial edit. If you decide you wanna switch from bold to the arrow above you can do it instantly (although it might be a tad more complicated with your additional derivative commands to swap from boldface to an arrow above but yeah, still!)– Au101
Dec 25 '18 at 21:54
I wouldn't say
vec
is basically obsolete, your command (with egreg's correction) is a great idea. As you say, it makes your input a bit more sane and reasonable and it allows you to change the way you notate vectors with one trivial edit. If you decide you wanna switch from bold to the arrow above you can do it instantly (although it might be a tad more complicated with your additional derivative commands to swap from boldface to an arrow above but yeah, still!)– Au101
Dec 25 '18 at 21:54
1
1
if you get an error you should ask about the error message not show the typeset output (the pdf output isn't intended to be usable after an error)
– David Carlisle
Dec 25 '18 at 23:39
if you get an error you should ask about the error message not show the typeset output (the pdf output isn't intended to be usable after an error)
– David Carlisle
Dec 25 '18 at 23:39
add a comment |
1 Answer
1
active
oldest
votes
The fix is simple: use mathbf
and not textbf
:
renewcommand{vec}[1]{mathbf{#1}}
Your code produces errors, the first of which is
! Missing $ inserted.
<inserted text>
$
l.10 V = scalar{u}{crossp{v}{w}}
because textbf
enters text mode.
Even if that would be solvable you'd get in real trouble with something like the following:
documentclass{article}
usepackage{amsmath}
newtheorem{theorem}{Theorem}
renewcommand{vec}[1]{textbf{#1}} %Vector
begin{document}
A vector $vec{v}$.
begin{theorem}
A vector $vec{v}$.
end{theorem}
end{document}
Do you see the problem? This doesn't happen if you change textbf
into mathbf
:
Thank you for your help. This solved the problem. I am new to LaTeX and didn't realize this would cause a problem - the more you know.
– MikeH
Dec 26 '18 at 14:30
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
});
}
});
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%2f467309%2fcommands-inside-textbf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The fix is simple: use mathbf
and not textbf
:
renewcommand{vec}[1]{mathbf{#1}}
Your code produces errors, the first of which is
! Missing $ inserted.
<inserted text>
$
l.10 V = scalar{u}{crossp{v}{w}}
because textbf
enters text mode.
Even if that would be solvable you'd get in real trouble with something like the following:
documentclass{article}
usepackage{amsmath}
newtheorem{theorem}{Theorem}
renewcommand{vec}[1]{textbf{#1}} %Vector
begin{document}
A vector $vec{v}$.
begin{theorem}
A vector $vec{v}$.
end{theorem}
end{document}
Do you see the problem? This doesn't happen if you change textbf
into mathbf
:
Thank you for your help. This solved the problem. I am new to LaTeX and didn't realize this would cause a problem - the more you know.
– MikeH
Dec 26 '18 at 14:30
add a comment |
The fix is simple: use mathbf
and not textbf
:
renewcommand{vec}[1]{mathbf{#1}}
Your code produces errors, the first of which is
! Missing $ inserted.
<inserted text>
$
l.10 V = scalar{u}{crossp{v}{w}}
because textbf
enters text mode.
Even if that would be solvable you'd get in real trouble with something like the following:
documentclass{article}
usepackage{amsmath}
newtheorem{theorem}{Theorem}
renewcommand{vec}[1]{textbf{#1}} %Vector
begin{document}
A vector $vec{v}$.
begin{theorem}
A vector $vec{v}$.
end{theorem}
end{document}
Do you see the problem? This doesn't happen if you change textbf
into mathbf
:
Thank you for your help. This solved the problem. I am new to LaTeX and didn't realize this would cause a problem - the more you know.
– MikeH
Dec 26 '18 at 14:30
add a comment |
The fix is simple: use mathbf
and not textbf
:
renewcommand{vec}[1]{mathbf{#1}}
Your code produces errors, the first of which is
! Missing $ inserted.
<inserted text>
$
l.10 V = scalar{u}{crossp{v}{w}}
because textbf
enters text mode.
Even if that would be solvable you'd get in real trouble with something like the following:
documentclass{article}
usepackage{amsmath}
newtheorem{theorem}{Theorem}
renewcommand{vec}[1]{textbf{#1}} %Vector
begin{document}
A vector $vec{v}$.
begin{theorem}
A vector $vec{v}$.
end{theorem}
end{document}
Do you see the problem? This doesn't happen if you change textbf
into mathbf
:
The fix is simple: use mathbf
and not textbf
:
renewcommand{vec}[1]{mathbf{#1}}
Your code produces errors, the first of which is
! Missing $ inserted.
<inserted text>
$
l.10 V = scalar{u}{crossp{v}{w}}
because textbf
enters text mode.
Even if that would be solvable you'd get in real trouble with something like the following:
documentclass{article}
usepackage{amsmath}
newtheorem{theorem}{Theorem}
renewcommand{vec}[1]{textbf{#1}} %Vector
begin{document}
A vector $vec{v}$.
begin{theorem}
A vector $vec{v}$.
end{theorem}
end{document}
Do you see the problem? This doesn't happen if you change textbf
into mathbf
:
edited Dec 25 '18 at 17:52
answered Dec 25 '18 at 17:44
egregegreg
725k8819193226
725k8819193226
Thank you for your help. This solved the problem. I am new to LaTeX and didn't realize this would cause a problem - the more you know.
– MikeH
Dec 26 '18 at 14:30
add a comment |
Thank you for your help. This solved the problem. I am new to LaTeX and didn't realize this would cause a problem - the more you know.
– MikeH
Dec 26 '18 at 14:30
Thank you for your help. This solved the problem. I am new to LaTeX and didn't realize this would cause a problem - the more you know.
– MikeH
Dec 26 '18 at 14:30
Thank you for your help. This solved the problem. I am new to LaTeX and didn't realize this would cause a problem - the more you know.
– MikeH
Dec 26 '18 at 14:30
add a comment |
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');
});
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%2f467309%2fcommands-inside-textbf%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
3
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
Dec 25 '18 at 17:44
I wouldn't say
vec
is basically obsolete, your command (with egreg's correction) is a great idea. As you say, it makes your input a bit more sane and reasonable and it allows you to change the way you notate vectors with one trivial edit. If you decide you wanna switch from bold to the arrow above you can do it instantly (although it might be a tad more complicated with your additional derivative commands to swap from boldface to an arrow above but yeah, still!)– Au101
Dec 25 '18 at 21:54
1
if you get an error you should ask about the error message not show the typeset output (the pdf output isn't intended to be usable after an error)
– David Carlisle
Dec 25 '18 at 23:39