Make paired delimiter with prefix for Re and Im











up vote
2
down vote

favorite












I'm trying to make a new command for something like this:



operatorname{Re}leftlbracenum{1+2i}rightrbrace


Because I'm using the mathtools package already I tried to do something like this:
(And I have to undefine the previous Re and Im commands, because they are ugly and this command should be obviously called Re and Im.)



letReundefined
letImundefined
DeclarePairedDelimiterRe{operatorname{Re}lbrace}{rbrace}
DeclarePairedDelimiterIm{operatorname{Im}lbrace}{rbrace}


This will work, but will also spit put many errors. Like: Missing { inserted. end{align} and so on.



Then I thought: Yes, this is probably, because the font can not scale (and shouldn't), like the lbrace and rbrace. And I tried something like this:



letReundefined
letImundefined
DeclarePairedDelimiterbraces{lbrace}{rbrace}
newcommand{Re}{1}{operatorname{Re}braces*{#1}}
newcommand{Im}{1}{operatorname{Im}braces*{#1}}


But this will produce:




Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}




Inserting ensuremath or something like that doesn't help much.



Last try:



letReundefined
letImundefined
newcommand{Re}{1}{operatorname{Re}leftlbrace #1 rightrbrace}
newcommand{Im}{1}{operatorname{Im}leftlbrace #1 rightrbrace}



Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}



You can't use `macro parameter character #' in math mode. ...nd{Re}{1}{operatorname{Re}leftlbrace #




It can't be this hard to make something like this work, or can it? I really don't know what I should try next, or what am I even doing wrong.










share|improve this question






















  • why do you want left and right with 1+2i? you would get better spacing with (1+2i) than with left(1+2iright)
    – David Carlisle
    Nov 28 at 22:04















up vote
2
down vote

favorite












I'm trying to make a new command for something like this:



operatorname{Re}leftlbracenum{1+2i}rightrbrace


Because I'm using the mathtools package already I tried to do something like this:
(And I have to undefine the previous Re and Im commands, because they are ugly and this command should be obviously called Re and Im.)



letReundefined
letImundefined
DeclarePairedDelimiterRe{operatorname{Re}lbrace}{rbrace}
DeclarePairedDelimiterIm{operatorname{Im}lbrace}{rbrace}


This will work, but will also spit put many errors. Like: Missing { inserted. end{align} and so on.



Then I thought: Yes, this is probably, because the font can not scale (and shouldn't), like the lbrace and rbrace. And I tried something like this:



letReundefined
letImundefined
DeclarePairedDelimiterbraces{lbrace}{rbrace}
newcommand{Re}{1}{operatorname{Re}braces*{#1}}
newcommand{Im}{1}{operatorname{Im}braces*{#1}}


But this will produce:




Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}




Inserting ensuremath or something like that doesn't help much.



Last try:



letReundefined
letImundefined
newcommand{Re}{1}{operatorname{Re}leftlbrace #1 rightrbrace}
newcommand{Im}{1}{operatorname{Im}leftlbrace #1 rightrbrace}



Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}



You can't use `macro parameter character #' in math mode. ...nd{Re}{1}{operatorname{Re}leftlbrace #




It can't be this hard to make something like this work, or can it? I really don't know what I should try next, or what am I even doing wrong.










share|improve this question






















  • why do you want left and right with 1+2i? you would get better spacing with (1+2i) than with left(1+2iright)
    – David Carlisle
    Nov 28 at 22:04













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm trying to make a new command for something like this:



operatorname{Re}leftlbracenum{1+2i}rightrbrace


Because I'm using the mathtools package already I tried to do something like this:
(And I have to undefine the previous Re and Im commands, because they are ugly and this command should be obviously called Re and Im.)



letReundefined
letImundefined
DeclarePairedDelimiterRe{operatorname{Re}lbrace}{rbrace}
DeclarePairedDelimiterIm{operatorname{Im}lbrace}{rbrace}


This will work, but will also spit put many errors. Like: Missing { inserted. end{align} and so on.



Then I thought: Yes, this is probably, because the font can not scale (and shouldn't), like the lbrace and rbrace. And I tried something like this:



letReundefined
letImundefined
DeclarePairedDelimiterbraces{lbrace}{rbrace}
newcommand{Re}{1}{operatorname{Re}braces*{#1}}
newcommand{Im}{1}{operatorname{Im}braces*{#1}}


But this will produce:




Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}




Inserting ensuremath or something like that doesn't help much.



Last try:



letReundefined
letImundefined
newcommand{Re}{1}{operatorname{Re}leftlbrace #1 rightrbrace}
newcommand{Im}{1}{operatorname{Im}leftlbrace #1 rightrbrace}



Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}



You can't use `macro parameter character #' in math mode. ...nd{Re}{1}{operatorname{Re}leftlbrace #




It can't be this hard to make something like this work, or can it? I really don't know what I should try next, or what am I even doing wrong.










share|improve this question













I'm trying to make a new command for something like this:



operatorname{Re}leftlbracenum{1+2i}rightrbrace


Because I'm using the mathtools package already I tried to do something like this:
(And I have to undefine the previous Re and Im commands, because they are ugly and this command should be obviously called Re and Im.)



letReundefined
letImundefined
DeclarePairedDelimiterRe{operatorname{Re}lbrace}{rbrace}
DeclarePairedDelimiterIm{operatorname{Im}lbrace}{rbrace}


This will work, but will also spit put many errors. Like: Missing { inserted. end{align} and so on.



Then I thought: Yes, this is probably, because the font can not scale (and shouldn't), like the lbrace and rbrace. And I tried something like this:



letReundefined
letImundefined
DeclarePairedDelimiterbraces{lbrace}{rbrace}
newcommand{Re}{1}{operatorname{Re}braces*{#1}}
newcommand{Im}{1}{operatorname{Im}braces*{#1}}


But this will produce:




Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}




Inserting ensuremath or something like that doesn't help much.



Last try:



letReundefined
letImundefined
newcommand{Re}{1}{operatorname{Re}leftlbrace #1 rightrbrace}
newcommand{Im}{1}{operatorname{Im}leftlbrace #1 rightrbrace}



Missing $ inserted. newcommand{Re}{1}{operatorname{Re}



Missing begin{document}. newcommand{Re}{1}{operatorname{Re}



You can't use `macro parameter character #' in math mode. ...nd{Re}{1}{operatorname{Re}leftlbrace #




It can't be this hard to make something like this work, or can it? I really don't know what I should try next, or what am I even doing wrong.







math-mode macros mathtools






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 28 at 22:00









Darkproduct

184




184












  • why do you want left and right with 1+2i? you would get better spacing with (1+2i) than with left(1+2iright)
    – David Carlisle
    Nov 28 at 22:04


















  • why do you want left and right with 1+2i? you would get better spacing with (1+2i) than with left(1+2iright)
    – David Carlisle
    Nov 28 at 22:04
















why do you want left and right with 1+2i? you would get better spacing with (1+2i) than with left(1+2iright)
– David Carlisle
Nov 28 at 22:04




why do you want left and right with 1+2i? you would get better spacing with (1+2i) than with left(1+2iright)
– David Carlisle
Nov 28 at 22:04










2 Answers
2






active

oldest

votes

















up vote
5
down vote



accepted










You have the incorrect syntax for newcommand.



newcommand{Re}{1}


should be



newcommand{Re}[1]





share|improve this answer




























    up vote
    5
    down vote













    You can use the DeclarePairedDelimiterXPPfrom mathtools. It will define Reand Im commands, which have a star version (adds a pair of implicit left right in front of the delimiters), but they also accept an optional argument among big, Big, bigg and Bigg, which adds a pair oof implicit bigl bigr, &c.



    documentclass[10pt]{article}
    usepackage{mathtools} %
    letReundefined
    letImundefined
    DeclarePairedDelimiterXPPRe[1]{operatorname{Re}}{lbrace}{rbrace}{}{#1}
    DeclarePairedDelimiterXPPIm[1]{operatorname{Im}}{lbrace}{rbrace}{}{#1}

    begin{document}

    [ Re*{frac{z-1}{z + 1}}qquad Im[Big]{frac{z-1}{z + 1}} ]%

    end{document}


    enter image description here






    share|improve this answer























    • Wouldn't operator name be better for Re and Im, then 2Re looks right again. Re and Im are math operators after all
      – daleif
      Nov 29 at 8:32






    • 1




      @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
      – Bernard
      Nov 29 at 9:10











    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',
    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462264%2fmake-paired-delimiter-with-prefix-for-re-and-im%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    5
    down vote



    accepted










    You have the incorrect syntax for newcommand.



    newcommand{Re}{1}


    should be



    newcommand{Re}[1]





    share|improve this answer

























      up vote
      5
      down vote



      accepted










      You have the incorrect syntax for newcommand.



      newcommand{Re}{1}


      should be



      newcommand{Re}[1]





      share|improve this answer























        up vote
        5
        down vote



        accepted







        up vote
        5
        down vote



        accepted






        You have the incorrect syntax for newcommand.



        newcommand{Re}{1}


        should be



        newcommand{Re}[1]





        share|improve this answer












        You have the incorrect syntax for newcommand.



        newcommand{Re}{1}


        should be



        newcommand{Re}[1]






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 28 at 22:08









        David Carlisle

        479k3811121845




        479k3811121845






















            up vote
            5
            down vote













            You can use the DeclarePairedDelimiterXPPfrom mathtools. It will define Reand Im commands, which have a star version (adds a pair of implicit left right in front of the delimiters), but they also accept an optional argument among big, Big, bigg and Bigg, which adds a pair oof implicit bigl bigr, &c.



            documentclass[10pt]{article}
            usepackage{mathtools} %
            letReundefined
            letImundefined
            DeclarePairedDelimiterXPPRe[1]{operatorname{Re}}{lbrace}{rbrace}{}{#1}
            DeclarePairedDelimiterXPPIm[1]{operatorname{Im}}{lbrace}{rbrace}{}{#1}

            begin{document}

            [ Re*{frac{z-1}{z + 1}}qquad Im[Big]{frac{z-1}{z + 1}} ]%

            end{document}


            enter image description here






            share|improve this answer























            • Wouldn't operator name be better for Re and Im, then 2Re looks right again. Re and Im are math operators after all
              – daleif
              Nov 29 at 8:32






            • 1




              @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
              – Bernard
              Nov 29 at 9:10















            up vote
            5
            down vote













            You can use the DeclarePairedDelimiterXPPfrom mathtools. It will define Reand Im commands, which have a star version (adds a pair of implicit left right in front of the delimiters), but they also accept an optional argument among big, Big, bigg and Bigg, which adds a pair oof implicit bigl bigr, &c.



            documentclass[10pt]{article}
            usepackage{mathtools} %
            letReundefined
            letImundefined
            DeclarePairedDelimiterXPPRe[1]{operatorname{Re}}{lbrace}{rbrace}{}{#1}
            DeclarePairedDelimiterXPPIm[1]{operatorname{Im}}{lbrace}{rbrace}{}{#1}

            begin{document}

            [ Re*{frac{z-1}{z + 1}}qquad Im[Big]{frac{z-1}{z + 1}} ]%

            end{document}


            enter image description here






            share|improve this answer























            • Wouldn't operator name be better for Re and Im, then 2Re looks right again. Re and Im are math operators after all
              – daleif
              Nov 29 at 8:32






            • 1




              @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
              – Bernard
              Nov 29 at 9:10













            up vote
            5
            down vote










            up vote
            5
            down vote









            You can use the DeclarePairedDelimiterXPPfrom mathtools. It will define Reand Im commands, which have a star version (adds a pair of implicit left right in front of the delimiters), but they also accept an optional argument among big, Big, bigg and Bigg, which adds a pair oof implicit bigl bigr, &c.



            documentclass[10pt]{article}
            usepackage{mathtools} %
            letReundefined
            letImundefined
            DeclarePairedDelimiterXPPRe[1]{operatorname{Re}}{lbrace}{rbrace}{}{#1}
            DeclarePairedDelimiterXPPIm[1]{operatorname{Im}}{lbrace}{rbrace}{}{#1}

            begin{document}

            [ Re*{frac{z-1}{z + 1}}qquad Im[Big]{frac{z-1}{z + 1}} ]%

            end{document}


            enter image description here






            share|improve this answer














            You can use the DeclarePairedDelimiterXPPfrom mathtools. It will define Reand Im commands, which have a star version (adds a pair of implicit left right in front of the delimiters), but they also accept an optional argument among big, Big, bigg and Bigg, which adds a pair oof implicit bigl bigr, &c.



            documentclass[10pt]{article}
            usepackage{mathtools} %
            letReundefined
            letImundefined
            DeclarePairedDelimiterXPPRe[1]{operatorname{Re}}{lbrace}{rbrace}{}{#1}
            DeclarePairedDelimiterXPPIm[1]{operatorname{Im}}{lbrace}{rbrace}{}{#1}

            begin{document}

            [ Re*{frac{z-1}{z + 1}}qquad Im[Big]{frac{z-1}{z + 1}} ]%

            end{document}


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 29 at 9:07

























            answered Nov 28 at 22:36









            Bernard

            163k769192




            163k769192












            • Wouldn't operator name be better for Re and Im, then 2Re looks right again. Re and Im are math operators after all
              – daleif
              Nov 29 at 8:32






            • 1




              @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
              – Bernard
              Nov 29 at 9:10


















            • Wouldn't operator name be better for Re and Im, then 2Re looks right again. Re and Im are math operators after all
              – daleif
              Nov 29 at 8:32






            • 1




              @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
              – Bernard
              Nov 29 at 9:10
















            Wouldn't operator name be better for Re and Im, then 2Re looks right again. Re and Im are math operators after all
            – daleif
            Nov 29 at 8:32




            Wouldn't operator name be better for Re and Im, then 2Re looks right again. Re and Im are math operators after all
            – daleif
            Nov 29 at 8:32




            1




            1




            @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
            – Bernard
            Nov 29 at 9:10




            @daleif: You're right. I didn't think of testing this. I've fixed the code. Thanks!
            – Bernard
            Nov 29 at 9:10


















            draft saved

            draft discarded




















































            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%2f462264%2fmake-paired-delimiter-with-prefix-for-re-and-im%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

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents