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
New contributor
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
New contributor
2
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
3 hours ago
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
New contributor
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
macros
New contributor
New contributor
edited 1 hour ago
Sebastiano
8,79641756
8,79641756
New contributor
asked 3 hours ago
MikeH
111
111
New contributor
New contributor
2
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
3 hours ago
add a comment |
2
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
3 hours ago
2
2
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
3 hours ago
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
3 hours ago
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
:
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
});
}
});
MikeH 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');
});
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
:
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
:
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 3 hours ago
answered 3 hours ago
egreg
707k8618793160
707k8618793160
add a comment |
add a comment |
MikeH is a new contributor. Be nice, and check out our Code of Conduct.
MikeH is a new contributor. Be nice, and check out our Code of Conduct.
MikeH is a new contributor. Be nice, and check out our Code of Conduct.
MikeH 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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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
2
textbf is as the name indicates for text and not for math.
– Ulrike Fischer
3 hours ago