Underscript, subscript and superscript add the same time possibly via mathoperator* without trailing space












1















I have a symbol, which I want to give a underscipt, subscript and superscript.



I tried:



DeclareMathOperator*{wmat}{w}
wmat_2_i^j


But now I get a space between my symbol and the sub and superscript. Can this space be removed?



Or if someone knows a different method without any use of DeclareMathOperator: you are more than welcome.



N.B. I tried many other things, with worse result.










share|improve this question





























    1















    I have a symbol, which I want to give a underscipt, subscript and superscript.



    I tried:



    DeclareMathOperator*{wmat}{w}
    wmat_2_i^j


    But now I get a space between my symbol and the sub and superscript. Can this space be removed?



    Or if someone knows a different method without any use of DeclareMathOperator: you are more than welcome.



    N.B. I tried many other things, with worse result.










    share|improve this question



























      1












      1








      1


      0






      I have a symbol, which I want to give a underscipt, subscript and superscript.



      I tried:



      DeclareMathOperator*{wmat}{w}
      wmat_2_i^j


      But now I get a space between my symbol and the sub and superscript. Can this space be removed?



      Or if someone knows a different method without any use of DeclareMathOperator: you are more than welcome.



      N.B. I tried many other things, with worse result.










      share|improve this question
















      I have a symbol, which I want to give a underscipt, subscript and superscript.



      I tried:



      DeclareMathOperator*{wmat}{w}
      wmat_2_i^j


      But now I get a space between my symbol and the sub and superscript. Can this space be removed?



      Or if someone knows a different method without any use of DeclareMathOperator: you are more than welcome.



      N.B. I tried many other things, with worse result.







      amsmath math-operators subscripts superscripts






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 28 at 21:36







      Jens Wagemaker

















      asked Jan 28 at 21:30









      Jens WagemakerJens Wagemaker

      1105




      1105






















          2 Answers
          2






          active

          oldest

          votes


















          2














          Here's my proposal:



          documentclass{article}
          usepackage{amsmath}

          makeatletter % access "private" commands
          newcommand{wmat}[1]{%
          mathop{wmat@falsemathpalettewmat@{#1}}%
          !%
          mathop{wmat@truemathpalettewmat@{#1}}%
          nolimits
          }
          newififwmat@
          newcommand{wmat@}[2]{%
          begingroup
          setboxz@=vtop{offinterlineskip
          ialign{%
          hfil$m@th##$hfilcr
          #1mathrm{w}cr
          noalign{kern1pt}
          scriptscriptstyle#2cr
          }%
          }%
          ifwmat@
          sboxtw@{$#1mathrm{w}$}%
          dpz@=dptw@
          boxz@
          else
          vrule height htz@ depth dpz@ width z@
          fi
          endgroup
          }

          begin{document}
          begin{center}
          fboxsep=0ptfboxrule=0.1pt
          $wmat[2]_i^j$ $scriptstylewmat[2]_i^j$ $scriptscriptstylewmat[2]_i^j$
          fbox{$wmat[2]_i^j$}
          end{center}
          [
          wmat[2]_i^j
          ]

          end{document}


          The centered subscript is always in scriptscriptstyle so as to avoid it making for bad spacing.



          enter image description here



          The strategy is to define a math operator that accepts an optional argument for the centered subscript. However, this subscript should not influence the vertical size of the ‘w’, in order that the standard subscript and superscript are set to the letter.



          So I typeset ‘w with the subscript’ twice, one with wmat@false and one with wmat@true. The first instance is used to make a phantom that has the same vertical size of ‘w with the subscript’, placed in a mathop atom of its own. The second instance is also typeset in a mathop atom; a ! between them removes the space that TeX adds between consecutive mathop atoms.



          I build a box containing ‘w with the subscript’ (details later); in the wmat@false case this is used to make a vertical rule as high and deep as the box, with zero width. This will reserve the needed vertical space but produce no visible output. In the wmat@true case the box is resized to have the same vertical dimensions as a plain ‘w’. This will be the last item that TeX will see and to which it will attach the _j^i items that follow.



          Now how's the box built? I found that using operatorname*{w}_2 places the subscript too far down below the ‘w’, so a different method is needed. I use the primitive TeX method for alignments. I open a vtop, that is a box containing vertical material, with the reference point given by the top item inside it (it will be mathrm{w}).



          Inside the vtop I build an ialign (a wrapper around halign with some initialization). This does a one column table, with no vertical space between rows (by offinterlineskip) except the explicitly added kern1pt. The top row contains, as said, mathrm{w} in the needed size (via mathpalette); the bottom row contains the subscript, always in scriptscriptstyle.



          The vtop is assigned to a box register, so it is possible to access its dimensions (for typesetting the zero width rule in the wmat@false case) or change them (for making it appear the same as ‘w’). Then the box is used in the wmat@true case).



          Information about halign is found in the TeXbook or in TeX by Topic.






          share|improve this answer


























          • I'm not a TeX expert (but I have started on Knuth's book). Could you explain line by line what is happening? In particular I don't understand the function of @, and the second empty pair of brackets in newcommand{wmat}[1]. Also it is not clear where xparse is used, because the documentations says it is a replacement for newcommand, but I still see newcommend.

            – Jens Wagemaker
            Jan 30 at 11:03













          • @JensWagemaker xparse is a relic of a previous attempt and is not needed here. I'll add some explanations. For the @, it is customary to use it in “private” command names, so as not to conflict with user level commands.

            – egreg
            Jan 30 at 11:15













          • @JensWagemaker I added some explanations.

            – egreg
            Jan 30 at 11:38











          • Can you explain what wmat@false is? Because it looks like a control sequence, but the only control sequence that is defined until the first use of wmat@false is wmat.

            – Jens Wagemaker
            Feb 1 at 11:43











          • @JensWagemaker wmat@false is defined by newififwmat@ and makes the conditional return false when used. Similarly for wmat@true.

            – egreg
            Feb 1 at 11:47



















          2














          You code generates a double subscript error. Perhaps what you want is this:



          documentclass{article}
          usepackage{mathtools}
          DeclareMathOperator*{wmat}{w}
          begin{document}
          [ smash{wmat_2}mathllap{phantom{wmat}}_i^j ]
          end{document}


          You might want to define a macro if you want to use this more than once.






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


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f472306%2funderscript-subscript-and-superscript-add-the-same-time-possibly-via-mathopera%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









            2














            Here's my proposal:



            documentclass{article}
            usepackage{amsmath}

            makeatletter % access "private" commands
            newcommand{wmat}[1]{%
            mathop{wmat@falsemathpalettewmat@{#1}}%
            !%
            mathop{wmat@truemathpalettewmat@{#1}}%
            nolimits
            }
            newififwmat@
            newcommand{wmat@}[2]{%
            begingroup
            setboxz@=vtop{offinterlineskip
            ialign{%
            hfil$m@th##$hfilcr
            #1mathrm{w}cr
            noalign{kern1pt}
            scriptscriptstyle#2cr
            }%
            }%
            ifwmat@
            sboxtw@{$#1mathrm{w}$}%
            dpz@=dptw@
            boxz@
            else
            vrule height htz@ depth dpz@ width z@
            fi
            endgroup
            }

            begin{document}
            begin{center}
            fboxsep=0ptfboxrule=0.1pt
            $wmat[2]_i^j$ $scriptstylewmat[2]_i^j$ $scriptscriptstylewmat[2]_i^j$
            fbox{$wmat[2]_i^j$}
            end{center}
            [
            wmat[2]_i^j
            ]

            end{document}


            The centered subscript is always in scriptscriptstyle so as to avoid it making for bad spacing.



            enter image description here



            The strategy is to define a math operator that accepts an optional argument for the centered subscript. However, this subscript should not influence the vertical size of the ‘w’, in order that the standard subscript and superscript are set to the letter.



            So I typeset ‘w with the subscript’ twice, one with wmat@false and one with wmat@true. The first instance is used to make a phantom that has the same vertical size of ‘w with the subscript’, placed in a mathop atom of its own. The second instance is also typeset in a mathop atom; a ! between them removes the space that TeX adds between consecutive mathop atoms.



            I build a box containing ‘w with the subscript’ (details later); in the wmat@false case this is used to make a vertical rule as high and deep as the box, with zero width. This will reserve the needed vertical space but produce no visible output. In the wmat@true case the box is resized to have the same vertical dimensions as a plain ‘w’. This will be the last item that TeX will see and to which it will attach the _j^i items that follow.



            Now how's the box built? I found that using operatorname*{w}_2 places the subscript too far down below the ‘w’, so a different method is needed. I use the primitive TeX method for alignments. I open a vtop, that is a box containing vertical material, with the reference point given by the top item inside it (it will be mathrm{w}).



            Inside the vtop I build an ialign (a wrapper around halign with some initialization). This does a one column table, with no vertical space between rows (by offinterlineskip) except the explicitly added kern1pt. The top row contains, as said, mathrm{w} in the needed size (via mathpalette); the bottom row contains the subscript, always in scriptscriptstyle.



            The vtop is assigned to a box register, so it is possible to access its dimensions (for typesetting the zero width rule in the wmat@false case) or change them (for making it appear the same as ‘w’). Then the box is used in the wmat@true case).



            Information about halign is found in the TeXbook or in TeX by Topic.






            share|improve this answer


























            • I'm not a TeX expert (but I have started on Knuth's book). Could you explain line by line what is happening? In particular I don't understand the function of @, and the second empty pair of brackets in newcommand{wmat}[1]. Also it is not clear where xparse is used, because the documentations says it is a replacement for newcommand, but I still see newcommend.

              – Jens Wagemaker
              Jan 30 at 11:03













            • @JensWagemaker xparse is a relic of a previous attempt and is not needed here. I'll add some explanations. For the @, it is customary to use it in “private” command names, so as not to conflict with user level commands.

              – egreg
              Jan 30 at 11:15













            • @JensWagemaker I added some explanations.

              – egreg
              Jan 30 at 11:38











            • Can you explain what wmat@false is? Because it looks like a control sequence, but the only control sequence that is defined until the first use of wmat@false is wmat.

              – Jens Wagemaker
              Feb 1 at 11:43











            • @JensWagemaker wmat@false is defined by newififwmat@ and makes the conditional return false when used. Similarly for wmat@true.

              – egreg
              Feb 1 at 11:47
















            2














            Here's my proposal:



            documentclass{article}
            usepackage{amsmath}

            makeatletter % access "private" commands
            newcommand{wmat}[1]{%
            mathop{wmat@falsemathpalettewmat@{#1}}%
            !%
            mathop{wmat@truemathpalettewmat@{#1}}%
            nolimits
            }
            newififwmat@
            newcommand{wmat@}[2]{%
            begingroup
            setboxz@=vtop{offinterlineskip
            ialign{%
            hfil$m@th##$hfilcr
            #1mathrm{w}cr
            noalign{kern1pt}
            scriptscriptstyle#2cr
            }%
            }%
            ifwmat@
            sboxtw@{$#1mathrm{w}$}%
            dpz@=dptw@
            boxz@
            else
            vrule height htz@ depth dpz@ width z@
            fi
            endgroup
            }

            begin{document}
            begin{center}
            fboxsep=0ptfboxrule=0.1pt
            $wmat[2]_i^j$ $scriptstylewmat[2]_i^j$ $scriptscriptstylewmat[2]_i^j$
            fbox{$wmat[2]_i^j$}
            end{center}
            [
            wmat[2]_i^j
            ]

            end{document}


            The centered subscript is always in scriptscriptstyle so as to avoid it making for bad spacing.



            enter image description here



            The strategy is to define a math operator that accepts an optional argument for the centered subscript. However, this subscript should not influence the vertical size of the ‘w’, in order that the standard subscript and superscript are set to the letter.



            So I typeset ‘w with the subscript’ twice, one with wmat@false and one with wmat@true. The first instance is used to make a phantom that has the same vertical size of ‘w with the subscript’, placed in a mathop atom of its own. The second instance is also typeset in a mathop atom; a ! between them removes the space that TeX adds between consecutive mathop atoms.



            I build a box containing ‘w with the subscript’ (details later); in the wmat@false case this is used to make a vertical rule as high and deep as the box, with zero width. This will reserve the needed vertical space but produce no visible output. In the wmat@true case the box is resized to have the same vertical dimensions as a plain ‘w’. This will be the last item that TeX will see and to which it will attach the _j^i items that follow.



            Now how's the box built? I found that using operatorname*{w}_2 places the subscript too far down below the ‘w’, so a different method is needed. I use the primitive TeX method for alignments. I open a vtop, that is a box containing vertical material, with the reference point given by the top item inside it (it will be mathrm{w}).



            Inside the vtop I build an ialign (a wrapper around halign with some initialization). This does a one column table, with no vertical space between rows (by offinterlineskip) except the explicitly added kern1pt. The top row contains, as said, mathrm{w} in the needed size (via mathpalette); the bottom row contains the subscript, always in scriptscriptstyle.



            The vtop is assigned to a box register, so it is possible to access its dimensions (for typesetting the zero width rule in the wmat@false case) or change them (for making it appear the same as ‘w’). Then the box is used in the wmat@true case).



            Information about halign is found in the TeXbook or in TeX by Topic.






            share|improve this answer


























            • I'm not a TeX expert (but I have started on Knuth's book). Could you explain line by line what is happening? In particular I don't understand the function of @, and the second empty pair of brackets in newcommand{wmat}[1]. Also it is not clear where xparse is used, because the documentations says it is a replacement for newcommand, but I still see newcommend.

              – Jens Wagemaker
              Jan 30 at 11:03













            • @JensWagemaker xparse is a relic of a previous attempt and is not needed here. I'll add some explanations. For the @, it is customary to use it in “private” command names, so as not to conflict with user level commands.

              – egreg
              Jan 30 at 11:15













            • @JensWagemaker I added some explanations.

              – egreg
              Jan 30 at 11:38











            • Can you explain what wmat@false is? Because it looks like a control sequence, but the only control sequence that is defined until the first use of wmat@false is wmat.

              – Jens Wagemaker
              Feb 1 at 11:43











            • @JensWagemaker wmat@false is defined by newififwmat@ and makes the conditional return false when used. Similarly for wmat@true.

              – egreg
              Feb 1 at 11:47














            2












            2








            2







            Here's my proposal:



            documentclass{article}
            usepackage{amsmath}

            makeatletter % access "private" commands
            newcommand{wmat}[1]{%
            mathop{wmat@falsemathpalettewmat@{#1}}%
            !%
            mathop{wmat@truemathpalettewmat@{#1}}%
            nolimits
            }
            newififwmat@
            newcommand{wmat@}[2]{%
            begingroup
            setboxz@=vtop{offinterlineskip
            ialign{%
            hfil$m@th##$hfilcr
            #1mathrm{w}cr
            noalign{kern1pt}
            scriptscriptstyle#2cr
            }%
            }%
            ifwmat@
            sboxtw@{$#1mathrm{w}$}%
            dpz@=dptw@
            boxz@
            else
            vrule height htz@ depth dpz@ width z@
            fi
            endgroup
            }

            begin{document}
            begin{center}
            fboxsep=0ptfboxrule=0.1pt
            $wmat[2]_i^j$ $scriptstylewmat[2]_i^j$ $scriptscriptstylewmat[2]_i^j$
            fbox{$wmat[2]_i^j$}
            end{center}
            [
            wmat[2]_i^j
            ]

            end{document}


            The centered subscript is always in scriptscriptstyle so as to avoid it making for bad spacing.



            enter image description here



            The strategy is to define a math operator that accepts an optional argument for the centered subscript. However, this subscript should not influence the vertical size of the ‘w’, in order that the standard subscript and superscript are set to the letter.



            So I typeset ‘w with the subscript’ twice, one with wmat@false and one with wmat@true. The first instance is used to make a phantom that has the same vertical size of ‘w with the subscript’, placed in a mathop atom of its own. The second instance is also typeset in a mathop atom; a ! between them removes the space that TeX adds between consecutive mathop atoms.



            I build a box containing ‘w with the subscript’ (details later); in the wmat@false case this is used to make a vertical rule as high and deep as the box, with zero width. This will reserve the needed vertical space but produce no visible output. In the wmat@true case the box is resized to have the same vertical dimensions as a plain ‘w’. This will be the last item that TeX will see and to which it will attach the _j^i items that follow.



            Now how's the box built? I found that using operatorname*{w}_2 places the subscript too far down below the ‘w’, so a different method is needed. I use the primitive TeX method for alignments. I open a vtop, that is a box containing vertical material, with the reference point given by the top item inside it (it will be mathrm{w}).



            Inside the vtop I build an ialign (a wrapper around halign with some initialization). This does a one column table, with no vertical space between rows (by offinterlineskip) except the explicitly added kern1pt. The top row contains, as said, mathrm{w} in the needed size (via mathpalette); the bottom row contains the subscript, always in scriptscriptstyle.



            The vtop is assigned to a box register, so it is possible to access its dimensions (for typesetting the zero width rule in the wmat@false case) or change them (for making it appear the same as ‘w’). Then the box is used in the wmat@true case).



            Information about halign is found in the TeXbook or in TeX by Topic.






            share|improve this answer















            Here's my proposal:



            documentclass{article}
            usepackage{amsmath}

            makeatletter % access "private" commands
            newcommand{wmat}[1]{%
            mathop{wmat@falsemathpalettewmat@{#1}}%
            !%
            mathop{wmat@truemathpalettewmat@{#1}}%
            nolimits
            }
            newififwmat@
            newcommand{wmat@}[2]{%
            begingroup
            setboxz@=vtop{offinterlineskip
            ialign{%
            hfil$m@th##$hfilcr
            #1mathrm{w}cr
            noalign{kern1pt}
            scriptscriptstyle#2cr
            }%
            }%
            ifwmat@
            sboxtw@{$#1mathrm{w}$}%
            dpz@=dptw@
            boxz@
            else
            vrule height htz@ depth dpz@ width z@
            fi
            endgroup
            }

            begin{document}
            begin{center}
            fboxsep=0ptfboxrule=0.1pt
            $wmat[2]_i^j$ $scriptstylewmat[2]_i^j$ $scriptscriptstylewmat[2]_i^j$
            fbox{$wmat[2]_i^j$}
            end{center}
            [
            wmat[2]_i^j
            ]

            end{document}


            The centered subscript is always in scriptscriptstyle so as to avoid it making for bad spacing.



            enter image description here



            The strategy is to define a math operator that accepts an optional argument for the centered subscript. However, this subscript should not influence the vertical size of the ‘w’, in order that the standard subscript and superscript are set to the letter.



            So I typeset ‘w with the subscript’ twice, one with wmat@false and one with wmat@true. The first instance is used to make a phantom that has the same vertical size of ‘w with the subscript’, placed in a mathop atom of its own. The second instance is also typeset in a mathop atom; a ! between them removes the space that TeX adds between consecutive mathop atoms.



            I build a box containing ‘w with the subscript’ (details later); in the wmat@false case this is used to make a vertical rule as high and deep as the box, with zero width. This will reserve the needed vertical space but produce no visible output. In the wmat@true case the box is resized to have the same vertical dimensions as a plain ‘w’. This will be the last item that TeX will see and to which it will attach the _j^i items that follow.



            Now how's the box built? I found that using operatorname*{w}_2 places the subscript too far down below the ‘w’, so a different method is needed. I use the primitive TeX method for alignments. I open a vtop, that is a box containing vertical material, with the reference point given by the top item inside it (it will be mathrm{w}).



            Inside the vtop I build an ialign (a wrapper around halign with some initialization). This does a one column table, with no vertical space between rows (by offinterlineskip) except the explicitly added kern1pt. The top row contains, as said, mathrm{w} in the needed size (via mathpalette); the bottom row contains the subscript, always in scriptscriptstyle.



            The vtop is assigned to a box register, so it is possible to access its dimensions (for typesetting the zero width rule in the wmat@false case) or change them (for making it appear the same as ‘w’). Then the box is used in the wmat@true case).



            Information about halign is found in the TeXbook or in TeX by Topic.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 30 at 11:38

























            answered Jan 29 at 12:49









            egregegreg

            717k8719023197




            717k8719023197













            • I'm not a TeX expert (but I have started on Knuth's book). Could you explain line by line what is happening? In particular I don't understand the function of @, and the second empty pair of brackets in newcommand{wmat}[1]. Also it is not clear where xparse is used, because the documentations says it is a replacement for newcommand, but I still see newcommend.

              – Jens Wagemaker
              Jan 30 at 11:03













            • @JensWagemaker xparse is a relic of a previous attempt and is not needed here. I'll add some explanations. For the @, it is customary to use it in “private” command names, so as not to conflict with user level commands.

              – egreg
              Jan 30 at 11:15













            • @JensWagemaker I added some explanations.

              – egreg
              Jan 30 at 11:38











            • Can you explain what wmat@false is? Because it looks like a control sequence, but the only control sequence that is defined until the first use of wmat@false is wmat.

              – Jens Wagemaker
              Feb 1 at 11:43











            • @JensWagemaker wmat@false is defined by newififwmat@ and makes the conditional return false when used. Similarly for wmat@true.

              – egreg
              Feb 1 at 11:47



















            • I'm not a TeX expert (but I have started on Knuth's book). Could you explain line by line what is happening? In particular I don't understand the function of @, and the second empty pair of brackets in newcommand{wmat}[1]. Also it is not clear where xparse is used, because the documentations says it is a replacement for newcommand, but I still see newcommend.

              – Jens Wagemaker
              Jan 30 at 11:03













            • @JensWagemaker xparse is a relic of a previous attempt and is not needed here. I'll add some explanations. For the @, it is customary to use it in “private” command names, so as not to conflict with user level commands.

              – egreg
              Jan 30 at 11:15













            • @JensWagemaker I added some explanations.

              – egreg
              Jan 30 at 11:38











            • Can you explain what wmat@false is? Because it looks like a control sequence, but the only control sequence that is defined until the first use of wmat@false is wmat.

              – Jens Wagemaker
              Feb 1 at 11:43











            • @JensWagemaker wmat@false is defined by newififwmat@ and makes the conditional return false when used. Similarly for wmat@true.

              – egreg
              Feb 1 at 11:47

















            I'm not a TeX expert (but I have started on Knuth's book). Could you explain line by line what is happening? In particular I don't understand the function of @, and the second empty pair of brackets in newcommand{wmat}[1]. Also it is not clear where xparse is used, because the documentations says it is a replacement for newcommand, but I still see newcommend.

            – Jens Wagemaker
            Jan 30 at 11:03







            I'm not a TeX expert (but I have started on Knuth's book). Could you explain line by line what is happening? In particular I don't understand the function of @, and the second empty pair of brackets in newcommand{wmat}[1]. Also it is not clear where xparse is used, because the documentations says it is a replacement for newcommand, but I still see newcommend.

            – Jens Wagemaker
            Jan 30 at 11:03















            @JensWagemaker xparse is a relic of a previous attempt and is not needed here. I'll add some explanations. For the @, it is customary to use it in “private” command names, so as not to conflict with user level commands.

            – egreg
            Jan 30 at 11:15







            @JensWagemaker xparse is a relic of a previous attempt and is not needed here. I'll add some explanations. For the @, it is customary to use it in “private” command names, so as not to conflict with user level commands.

            – egreg
            Jan 30 at 11:15















            @JensWagemaker I added some explanations.

            – egreg
            Jan 30 at 11:38





            @JensWagemaker I added some explanations.

            – egreg
            Jan 30 at 11:38













            Can you explain what wmat@false is? Because it looks like a control sequence, but the only control sequence that is defined until the first use of wmat@false is wmat.

            – Jens Wagemaker
            Feb 1 at 11:43





            Can you explain what wmat@false is? Because it looks like a control sequence, but the only control sequence that is defined until the first use of wmat@false is wmat.

            – Jens Wagemaker
            Feb 1 at 11:43













            @JensWagemaker wmat@false is defined by newififwmat@ and makes the conditional return false when used. Similarly for wmat@true.

            – egreg
            Feb 1 at 11:47





            @JensWagemaker wmat@false is defined by newififwmat@ and makes the conditional return false when used. Similarly for wmat@true.

            – egreg
            Feb 1 at 11:47











            2














            You code generates a double subscript error. Perhaps what you want is this:



            documentclass{article}
            usepackage{mathtools}
            DeclareMathOperator*{wmat}{w}
            begin{document}
            [ smash{wmat_2}mathllap{phantom{wmat}}_i^j ]
            end{document}


            You might want to define a macro if you want to use this more than once.






            share|improve this answer




























              2














              You code generates a double subscript error. Perhaps what you want is this:



              documentclass{article}
              usepackage{mathtools}
              DeclareMathOperator*{wmat}{w}
              begin{document}
              [ smash{wmat_2}mathllap{phantom{wmat}}_i^j ]
              end{document}


              You might want to define a macro if you want to use this more than once.






              share|improve this answer


























                2












                2








                2







                You code generates a double subscript error. Perhaps what you want is this:



                documentclass{article}
                usepackage{mathtools}
                DeclareMathOperator*{wmat}{w}
                begin{document}
                [ smash{wmat_2}mathllap{phantom{wmat}}_i^j ]
                end{document}


                You might want to define a macro if you want to use this more than once.






                share|improve this answer













                You code generates a double subscript error. Perhaps what you want is this:



                documentclass{article}
                usepackage{mathtools}
                DeclareMathOperator*{wmat}{w}
                begin{document}
                [ smash{wmat_2}mathllap{phantom{wmat}}_i^j ]
                end{document}


                You might want to define a macro if you want to use this more than once.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 28 at 21:49









                Ian ThompsonIan Thompson

                31.9k379154




                31.9k379154






























                    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%2f472306%2funderscript-subscript-and-superscript-add-the-same-time-possibly-via-mathopera%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

                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                    ComboBox Display Member on multiple fields

                    Is it possible to collect Nectar points via Trainline?