left and right not working on parentheses within the same line when internal fractions are changed

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
10
down vote

favorite












I'm trying to show the product of two Legendre symbols. When I compile the following



documentclassarticle
begindocument
$$left(fracxpright) left(fracxpright)$$
enddocument


it yields





as expected. However, when I switch the variables, i.e.



documentclassarticle
begindocument
$$left(fracxpright)left(fracpxright)$$
enddocument


it yields



enter image description here



How do I resolve this? Why do the values within the fractions matter?










share|improve this question

















  • 1




    The double signs of $$ it is a old syntax. You should must [...].
    – Sebastiano
    Nov 24 at 19:30














up vote
10
down vote

favorite












I'm trying to show the product of two Legendre symbols. When I compile the following



documentclassarticle
begindocument
$$left(fracxpright) left(fracxpright)$$
enddocument


it yields





as expected. However, when I switch the variables, i.e.



documentclassarticle
begindocument
$$left(fracxpright)left(fracpxright)$$
enddocument


it yields



enter image description here



How do I resolve this? Why do the values within the fractions matter?










share|improve this question

















  • 1




    The double signs of $$ it is a old syntax. You should must [...].
    – Sebastiano
    Nov 24 at 19:30












up vote
10
down vote

favorite









up vote
10
down vote

favorite











I'm trying to show the product of two Legendre symbols. When I compile the following



documentclassarticle
begindocument
$$left(fracxpright) left(fracxpright)$$
enddocument


it yields





as expected. However, when I switch the variables, i.e.



documentclassarticle
begindocument
$$left(fracxpright)left(fracpxright)$$
enddocument


it yields



enter image description here



How do I resolve this? Why do the values within the fractions matter?










share|improve this question













I'm trying to show the product of two Legendre symbols. When I compile the following



documentclassarticle
begindocument
$$left(fracxpright) left(fracxpright)$$
enddocument


it yields





as expected. However, when I switch the variables, i.e.



documentclassarticle
begindocument
$$left(fracxpright)left(fracpxright)$$
enddocument


it yields



enter image description here



How do I resolve this? Why do the values within the fractions matter?







math-mode






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 at 16:55









Antoine Ego

937




937







  • 1




    The double signs of $$ it is a old syntax. You should must [...].
    – Sebastiano
    Nov 24 at 19:30












  • 1




    The double signs of $$ it is a old syntax. You should must [...].
    – Sebastiano
    Nov 24 at 19:30







1




1




The double signs of $$ it is a old syntax. You should must [...].
– Sebastiano
Nov 24 at 19:30




The double signs of $$ it is a old syntax. You should must [...].
– Sebastiano
Nov 24 at 19:30










3 Answers
3






active

oldest

votes

















up vote
13
down vote



accepted










This is somewhat similar to this question.



The values in the fractions matter because the boxes of the characters have different sizes. The p has a descender below the baseline which the x doesn't, thus when you swap them, the box of the denominator get a little bigger and TeX uses a larger delimiter to make that fit.



You have a few possibilities to work around that (basically the same ones I listed in the linked question):




  • You can use a fixed delimiter size (bigg or Big, for instance):



    $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
    $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$



  • You can raise the p so that TeX won't try to use a larger box:



    $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$



  • or you can add an invisible p next to the x so that the delimiter used will be the larger one:



    $$left(fracxpright)left(fracpvphantompxright)$$



  • Or you can change change TeX's delimiterfactor (and delimitershortfall, which I didn't show here) and let TeX adjust the delimiters accordingly:



    $$delimiterfactor=790
    left(fracxpright)left(fracpxright)$$

    $$delimiterfactor=970
    left(fracxpright)left(fracpxright)$$


Full code:



documentclassarticle
begindocument
% delimitershortfall=5pt % Default
% delimiterfactor=901 % Default

$$left(fracxpright)left(fracpxright)$$

$$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
$$biggl(fracxpbiggr)biggl(fracpxbiggr)$$

$$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$

$$left(fracxpright)left(fracpvphantompxright)$$

$$delimiterfactor=790
left(fracxpright)left(fracpxright)$$

$$delimiterfactor=970
left(fracxpright)left(fracpxright)$$
enddocument


Output:




enter image description here







share|improve this answer



























    up vote
    9
    down vote













    Use genfrac for this:



    documentclassarticle
    usepackageamsmath

    newcommandgenlegendre[3]genfrac()#1#2#3
    newcommandlegendre[2]genlegendre#1#2
    newcommanddlegendre[2]genlegendre0#1#2
    newcommandtlegendre[2]genlegendre1#1#2

    begindocument

    [
    legendrexpquadlegendrepxquad
    legendrexxquadlegendredb
    ]

    enddocument


    enter image description here



    The variants dlegendre and tlegendre are analogous to dfrac and tfrac.






    share|improve this answer




















    • I've never heard of tfrac, what's the package that defines it?
      – AndréC
      Nov 24 at 22:14






    • 1




      @AndréC amsmath, along with dfrac; also binom, dbinom and tbinom. In some cases, in displays tfrac is needed not to give prominence to fractional factors.
      – egreg
      Nov 24 at 22:24


















    up vote
    0
    down vote













    I like the unified syntax for this kind of stuff in the mathtools package.



    documentclassarticle

    usepackagemathtools
    DeclarePairedDelimiterparenlparenrparen

    begindocument

    beginequation*
    paren*fracxp quad paren*fracpx
    qquad
    paren[bigg]fracxp quad paren[bigg]fracpx
    endequation*

    enddocument


    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',
      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%2f461582%2fleft-and-right-not-working-on-parentheses-within-the-same-line-when-internal-f%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      13
      down vote



      accepted










      This is somewhat similar to this question.



      The values in the fractions matter because the boxes of the characters have different sizes. The p has a descender below the baseline which the x doesn't, thus when you swap them, the box of the denominator get a little bigger and TeX uses a larger delimiter to make that fit.



      You have a few possibilities to work around that (basically the same ones I listed in the linked question):




      • You can use a fixed delimiter size (bigg or Big, for instance):



        $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
        $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$



      • You can raise the p so that TeX won't try to use a larger box:



        $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$



      • or you can add an invisible p next to the x so that the delimiter used will be the larger one:



        $$left(fracxpright)left(fracpvphantompxright)$$



      • Or you can change change TeX's delimiterfactor (and delimitershortfall, which I didn't show here) and let TeX adjust the delimiters accordingly:



        $$delimiterfactor=790
        left(fracxpright)left(fracpxright)$$

        $$delimiterfactor=970
        left(fracxpright)left(fracpxright)$$


      Full code:



      documentclassarticle
      begindocument
      % delimitershortfall=5pt % Default
      % delimiterfactor=901 % Default

      $$left(fracxpright)left(fracpxright)$$

      $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
      $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$

      $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$

      $$left(fracxpright)left(fracpvphantompxright)$$

      $$delimiterfactor=790
      left(fracxpright)left(fracpxright)$$

      $$delimiterfactor=970
      left(fracxpright)left(fracpxright)$$
      enddocument


      Output:




      enter image description here







      share|improve this answer
























        up vote
        13
        down vote



        accepted










        This is somewhat similar to this question.



        The values in the fractions matter because the boxes of the characters have different sizes. The p has a descender below the baseline which the x doesn't, thus when you swap them, the box of the denominator get a little bigger and TeX uses a larger delimiter to make that fit.



        You have a few possibilities to work around that (basically the same ones I listed in the linked question):




        • You can use a fixed delimiter size (bigg or Big, for instance):



          $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
          $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$



        • You can raise the p so that TeX won't try to use a larger box:



          $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$



        • or you can add an invisible p next to the x so that the delimiter used will be the larger one:



          $$left(fracxpright)left(fracpvphantompxright)$$



        • Or you can change change TeX's delimiterfactor (and delimitershortfall, which I didn't show here) and let TeX adjust the delimiters accordingly:



          $$delimiterfactor=790
          left(fracxpright)left(fracpxright)$$

          $$delimiterfactor=970
          left(fracxpright)left(fracpxright)$$


        Full code:



        documentclassarticle
        begindocument
        % delimitershortfall=5pt % Default
        % delimiterfactor=901 % Default

        $$left(fracxpright)left(fracpxright)$$

        $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
        $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$

        $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$

        $$left(fracxpright)left(fracpvphantompxright)$$

        $$delimiterfactor=790
        left(fracxpright)left(fracpxright)$$

        $$delimiterfactor=970
        left(fracxpright)left(fracpxright)$$
        enddocument


        Output:




        enter image description here







        share|improve this answer






















          up vote
          13
          down vote



          accepted







          up vote
          13
          down vote



          accepted






          This is somewhat similar to this question.



          The values in the fractions matter because the boxes of the characters have different sizes. The p has a descender below the baseline which the x doesn't, thus when you swap them, the box of the denominator get a little bigger and TeX uses a larger delimiter to make that fit.



          You have a few possibilities to work around that (basically the same ones I listed in the linked question):




          • You can use a fixed delimiter size (bigg or Big, for instance):



            $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
            $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$



          • You can raise the p so that TeX won't try to use a larger box:



            $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$



          • or you can add an invisible p next to the x so that the delimiter used will be the larger one:



            $$left(fracxpright)left(fracpvphantompxright)$$



          • Or you can change change TeX's delimiterfactor (and delimitershortfall, which I didn't show here) and let TeX adjust the delimiters accordingly:



            $$delimiterfactor=790
            left(fracxpright)left(fracpxright)$$

            $$delimiterfactor=970
            left(fracxpright)left(fracpxright)$$


          Full code:



          documentclassarticle
          begindocument
          % delimitershortfall=5pt % Default
          % delimiterfactor=901 % Default

          $$left(fracxpright)left(fracpxright)$$

          $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
          $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$

          $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$

          $$left(fracxpright)left(fracpvphantompxright)$$

          $$delimiterfactor=790
          left(fracxpright)left(fracpxright)$$

          $$delimiterfactor=970
          left(fracxpright)left(fracpxright)$$
          enddocument


          Output:




          enter image description here







          share|improve this answer












          This is somewhat similar to this question.



          The values in the fractions matter because the boxes of the characters have different sizes. The p has a descender below the baseline which the x doesn't, thus when you swap them, the box of the denominator get a little bigger and TeX uses a larger delimiter to make that fit.



          You have a few possibilities to work around that (basically the same ones I listed in the linked question):




          • You can use a fixed delimiter size (bigg or Big, for instance):



            $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
            $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$



          • You can raise the p so that TeX won't try to use a larger box:



            $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$



          • or you can add an invisible p next to the x so that the delimiter used will be the larger one:



            $$left(fracxpright)left(fracpvphantompxright)$$



          • Or you can change change TeX's delimiterfactor (and delimitershortfall, which I didn't show here) and let TeX adjust the delimiters accordingly:



            $$delimiterfactor=790
            left(fracxpright)left(fracpxright)$$

            $$delimiterfactor=970
            left(fracxpright)left(fracpxright)$$


          Full code:



          documentclassarticle
          begindocument
          % delimitershortfall=5pt % Default
          % delimiterfactor=901 % Default

          $$left(fracxpright)left(fracpxright)$$

          $$Bigl(fracxpBigr)Bigl(fracpxBigr)$$
          $$biggl(fracxpbiggr)biggl(fracpxbiggr)$$

          $$left(fracxraise0.35exhbox$p$right)left(fracpxright)$$

          $$left(fracxpright)left(fracpvphantompxright)$$

          $$delimiterfactor=790
          left(fracxpright)left(fracpxright)$$

          $$delimiterfactor=970
          left(fracxpright)left(fracpxright)$$
          enddocument


          Output:




          enter image description here








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 24 at 17:16









          Phelype Oleinik

          20.9k54380




          20.9k54380




















              up vote
              9
              down vote













              Use genfrac for this:



              documentclassarticle
              usepackageamsmath

              newcommandgenlegendre[3]genfrac()#1#2#3
              newcommandlegendre[2]genlegendre#1#2
              newcommanddlegendre[2]genlegendre0#1#2
              newcommandtlegendre[2]genlegendre1#1#2

              begindocument

              [
              legendrexpquadlegendrepxquad
              legendrexxquadlegendredb
              ]

              enddocument


              enter image description here



              The variants dlegendre and tlegendre are analogous to dfrac and tfrac.






              share|improve this answer




















              • I've never heard of tfrac, what's the package that defines it?
                – AndréC
                Nov 24 at 22:14






              • 1




                @AndréC amsmath, along with dfrac; also binom, dbinom and tbinom. In some cases, in displays tfrac is needed not to give prominence to fractional factors.
                – egreg
                Nov 24 at 22:24















              up vote
              9
              down vote













              Use genfrac for this:



              documentclassarticle
              usepackageamsmath

              newcommandgenlegendre[3]genfrac()#1#2#3
              newcommandlegendre[2]genlegendre#1#2
              newcommanddlegendre[2]genlegendre0#1#2
              newcommandtlegendre[2]genlegendre1#1#2

              begindocument

              [
              legendrexpquadlegendrepxquad
              legendrexxquadlegendredb
              ]

              enddocument


              enter image description here



              The variants dlegendre and tlegendre are analogous to dfrac and tfrac.






              share|improve this answer




















              • I've never heard of tfrac, what's the package that defines it?
                – AndréC
                Nov 24 at 22:14






              • 1




                @AndréC amsmath, along with dfrac; also binom, dbinom and tbinom. In some cases, in displays tfrac is needed not to give prominence to fractional factors.
                – egreg
                Nov 24 at 22:24













              up vote
              9
              down vote










              up vote
              9
              down vote









              Use genfrac for this:



              documentclassarticle
              usepackageamsmath

              newcommandgenlegendre[3]genfrac()#1#2#3
              newcommandlegendre[2]genlegendre#1#2
              newcommanddlegendre[2]genlegendre0#1#2
              newcommandtlegendre[2]genlegendre1#1#2

              begindocument

              [
              legendrexpquadlegendrepxquad
              legendrexxquadlegendredb
              ]

              enddocument


              enter image description here



              The variants dlegendre and tlegendre are analogous to dfrac and tfrac.






              share|improve this answer












              Use genfrac for this:



              documentclassarticle
              usepackageamsmath

              newcommandgenlegendre[3]genfrac()#1#2#3
              newcommandlegendre[2]genlegendre#1#2
              newcommanddlegendre[2]genlegendre0#1#2
              newcommandtlegendre[2]genlegendre1#1#2

              begindocument

              [
              legendrexpquadlegendrepxquad
              legendrexxquadlegendredb
              ]

              enddocument


              enter image description here



              The variants dlegendre and tlegendre are analogous to dfrac and tfrac.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 24 at 22:09









              egreg

              701k8618693142




              701k8618693142











              • I've never heard of tfrac, what's the package that defines it?
                – AndréC
                Nov 24 at 22:14






              • 1




                @AndréC amsmath, along with dfrac; also binom, dbinom and tbinom. In some cases, in displays tfrac is needed not to give prominence to fractional factors.
                – egreg
                Nov 24 at 22:24

















              • I've never heard of tfrac, what's the package that defines it?
                – AndréC
                Nov 24 at 22:14






              • 1




                @AndréC amsmath, along with dfrac; also binom, dbinom and tbinom. In some cases, in displays tfrac is needed not to give prominence to fractional factors.
                – egreg
                Nov 24 at 22:24
















              I've never heard of tfrac, what's the package that defines it?
              – AndréC
              Nov 24 at 22:14




              I've never heard of tfrac, what's the package that defines it?
              – AndréC
              Nov 24 at 22:14




              1




              1




              @AndréC amsmath, along with dfrac; also binom, dbinom and tbinom. In some cases, in displays tfrac is needed not to give prominence to fractional factors.
              – egreg
              Nov 24 at 22:24





              @AndréC amsmath, along with dfrac; also binom, dbinom and tbinom. In some cases, in displays tfrac is needed not to give prominence to fractional factors.
              – egreg
              Nov 24 at 22:24











              up vote
              0
              down vote













              I like the unified syntax for this kind of stuff in the mathtools package.



              documentclassarticle

              usepackagemathtools
              DeclarePairedDelimiterparenlparenrparen

              begindocument

              beginequation*
              paren*fracxp quad paren*fracpx
              qquad
              paren[bigg]fracxp quad paren[bigg]fracpx
              endequation*

              enddocument


              enter image description here






              share|improve this answer
























                up vote
                0
                down vote













                I like the unified syntax for this kind of stuff in the mathtools package.



                documentclassarticle

                usepackagemathtools
                DeclarePairedDelimiterparenlparenrparen

                begindocument

                beginequation*
                paren*fracxp quad paren*fracpx
                qquad
                paren[bigg]fracxp quad paren[bigg]fracpx
                endequation*

                enddocument


                enter image description here






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  I like the unified syntax for this kind of stuff in the mathtools package.



                  documentclassarticle

                  usepackagemathtools
                  DeclarePairedDelimiterparenlparenrparen

                  begindocument

                  beginequation*
                  paren*fracxp quad paren*fracpx
                  qquad
                  paren[bigg]fracxp quad paren[bigg]fracpx
                  endequation*

                  enddocument


                  enter image description here






                  share|improve this answer












                  I like the unified syntax for this kind of stuff in the mathtools package.



                  documentclassarticle

                  usepackagemathtools
                  DeclarePairedDelimiterparenlparenrparen

                  begindocument

                  beginequation*
                  paren*fracxp quad paren*fracpx
                  qquad
                  paren[bigg]fracxp quad paren[bigg]fracpx
                  endequation*

                  enddocument


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 27 at 21:29









                  Máté Wierdl

                  36918




                  36918



























                      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%2f461582%2fleft-and-right-not-working-on-parentheses-within-the-same-line-when-internal-f%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 check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay