Commands inside textbf












2














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}


Output of the above code



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










share|improve this question









New contributor




MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    textbf is as the name indicates for text and not for math.
    – Ulrike Fischer
    3 hours ago
















2














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}


Output of the above code



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










share|improve this question









New contributor




MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    textbf is as the name indicates for text and not for math.
    – Ulrike Fischer
    3 hours ago














2












2








2







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}


Output of the above code



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










share|improve this question









New contributor




MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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}


Output of the above code



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






share|improve this question









New contributor




MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 1 hour ago









Sebastiano

8,79641756




8,79641756






New contributor




MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









MikeH

111




111




New contributor




MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






MikeH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2




    textbf is as the name indicates for text and not for math.
    – Ulrike Fischer
    3 hours ago














  • 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










1 Answer
1






active

oldest

votes


















5














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}


enter image description here



Do you see the problem? This doesn't happen if you change textbf into mathbf:



enter image description here






share|improve this answer























    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.










    draft saved

    draft discarded


















    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









    5














    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}


    enter image description here



    Do you see the problem? This doesn't happen if you change textbf into mathbf:



    enter image description here






    share|improve this answer




























      5














      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}


      enter image description here



      Do you see the problem? This doesn't happen if you change textbf into mathbf:



      enter image description here






      share|improve this answer


























        5












        5








        5






        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}


        enter image description here



        Do you see the problem? This doesn't happen if you change textbf into mathbf:



        enter image description here






        share|improve this answer














        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}


        enter image description here



        Do you see the problem? This doesn't happen if you change textbf into mathbf:



        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 3 hours ago

























        answered 3 hours ago









        egreg

        707k8618793160




        707k8618793160






















            MikeH is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python