Partial derivative command with Deltas in line












3















I would like to create a new command for partial derivatives. I have something like this in mind:



newcommand{deriv}[2]{frac{partial #1}{partial #2}}


However, the partial commands are unfortunately not horizontally aligned, if I have e.g something like:



deriv{x^alpha}{t},


i.e. if argument #1 has a wider horizontal extent as argument #2. How can I enforce that the partial commands are always horizontally aligned?










share|improve this question




















  • 1





    I am pretty sure, the usual suspects will show up with esdiff solutions etc. ;-)

    – Christian Hupfer
    Jul 29 '17 at 21:49











  • @egreg I want a horizontal slash, accordingly / does not suit well for me.

    – DonkeyKong
    Jul 29 '17 at 22:06






  • 2





    Like @JohnKormylo, I suspect that, when you say “in line”, you actually mean “vertically aligned” (like what you would get from, say, newcommand*{deriv}[2]{frac{partial #1}{partial #2hfill}}).

    – GuM
    Jul 29 '17 at 22:41








  • 2





    @GuM - You could add another hfill to the top, just in case.

    – John Kormylo
    Jul 29 '17 at 22:46
















3















I would like to create a new command for partial derivatives. I have something like this in mind:



newcommand{deriv}[2]{frac{partial #1}{partial #2}}


However, the partial commands are unfortunately not horizontally aligned, if I have e.g something like:



deriv{x^alpha}{t},


i.e. if argument #1 has a wider horizontal extent as argument #2. How can I enforce that the partial commands are always horizontally aligned?










share|improve this question




















  • 1





    I am pretty sure, the usual suspects will show up with esdiff solutions etc. ;-)

    – Christian Hupfer
    Jul 29 '17 at 21:49











  • @egreg I want a horizontal slash, accordingly / does not suit well for me.

    – DonkeyKong
    Jul 29 '17 at 22:06






  • 2





    Like @JohnKormylo, I suspect that, when you say “in line”, you actually mean “vertically aligned” (like what you would get from, say, newcommand*{deriv}[2]{frac{partial #1}{partial #2hfill}}).

    – GuM
    Jul 29 '17 at 22:41








  • 2





    @GuM - You could add another hfill to the top, just in case.

    – John Kormylo
    Jul 29 '17 at 22:46














3












3








3


1






I would like to create a new command for partial derivatives. I have something like this in mind:



newcommand{deriv}[2]{frac{partial #1}{partial #2}}


However, the partial commands are unfortunately not horizontally aligned, if I have e.g something like:



deriv{x^alpha}{t},


i.e. if argument #1 has a wider horizontal extent as argument #2. How can I enforce that the partial commands are always horizontally aligned?










share|improve this question
















I would like to create a new command for partial derivatives. I have something like this in mind:



newcommand{deriv}[2]{frac{partial #1}{partial #2}}


However, the partial commands are unfortunately not horizontally aligned, if I have e.g something like:



deriv{x^alpha}{t},


i.e. if argument #1 has a wider horizontal extent as argument #2. How can I enforce that the partial commands are always horizontally aligned?







math-mode horizontal-alignment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 30 '17 at 12:55









Werner

446k699871692




446k699871692










asked Jul 29 '17 at 21:27









DonkeyKongDonkeyKong

587




587








  • 1





    I am pretty sure, the usual suspects will show up with esdiff solutions etc. ;-)

    – Christian Hupfer
    Jul 29 '17 at 21:49











  • @egreg I want a horizontal slash, accordingly / does not suit well for me.

    – DonkeyKong
    Jul 29 '17 at 22:06






  • 2





    Like @JohnKormylo, I suspect that, when you say “in line”, you actually mean “vertically aligned” (like what you would get from, say, newcommand*{deriv}[2]{frac{partial #1}{partial #2hfill}}).

    – GuM
    Jul 29 '17 at 22:41








  • 2





    @GuM - You could add another hfill to the top, just in case.

    – John Kormylo
    Jul 29 '17 at 22:46














  • 1





    I am pretty sure, the usual suspects will show up with esdiff solutions etc. ;-)

    – Christian Hupfer
    Jul 29 '17 at 21:49











  • @egreg I want a horizontal slash, accordingly / does not suit well for me.

    – DonkeyKong
    Jul 29 '17 at 22:06






  • 2





    Like @JohnKormylo, I suspect that, when you say “in line”, you actually mean “vertically aligned” (like what you would get from, say, newcommand*{deriv}[2]{frac{partial #1}{partial #2hfill}}).

    – GuM
    Jul 29 '17 at 22:41








  • 2





    @GuM - You could add another hfill to the top, just in case.

    – John Kormylo
    Jul 29 '17 at 22:46








1




1





I am pretty sure, the usual suspects will show up with esdiff solutions etc. ;-)

– Christian Hupfer
Jul 29 '17 at 21:49





I am pretty sure, the usual suspects will show up with esdiff solutions etc. ;-)

– Christian Hupfer
Jul 29 '17 at 21:49













@egreg I want a horizontal slash, accordingly / does not suit well for me.

– DonkeyKong
Jul 29 '17 at 22:06





@egreg I want a horizontal slash, accordingly / does not suit well for me.

– DonkeyKong
Jul 29 '17 at 22:06




2




2





Like @JohnKormylo, I suspect that, when you say “in line”, you actually mean “vertically aligned” (like what you would get from, say, newcommand*{deriv}[2]{frac{partial #1}{partial #2hfill}}).

– GuM
Jul 29 '17 at 22:41







Like @JohnKormylo, I suspect that, when you say “in line”, you actually mean “vertically aligned” (like what you would get from, say, newcommand*{deriv}[2]{frac{partial #1}{partial #2hfill}}).

– GuM
Jul 29 '17 at 22:41






2




2





@GuM - You could add another hfill to the top, just in case.

– John Kormylo
Jul 29 '17 at 22:46





@GuM - You could add another hfill to the top, just in case.

– John Kormylo
Jul 29 '17 at 22:46










2 Answers
2






active

oldest

votes


















3














Set the numerator and denominator in a box of similar width and ensure they are both [l]eft-aligned. This is easily done using eqparbox and automated below to allow for any number of derivs (using a counter).



enter image description here



documentclass{article}

usepackage{eqparbox}

newcounter{derivcnt}
newcommand{deriv}[2]{%
stepcounter{derivcnt}%
frac
{eqmakebox[deriv-thederivcnt][l]{$partial #1$}}
{eqmakebox[deriv-thederivcnt][l]{$partial #2$}}}

begin{document}

[
deriv{a}{b} + deriv{abc}{d} - deriv{a}{bcd}
]

end{document}


Since this approach uses the .aux files to store the lengths of the boxes, multiple compilations are required with every change in the deriv content.






share|improve this answer































    1














    You can check the diffcoeff package. It has many ready to use commands for a variety of differential operators



    documentclass{article}
    usepackage{amsmath}
    usepackage{diffcoeff}
    begin{document}
    [ diff{y}{x} , diffp[2]{f}{t} , diffp{f}{x,y} ]
    end{document}


    enter image description here






    share|improve this answer


























    • I don't know this package, but I think it's not correctly made. For 2nd partial on should use different spacing like $partial^2!f$

      – Jan Filip
      Jul 30 '17 at 13:14











    • You are right I know what you mean. I don't think it will work like this.

      – mac
      Jul 30 '17 at 13:25











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


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f383913%2fpartial-derivative-command-with-deltas-in-line%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









    3














    Set the numerator and denominator in a box of similar width and ensure they are both [l]eft-aligned. This is easily done using eqparbox and automated below to allow for any number of derivs (using a counter).



    enter image description here



    documentclass{article}

    usepackage{eqparbox}

    newcounter{derivcnt}
    newcommand{deriv}[2]{%
    stepcounter{derivcnt}%
    frac
    {eqmakebox[deriv-thederivcnt][l]{$partial #1$}}
    {eqmakebox[deriv-thederivcnt][l]{$partial #2$}}}

    begin{document}

    [
    deriv{a}{b} + deriv{abc}{d} - deriv{a}{bcd}
    ]

    end{document}


    Since this approach uses the .aux files to store the lengths of the boxes, multiple compilations are required with every change in the deriv content.






    share|improve this answer




























      3














      Set the numerator and denominator in a box of similar width and ensure they are both [l]eft-aligned. This is easily done using eqparbox and automated below to allow for any number of derivs (using a counter).



      enter image description here



      documentclass{article}

      usepackage{eqparbox}

      newcounter{derivcnt}
      newcommand{deriv}[2]{%
      stepcounter{derivcnt}%
      frac
      {eqmakebox[deriv-thederivcnt][l]{$partial #1$}}
      {eqmakebox[deriv-thederivcnt][l]{$partial #2$}}}

      begin{document}

      [
      deriv{a}{b} + deriv{abc}{d} - deriv{a}{bcd}
      ]

      end{document}


      Since this approach uses the .aux files to store the lengths of the boxes, multiple compilations are required with every change in the deriv content.






      share|improve this answer


























        3












        3








        3







        Set the numerator and denominator in a box of similar width and ensure they are both [l]eft-aligned. This is easily done using eqparbox and automated below to allow for any number of derivs (using a counter).



        enter image description here



        documentclass{article}

        usepackage{eqparbox}

        newcounter{derivcnt}
        newcommand{deriv}[2]{%
        stepcounter{derivcnt}%
        frac
        {eqmakebox[deriv-thederivcnt][l]{$partial #1$}}
        {eqmakebox[deriv-thederivcnt][l]{$partial #2$}}}

        begin{document}

        [
        deriv{a}{b} + deriv{abc}{d} - deriv{a}{bcd}
        ]

        end{document}


        Since this approach uses the .aux files to store the lengths of the boxes, multiple compilations are required with every change in the deriv content.






        share|improve this answer













        Set the numerator and denominator in a box of similar width and ensure they are both [l]eft-aligned. This is easily done using eqparbox and automated below to allow for any number of derivs (using a counter).



        enter image description here



        documentclass{article}

        usepackage{eqparbox}

        newcounter{derivcnt}
        newcommand{deriv}[2]{%
        stepcounter{derivcnt}%
        frac
        {eqmakebox[deriv-thederivcnt][l]{$partial #1$}}
        {eqmakebox[deriv-thederivcnt][l]{$partial #2$}}}

        begin{document}

        [
        deriv{a}{b} + deriv{abc}{d} - deriv{a}{bcd}
        ]

        end{document}


        Since this approach uses the .aux files to store the lengths of the boxes, multiple compilations are required with every change in the deriv content.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 30 '17 at 13:00









        WernerWerner

        446k699871692




        446k699871692























            1














            You can check the diffcoeff package. It has many ready to use commands for a variety of differential operators



            documentclass{article}
            usepackage{amsmath}
            usepackage{diffcoeff}
            begin{document}
            [ diff{y}{x} , diffp[2]{f}{t} , diffp{f}{x,y} ]
            end{document}


            enter image description here






            share|improve this answer


























            • I don't know this package, but I think it's not correctly made. For 2nd partial on should use different spacing like $partial^2!f$

              – Jan Filip
              Jul 30 '17 at 13:14











            • You are right I know what you mean. I don't think it will work like this.

              – mac
              Jul 30 '17 at 13:25
















            1














            You can check the diffcoeff package. It has many ready to use commands for a variety of differential operators



            documentclass{article}
            usepackage{amsmath}
            usepackage{diffcoeff}
            begin{document}
            [ diff{y}{x} , diffp[2]{f}{t} , diffp{f}{x,y} ]
            end{document}


            enter image description here






            share|improve this answer


























            • I don't know this package, but I think it's not correctly made. For 2nd partial on should use different spacing like $partial^2!f$

              – Jan Filip
              Jul 30 '17 at 13:14











            • You are right I know what you mean. I don't think it will work like this.

              – mac
              Jul 30 '17 at 13:25














            1












            1








            1







            You can check the diffcoeff package. It has many ready to use commands for a variety of differential operators



            documentclass{article}
            usepackage{amsmath}
            usepackage{diffcoeff}
            begin{document}
            [ diff{y}{x} , diffp[2]{f}{t} , diffp{f}{x,y} ]
            end{document}


            enter image description here






            share|improve this answer















            You can check the diffcoeff package. It has many ready to use commands for a variety of differential operators



            documentclass{article}
            usepackage{amsmath}
            usepackage{diffcoeff}
            begin{document}
            [ diff{y}{x} , diffp[2]{f}{t} , diffp{f}{x,y} ]
            end{document}


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 14 mins ago









            quark67

            19615




            19615










            answered Jul 30 '17 at 13:00









            macmac

            695716




            695716













            • I don't know this package, but I think it's not correctly made. For 2nd partial on should use different spacing like $partial^2!f$

              – Jan Filip
              Jul 30 '17 at 13:14











            • You are right I know what you mean. I don't think it will work like this.

              – mac
              Jul 30 '17 at 13:25



















            • I don't know this package, but I think it's not correctly made. For 2nd partial on should use different spacing like $partial^2!f$

              – Jan Filip
              Jul 30 '17 at 13:14











            • You are right I know what you mean. I don't think it will work like this.

              – mac
              Jul 30 '17 at 13:25

















            I don't know this package, but I think it's not correctly made. For 2nd partial on should use different spacing like $partial^2!f$

            – Jan Filip
            Jul 30 '17 at 13:14





            I don't know this package, but I think it's not correctly made. For 2nd partial on should use different spacing like $partial^2!f$

            – Jan Filip
            Jul 30 '17 at 13:14













            You are right I know what you mean. I don't think it will work like this.

            – mac
            Jul 30 '17 at 13:25





            You are right I know what you mean. I don't think it will work like this.

            – mac
            Jul 30 '17 at 13:25


















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f383913%2fpartial-derivative-command-with-deltas-in-line%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

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks