Short horizontal and vertical bar of same length in math

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











up vote
3
down vote

favorite












I want to mark a variable I with a short vertical or horizontal bar in order to relate it to something being vertical or horizontal in real life. For the vertical line, $I^shortmid$ (from amssymb) is looking very nicely, but I can't produce a horizontal line of equal length. I tried $I^rotatebox[origin=c]90$shortmid$$, however this makes the bar longer for reasons I don't understand:



unequally long bars



Taking a different symbol like I^- and I^text- produces ugly results as well. Can someone please explain what is happening inside the rotatebox and suggest a fix? I will also appreciate any alternative markup.










share|improve this question

























    up vote
    3
    down vote

    favorite












    I want to mark a variable I with a short vertical or horizontal bar in order to relate it to something being vertical or horizontal in real life. For the vertical line, $I^shortmid$ (from amssymb) is looking very nicely, but I can't produce a horizontal line of equal length. I tried $I^rotatebox[origin=c]90$shortmid$$, however this makes the bar longer for reasons I don't understand:



    unequally long bars



    Taking a different symbol like I^- and I^text- produces ugly results as well. Can someone please explain what is happening inside the rotatebox and suggest a fix? I will also appreciate any alternative markup.










    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I want to mark a variable I with a short vertical or horizontal bar in order to relate it to something being vertical or horizontal in real life. For the vertical line, $I^shortmid$ (from amssymb) is looking very nicely, but I can't produce a horizontal line of equal length. I tried $I^rotatebox[origin=c]90$shortmid$$, however this makes the bar longer for reasons I don't understand:



      unequally long bars



      Taking a different symbol like I^- and I^text- produces ugly results as well. Can someone please explain what is happening inside the rotatebox and suggest a fix? I will also appreciate any alternative markup.










      share|improve this question













      I want to mark a variable I with a short vertical or horizontal bar in order to relate it to something being vertical or horizontal in real life. For the vertical line, $I^shortmid$ (from amssymb) is looking very nicely, but I can't produce a horizontal line of equal length. I tried $I^rotatebox[origin=c]90$shortmid$$, however this makes the bar longer for reasons I don't understand:



      unequally long bars



      Taking a different symbol like I^- and I^text- produces ugly results as well. Can someone please explain what is happening inside the rotatebox and suggest a fix? I will also appreciate any alternative markup.







      math-mode amssymb






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 59 mins ago









      Eldrad

      604




      604




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          You need to take care of the current math style:



          documentclassarticle
          usepackageamsmath,amssymb,graphicx

          newcommandvrtshortmid
          makeatletter
          newcommandhrzmathpalettehrz@relax
          newcommandhrz@[2]%
          mspace-1mu%
          rotatebox[origin=c]90$m@th#1,vrt$%
          mspace-1mu%

          makeatother

          begindocument

          $I^hrz I^vrt$

          enddocument


          enter image description here






          share|improve this answer



























            up vote
            2
            down vote













            The reason why the rotated shortmid seems larger is because the default math size setting within rotatebox would be textstyle, while it should be scripstyle if you're using it in a superscript.



            You could try with the following definitions of vertical and horizontal:



            enter image description here



            documentclassarticle

            usepackageamssymb,graphicx

            newcommandhorizontal[1]%
            #1^rotatebox[origin=c]90$scriptstyleshortmid$

            newcommandvertical[1]%
            #1^shortmid


            begindocument

            $verticalI horizontalI$

            enddocument





            share|improve this answer




















            • Thank you for your explanation, now I understand what's going on. However, because @egreg proposed a more general solution and also took care of positioning, I accepted his answer.
              – Eldrad
              6 mins ago

















            up vote
            1
            down vote













            Preserves the proper math style.



            documentclassarticle
            usepackageamssymb,graphicx,scalerel
            newcommandvrtshortmid
            newcommandhrzThisStylerotatebox[origin=c]90$SavedStylevrt$
            begindocument
            $I^hrz I^vrt$

            $scriptstyle I^hrz I^vrt$
            enddocument


            enter image description here





            share




















              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%2f458521%2fshort-horizontal-and-vertical-bar-of-same-length-in-math%23new-answer', 'question_page');

              );

              Post as a guest






























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote



              accepted










              You need to take care of the current math style:



              documentclassarticle
              usepackageamsmath,amssymb,graphicx

              newcommandvrtshortmid
              makeatletter
              newcommandhrzmathpalettehrz@relax
              newcommandhrz@[2]%
              mspace-1mu%
              rotatebox[origin=c]90$m@th#1,vrt$%
              mspace-1mu%

              makeatother

              begindocument

              $I^hrz I^vrt$

              enddocument


              enter image description here






              share|improve this answer
























                up vote
                3
                down vote



                accepted










                You need to take care of the current math style:



                documentclassarticle
                usepackageamsmath,amssymb,graphicx

                newcommandvrtshortmid
                makeatletter
                newcommandhrzmathpalettehrz@relax
                newcommandhrz@[2]%
                mspace-1mu%
                rotatebox[origin=c]90$m@th#1,vrt$%
                mspace-1mu%

                makeatother

                begindocument

                $I^hrz I^vrt$

                enddocument


                enter image description here






                share|improve this answer






















                  up vote
                  3
                  down vote



                  accepted







                  up vote
                  3
                  down vote



                  accepted






                  You need to take care of the current math style:



                  documentclassarticle
                  usepackageamsmath,amssymb,graphicx

                  newcommandvrtshortmid
                  makeatletter
                  newcommandhrzmathpalettehrz@relax
                  newcommandhrz@[2]%
                  mspace-1mu%
                  rotatebox[origin=c]90$m@th#1,vrt$%
                  mspace-1mu%

                  makeatother

                  begindocument

                  $I^hrz I^vrt$

                  enddocument


                  enter image description here






                  share|improve this answer












                  You need to take care of the current math style:



                  documentclassarticle
                  usepackageamsmath,amssymb,graphicx

                  newcommandvrtshortmid
                  makeatletter
                  newcommandhrzmathpalettehrz@relax
                  newcommandhrz@[2]%
                  mspace-1mu%
                  rotatebox[origin=c]90$m@th#1,vrt$%
                  mspace-1mu%

                  makeatother

                  begindocument

                  $I^hrz I^vrt$

                  enddocument


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 17 mins ago









                  egreg

                  694k8518443101




                  694k8518443101




















                      up vote
                      2
                      down vote













                      The reason why the rotated shortmid seems larger is because the default math size setting within rotatebox would be textstyle, while it should be scripstyle if you're using it in a superscript.



                      You could try with the following definitions of vertical and horizontal:



                      enter image description here



                      documentclassarticle

                      usepackageamssymb,graphicx

                      newcommandhorizontal[1]%
                      #1^rotatebox[origin=c]90$scriptstyleshortmid$

                      newcommandvertical[1]%
                      #1^shortmid


                      begindocument

                      $verticalI horizontalI$

                      enddocument





                      share|improve this answer




















                      • Thank you for your explanation, now I understand what's going on. However, because @egreg proposed a more general solution and also took care of positioning, I accepted his answer.
                        – Eldrad
                        6 mins ago














                      up vote
                      2
                      down vote













                      The reason why the rotated shortmid seems larger is because the default math size setting within rotatebox would be textstyle, while it should be scripstyle if you're using it in a superscript.



                      You could try with the following definitions of vertical and horizontal:



                      enter image description here



                      documentclassarticle

                      usepackageamssymb,graphicx

                      newcommandhorizontal[1]%
                      #1^rotatebox[origin=c]90$scriptstyleshortmid$

                      newcommandvertical[1]%
                      #1^shortmid


                      begindocument

                      $verticalI horizontalI$

                      enddocument





                      share|improve this answer




















                      • Thank you for your explanation, now I understand what's going on. However, because @egreg proposed a more general solution and also took care of positioning, I accepted his answer.
                        – Eldrad
                        6 mins ago












                      up vote
                      2
                      down vote










                      up vote
                      2
                      down vote









                      The reason why the rotated shortmid seems larger is because the default math size setting within rotatebox would be textstyle, while it should be scripstyle if you're using it in a superscript.



                      You could try with the following definitions of vertical and horizontal:



                      enter image description here



                      documentclassarticle

                      usepackageamssymb,graphicx

                      newcommandhorizontal[1]%
                      #1^rotatebox[origin=c]90$scriptstyleshortmid$

                      newcommandvertical[1]%
                      #1^shortmid


                      begindocument

                      $verticalI horizontalI$

                      enddocument





                      share|improve this answer












                      The reason why the rotated shortmid seems larger is because the default math size setting within rotatebox would be textstyle, while it should be scripstyle if you're using it in a superscript.



                      You could try with the following definitions of vertical and horizontal:



                      enter image description here



                      documentclassarticle

                      usepackageamssymb,graphicx

                      newcommandhorizontal[1]%
                      #1^rotatebox[origin=c]90$scriptstyleshortmid$

                      newcommandvertical[1]%
                      #1^shortmid


                      begindocument

                      $verticalI horizontalI$

                      enddocument






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 45 mins ago









                      Werner

                      428k589381615




                      428k589381615











                      • Thank you for your explanation, now I understand what's going on. However, because @egreg proposed a more general solution and also took care of positioning, I accepted his answer.
                        – Eldrad
                        6 mins ago
















                      • Thank you for your explanation, now I understand what's going on. However, because @egreg proposed a more general solution and also took care of positioning, I accepted his answer.
                        – Eldrad
                        6 mins ago















                      Thank you for your explanation, now I understand what's going on. However, because @egreg proposed a more general solution and also took care of positioning, I accepted his answer.
                      – Eldrad
                      6 mins ago




                      Thank you for your explanation, now I understand what's going on. However, because @egreg proposed a more general solution and also took care of positioning, I accepted his answer.
                      – Eldrad
                      6 mins ago










                      up vote
                      1
                      down vote













                      Preserves the proper math style.



                      documentclassarticle
                      usepackageamssymb,graphicx,scalerel
                      newcommandvrtshortmid
                      newcommandhrzThisStylerotatebox[origin=c]90$SavedStylevrt$
                      begindocument
                      $I^hrz I^vrt$

                      $scriptstyle I^hrz I^vrt$
                      enddocument


                      enter image description here





                      share
























                        up vote
                        1
                        down vote













                        Preserves the proper math style.



                        documentclassarticle
                        usepackageamssymb,graphicx,scalerel
                        newcommandvrtshortmid
                        newcommandhrzThisStylerotatebox[origin=c]90$SavedStylevrt$
                        begindocument
                        $I^hrz I^vrt$

                        $scriptstyle I^hrz I^vrt$
                        enddocument


                        enter image description here





                        share






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          Preserves the proper math style.



                          documentclassarticle
                          usepackageamssymb,graphicx,scalerel
                          newcommandvrtshortmid
                          newcommandhrzThisStylerotatebox[origin=c]90$SavedStylevrt$
                          begindocument
                          $I^hrz I^vrt$

                          $scriptstyle I^hrz I^vrt$
                          enddocument


                          enter image description here





                          share












                          Preserves the proper math style.



                          documentclassarticle
                          usepackageamssymb,graphicx,scalerel
                          newcommandvrtshortmid
                          newcommandhrzThisStylerotatebox[origin=c]90$SavedStylevrt$
                          begindocument
                          $I^hrz I^vrt$

                          $scriptstyle I^hrz I^vrt$
                          enddocument


                          enter image description here






                          share











                          share


                          share










                          answered 6 mins ago









                          Steven B. Segletes

                          150k9188396




                          150k9188396



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458521%2fshort-horizontal-and-vertical-bar-of-same-length-in-math%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              Installing NextGIS Connect into QGIS 3?

                              One-line joke