How do you resize the box of a symbol, while vertically centering it?












5














Consider the following MWE:



documentclass[margin=2mm]{standalone}
usepackage{amsmath,amssymb}
usepackage{graphics}
defmyboxmin{mathop{raisebox{.15em}{scalebox{.5}{$boxminus$}}}}

begin{document}
$A myboxmin B$
end{document}


I would like to make it better in two ways




  1. Define a RescaleSymbol command in such a way the above output is obtained typing RescaleSymbol[.5]{boxminus} (say, the default value for rescaling is .75)

  2. Without the raisebox, the rescaled symbol is aligned to the baseline. Now, it must take as values (half of) the height of the symbol to be rescaled.


How can I do?










share|improve this question




















  • 1




    Are you sure it should be mathop? The use example suggests mathbin.
    – egreg
    Nov 22 '18 at 11:09












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    Nov 22 '18 at 11:12
















5














Consider the following MWE:



documentclass[margin=2mm]{standalone}
usepackage{amsmath,amssymb}
usepackage{graphics}
defmyboxmin{mathop{raisebox{.15em}{scalebox{.5}{$boxminus$}}}}

begin{document}
$A myboxmin B$
end{document}


I would like to make it better in two ways




  1. Define a RescaleSymbol command in such a way the above output is obtained typing RescaleSymbol[.5]{boxminus} (say, the default value for rescaling is .75)

  2. Without the raisebox, the rescaled symbol is aligned to the baseline. Now, it must take as values (half of) the height of the symbol to be rescaled.


How can I do?










share|improve this question




















  • 1




    Are you sure it should be mathop? The use example suggests mathbin.
    – egreg
    Nov 22 '18 at 11:09












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    Nov 22 '18 at 11:12














5












5








5


0





Consider the following MWE:



documentclass[margin=2mm]{standalone}
usepackage{amsmath,amssymb}
usepackage{graphics}
defmyboxmin{mathop{raisebox{.15em}{scalebox{.5}{$boxminus$}}}}

begin{document}
$A myboxmin B$
end{document}


I would like to make it better in two ways




  1. Define a RescaleSymbol command in such a way the above output is obtained typing RescaleSymbol[.5]{boxminus} (say, the default value for rescaling is .75)

  2. Without the raisebox, the rescaled symbol is aligned to the baseline. Now, it must take as values (half of) the height of the symbol to be rescaled.


How can I do?










share|improve this question















Consider the following MWE:



documentclass[margin=2mm]{standalone}
usepackage{amsmath,amssymb}
usepackage{graphics}
defmyboxmin{mathop{raisebox{.15em}{scalebox{.5}{$boxminus$}}}}

begin{document}
$A myboxmin B$
end{document}


I would like to make it better in two ways




  1. Define a RescaleSymbol command in such a way the above output is obtained typing RescaleSymbol[.5]{boxminus} (say, the default value for rescaling is .75)

  2. Without the raisebox, the rescaled symbol is aligned to the baseline. Now, it must take as values (half of) the height of the symbol to be rescaled.


How can I do?







horizontal-alignment math-operators scaling






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 11:36









Martin Scharrer

199k45632815




199k45632815










asked Nov 22 '18 at 10:23









Fosco Loregian

591515




591515








  • 1




    Are you sure it should be mathop? The use example suggests mathbin.
    – egreg
    Nov 22 '18 at 11:09












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    Nov 22 '18 at 11:12














  • 1




    Are you sure it should be mathop? The use example suggests mathbin.
    – egreg
    Nov 22 '18 at 11:09












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    Nov 22 '18 at 11:12








1




1




Are you sure it should be mathop? The use example suggests mathbin.
– egreg
Nov 22 '18 at 11:09






Are you sure it should be mathop? The use example suggests mathbin.
– egreg
Nov 22 '18 at 11:09














Mh. Of course it depends on the kind of symbol you have to rescale...
– Fosco Loregian
Nov 22 '18 at 11:12




Mh. Of course it depends on the kind of symbol you have to rescale...
– Fosco Loregian
Nov 22 '18 at 11:12










2 Answers
2






active

oldest

votes


















5














You can define your new macro as: newcommand{RescaleSymbol}[2][<default_optional>]{..} with #1 the optional parameter and #2 the mandatory one. The default value for the first (optional) parameter is written in the second pair of brackets. Use the new command as RescaleSymbol[<scale>]{<symbol>} or RescaleSymbol{<symbol>} with the default scale of 0.75.



documentclass[margin=2mm]{standalone}
usepackage{amsmath,amssymb}
usepackage{graphics}

newcommand{RescaleSymbol}[2][.75]{mathop{vcenter{hbox{scalebox{#1}{$#2$}}}}}

begin{document}
$A - RescaleSymbol[.5]{boxminus} B$
end{document}



enter image description here







share|improve this answer























  • For some reason vcenter didn't work, but I guess the reason is I didn't enclose the rescaled symbol in a hbox command. This seems to work fine, thank you.
    – Fosco Loregian
    Nov 22 '18 at 11:10



















5














You probably have mathop to vertically center the symbol with respect to the formula axis, but this only works if the argument to mathop is a single character.



The amsmath package has a built-in mechanism for deciding whether a symbol is a mathbin or a mathrel, which is used for underset and overset.



documentclass{article}
usepackage{amsmath}
usepackage{amssymb}
usepackage{graphicx}

makeatletter
newcommand{rescalesymbol}[2][0.75]{%
binrel@{#2}% this makes binrel@@ to mean mathbin, mathrel or empty
binrel@@{rescale@symbol{#1}{#2}}%
}
newcommand{rescale@symbol}[2]{%
mathpaletterescale@@symbol{{#1}{#2}}%
}
newcommand{rescale@@symbol}[2]{%
rescale@@@symbol#1#2%
}
newcommand{rescale@@@symbol}[3]{%
% #1=math style, #2=scale factor, #3=symbol
vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
}
makeatother

begin{document}

$A rescalesymbol{boxminus} B$

$scriptstyle A rescalesymbol{boxminus} B$

$A rescalesymbol[0.5]{boxminus} B$

$scriptstyle A rescalesymbol[0.5]{boxminus} B$

$A rescalesymbol{pitchfork} B$

$scriptstyle A rescalesymbol{pitchfork} B$

$A rescalesymbol[0.5]{pitchfork} B$

$scriptstyle A rescalesymbol[0.5]{pitchfork} B$

end{document}


enter image description here



If you want to set the kind of the symbol differently from its standard status of mathbin or mathrel, or you need a totally different kind, I suggest a trailing optional argument:



documentclass{article}
usepackage{amsmath}
usepackage{amssymb}
usepackage{graphicx}
usepackage{xparse}

makeatletter
NewDocumentCommand{rescalesymbol}{O{0.75}mo}{%
IfNoValueTF{#3}
{%
binrel@{#2}% this makes binrel@@ become mathbin, mathrel or empty
binrel@@{rescale@symbol{#1}{#2}}%
}
{#3binrel@@{rescale@symbol{#1}{#2}}}%
}
newcommand{rescale@symbol}[2]{%
mathpaletterescale@@symbol{{#1}{#2}}%
}
newcommand{rescale@@symbol}[2]{%
rescale@@@symbol#1#2%
}
newcommand{rescale@@@symbol}[3]{%
% #1=math style, #2=scale factor, #3=symbol
vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
}
makeatother

begin{document}

$A rescalesymbol{boxminus} B$

$scriptstyle A rescalesymbol{boxminus} B$

$A rescalesymbol[0.5]{boxminus} B$

$scriptstyle A rescalesymbol[0.5]{boxminus} B$

$A rescalesymbol{pitchfork} B$

$scriptstyle A rescalesymbol{pitchfork} B$

$A rescalesymbol[0.5]{pitchfork}[mathop] B$

$scriptstyle A rescalesymbol[0.5]{pitchfork}[mathop] B$

end{document}


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',
    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%2f461249%2fhow-do-you-resize-the-box-of-a-symbol-while-vertically-centering-it%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









    5














    You can define your new macro as: newcommand{RescaleSymbol}[2][<default_optional>]{..} with #1 the optional parameter and #2 the mandatory one. The default value for the first (optional) parameter is written in the second pair of brackets. Use the new command as RescaleSymbol[<scale>]{<symbol>} or RescaleSymbol{<symbol>} with the default scale of 0.75.



    documentclass[margin=2mm]{standalone}
    usepackage{amsmath,amssymb}
    usepackage{graphics}

    newcommand{RescaleSymbol}[2][.75]{mathop{vcenter{hbox{scalebox{#1}{$#2$}}}}}

    begin{document}
    $A - RescaleSymbol[.5]{boxminus} B$
    end{document}



    enter image description here







    share|improve this answer























    • For some reason vcenter didn't work, but I guess the reason is I didn't enclose the rescaled symbol in a hbox command. This seems to work fine, thank you.
      – Fosco Loregian
      Nov 22 '18 at 11:10
















    5














    You can define your new macro as: newcommand{RescaleSymbol}[2][<default_optional>]{..} with #1 the optional parameter and #2 the mandatory one. The default value for the first (optional) parameter is written in the second pair of brackets. Use the new command as RescaleSymbol[<scale>]{<symbol>} or RescaleSymbol{<symbol>} with the default scale of 0.75.



    documentclass[margin=2mm]{standalone}
    usepackage{amsmath,amssymb}
    usepackage{graphics}

    newcommand{RescaleSymbol}[2][.75]{mathop{vcenter{hbox{scalebox{#1}{$#2$}}}}}

    begin{document}
    $A - RescaleSymbol[.5]{boxminus} B$
    end{document}



    enter image description here







    share|improve this answer























    • For some reason vcenter didn't work, but I guess the reason is I didn't enclose the rescaled symbol in a hbox command. This seems to work fine, thank you.
      – Fosco Loregian
      Nov 22 '18 at 11:10














    5












    5








    5






    You can define your new macro as: newcommand{RescaleSymbol}[2][<default_optional>]{..} with #1 the optional parameter and #2 the mandatory one. The default value for the first (optional) parameter is written in the second pair of brackets. Use the new command as RescaleSymbol[<scale>]{<symbol>} or RescaleSymbol{<symbol>} with the default scale of 0.75.



    documentclass[margin=2mm]{standalone}
    usepackage{amsmath,amssymb}
    usepackage{graphics}

    newcommand{RescaleSymbol}[2][.75]{mathop{vcenter{hbox{scalebox{#1}{$#2$}}}}}

    begin{document}
    $A - RescaleSymbol[.5]{boxminus} B$
    end{document}



    enter image description here







    share|improve this answer














    You can define your new macro as: newcommand{RescaleSymbol}[2][<default_optional>]{..} with #1 the optional parameter and #2 the mandatory one. The default value for the first (optional) parameter is written in the second pair of brackets. Use the new command as RescaleSymbol[<scale>]{<symbol>} or RescaleSymbol{<symbol>} with the default scale of 0.75.



    documentclass[margin=2mm]{standalone}
    usepackage{amsmath,amssymb}
    usepackage{graphics}

    newcommand{RescaleSymbol}[2][.75]{mathop{vcenter{hbox{scalebox{#1}{$#2$}}}}}

    begin{document}
    $A - RescaleSymbol[.5]{boxminus} B$
    end{document}



    enter image description here








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 22 '18 at 11:03

























    answered Nov 22 '18 at 10:55









    AboAmmar

    33.3k22882




    33.3k22882












    • For some reason vcenter didn't work, but I guess the reason is I didn't enclose the rescaled symbol in a hbox command. This seems to work fine, thank you.
      – Fosco Loregian
      Nov 22 '18 at 11:10


















    • For some reason vcenter didn't work, but I guess the reason is I didn't enclose the rescaled symbol in a hbox command. This seems to work fine, thank you.
      – Fosco Loregian
      Nov 22 '18 at 11:10
















    For some reason vcenter didn't work, but I guess the reason is I didn't enclose the rescaled symbol in a hbox command. This seems to work fine, thank you.
    – Fosco Loregian
    Nov 22 '18 at 11:10




    For some reason vcenter didn't work, but I guess the reason is I didn't enclose the rescaled symbol in a hbox command. This seems to work fine, thank you.
    – Fosco Loregian
    Nov 22 '18 at 11:10











    5














    You probably have mathop to vertically center the symbol with respect to the formula axis, but this only works if the argument to mathop is a single character.



    The amsmath package has a built-in mechanism for deciding whether a symbol is a mathbin or a mathrel, which is used for underset and overset.



    documentclass{article}
    usepackage{amsmath}
    usepackage{amssymb}
    usepackage{graphicx}

    makeatletter
    newcommand{rescalesymbol}[2][0.75]{%
    binrel@{#2}% this makes binrel@@ to mean mathbin, mathrel or empty
    binrel@@{rescale@symbol{#1}{#2}}%
    }
    newcommand{rescale@symbol}[2]{%
    mathpaletterescale@@symbol{{#1}{#2}}%
    }
    newcommand{rescale@@symbol}[2]{%
    rescale@@@symbol#1#2%
    }
    newcommand{rescale@@@symbol}[3]{%
    % #1=math style, #2=scale factor, #3=symbol
    vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
    }
    makeatother

    begin{document}

    $A rescalesymbol{boxminus} B$

    $scriptstyle A rescalesymbol{boxminus} B$

    $A rescalesymbol[0.5]{boxminus} B$

    $scriptstyle A rescalesymbol[0.5]{boxminus} B$

    $A rescalesymbol{pitchfork} B$

    $scriptstyle A rescalesymbol{pitchfork} B$

    $A rescalesymbol[0.5]{pitchfork} B$

    $scriptstyle A rescalesymbol[0.5]{pitchfork} B$

    end{document}


    enter image description here



    If you want to set the kind of the symbol differently from its standard status of mathbin or mathrel, or you need a totally different kind, I suggest a trailing optional argument:



    documentclass{article}
    usepackage{amsmath}
    usepackage{amssymb}
    usepackage{graphicx}
    usepackage{xparse}

    makeatletter
    NewDocumentCommand{rescalesymbol}{O{0.75}mo}{%
    IfNoValueTF{#3}
    {%
    binrel@{#2}% this makes binrel@@ become mathbin, mathrel or empty
    binrel@@{rescale@symbol{#1}{#2}}%
    }
    {#3binrel@@{rescale@symbol{#1}{#2}}}%
    }
    newcommand{rescale@symbol}[2]{%
    mathpaletterescale@@symbol{{#1}{#2}}%
    }
    newcommand{rescale@@symbol}[2]{%
    rescale@@@symbol#1#2%
    }
    newcommand{rescale@@@symbol}[3]{%
    % #1=math style, #2=scale factor, #3=symbol
    vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
    }
    makeatother

    begin{document}

    $A rescalesymbol{boxminus} B$

    $scriptstyle A rescalesymbol{boxminus} B$

    $A rescalesymbol[0.5]{boxminus} B$

    $scriptstyle A rescalesymbol[0.5]{boxminus} B$

    $A rescalesymbol{pitchfork} B$

    $scriptstyle A rescalesymbol{pitchfork} B$

    $A rescalesymbol[0.5]{pitchfork}[mathop] B$

    $scriptstyle A rescalesymbol[0.5]{pitchfork}[mathop] B$

    end{document}


    enter image description here






    share|improve this answer




























      5














      You probably have mathop to vertically center the symbol with respect to the formula axis, but this only works if the argument to mathop is a single character.



      The amsmath package has a built-in mechanism for deciding whether a symbol is a mathbin or a mathrel, which is used for underset and overset.



      documentclass{article}
      usepackage{amsmath}
      usepackage{amssymb}
      usepackage{graphicx}

      makeatletter
      newcommand{rescalesymbol}[2][0.75]{%
      binrel@{#2}% this makes binrel@@ to mean mathbin, mathrel or empty
      binrel@@{rescale@symbol{#1}{#2}}%
      }
      newcommand{rescale@symbol}[2]{%
      mathpaletterescale@@symbol{{#1}{#2}}%
      }
      newcommand{rescale@@symbol}[2]{%
      rescale@@@symbol#1#2%
      }
      newcommand{rescale@@@symbol}[3]{%
      % #1=math style, #2=scale factor, #3=symbol
      vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
      }
      makeatother

      begin{document}

      $A rescalesymbol{boxminus} B$

      $scriptstyle A rescalesymbol{boxminus} B$

      $A rescalesymbol[0.5]{boxminus} B$

      $scriptstyle A rescalesymbol[0.5]{boxminus} B$

      $A rescalesymbol{pitchfork} B$

      $scriptstyle A rescalesymbol{pitchfork} B$

      $A rescalesymbol[0.5]{pitchfork} B$

      $scriptstyle A rescalesymbol[0.5]{pitchfork} B$

      end{document}


      enter image description here



      If you want to set the kind of the symbol differently from its standard status of mathbin or mathrel, or you need a totally different kind, I suggest a trailing optional argument:



      documentclass{article}
      usepackage{amsmath}
      usepackage{amssymb}
      usepackage{graphicx}
      usepackage{xparse}

      makeatletter
      NewDocumentCommand{rescalesymbol}{O{0.75}mo}{%
      IfNoValueTF{#3}
      {%
      binrel@{#2}% this makes binrel@@ become mathbin, mathrel or empty
      binrel@@{rescale@symbol{#1}{#2}}%
      }
      {#3binrel@@{rescale@symbol{#1}{#2}}}%
      }
      newcommand{rescale@symbol}[2]{%
      mathpaletterescale@@symbol{{#1}{#2}}%
      }
      newcommand{rescale@@symbol}[2]{%
      rescale@@@symbol#1#2%
      }
      newcommand{rescale@@@symbol}[3]{%
      % #1=math style, #2=scale factor, #3=symbol
      vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
      }
      makeatother

      begin{document}

      $A rescalesymbol{boxminus} B$

      $scriptstyle A rescalesymbol{boxminus} B$

      $A rescalesymbol[0.5]{boxminus} B$

      $scriptstyle A rescalesymbol[0.5]{boxminus} B$

      $A rescalesymbol{pitchfork} B$

      $scriptstyle A rescalesymbol{pitchfork} B$

      $A rescalesymbol[0.5]{pitchfork}[mathop] B$

      $scriptstyle A rescalesymbol[0.5]{pitchfork}[mathop] B$

      end{document}


      enter image description here






      share|improve this answer


























        5












        5








        5






        You probably have mathop to vertically center the symbol with respect to the formula axis, but this only works if the argument to mathop is a single character.



        The amsmath package has a built-in mechanism for deciding whether a symbol is a mathbin or a mathrel, which is used for underset and overset.



        documentclass{article}
        usepackage{amsmath}
        usepackage{amssymb}
        usepackage{graphicx}

        makeatletter
        newcommand{rescalesymbol}[2][0.75]{%
        binrel@{#2}% this makes binrel@@ to mean mathbin, mathrel or empty
        binrel@@{rescale@symbol{#1}{#2}}%
        }
        newcommand{rescale@symbol}[2]{%
        mathpaletterescale@@symbol{{#1}{#2}}%
        }
        newcommand{rescale@@symbol}[2]{%
        rescale@@@symbol#1#2%
        }
        newcommand{rescale@@@symbol}[3]{%
        % #1=math style, #2=scale factor, #3=symbol
        vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
        }
        makeatother

        begin{document}

        $A rescalesymbol{boxminus} B$

        $scriptstyle A rescalesymbol{boxminus} B$

        $A rescalesymbol[0.5]{boxminus} B$

        $scriptstyle A rescalesymbol[0.5]{boxminus} B$

        $A rescalesymbol{pitchfork} B$

        $scriptstyle A rescalesymbol{pitchfork} B$

        $A rescalesymbol[0.5]{pitchfork} B$

        $scriptstyle A rescalesymbol[0.5]{pitchfork} B$

        end{document}


        enter image description here



        If you want to set the kind of the symbol differently from its standard status of mathbin or mathrel, or you need a totally different kind, I suggest a trailing optional argument:



        documentclass{article}
        usepackage{amsmath}
        usepackage{amssymb}
        usepackage{graphicx}
        usepackage{xparse}

        makeatletter
        NewDocumentCommand{rescalesymbol}{O{0.75}mo}{%
        IfNoValueTF{#3}
        {%
        binrel@{#2}% this makes binrel@@ become mathbin, mathrel or empty
        binrel@@{rescale@symbol{#1}{#2}}%
        }
        {#3binrel@@{rescale@symbol{#1}{#2}}}%
        }
        newcommand{rescale@symbol}[2]{%
        mathpaletterescale@@symbol{{#1}{#2}}%
        }
        newcommand{rescale@@symbol}[2]{%
        rescale@@@symbol#1#2%
        }
        newcommand{rescale@@@symbol}[3]{%
        % #1=math style, #2=scale factor, #3=symbol
        vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
        }
        makeatother

        begin{document}

        $A rescalesymbol{boxminus} B$

        $scriptstyle A rescalesymbol{boxminus} B$

        $A rescalesymbol[0.5]{boxminus} B$

        $scriptstyle A rescalesymbol[0.5]{boxminus} B$

        $A rescalesymbol{pitchfork} B$

        $scriptstyle A rescalesymbol{pitchfork} B$

        $A rescalesymbol[0.5]{pitchfork}[mathop] B$

        $scriptstyle A rescalesymbol[0.5]{pitchfork}[mathop] B$

        end{document}


        enter image description here






        share|improve this answer














        You probably have mathop to vertically center the symbol with respect to the formula axis, but this only works if the argument to mathop is a single character.



        The amsmath package has a built-in mechanism for deciding whether a symbol is a mathbin or a mathrel, which is used for underset and overset.



        documentclass{article}
        usepackage{amsmath}
        usepackage{amssymb}
        usepackage{graphicx}

        makeatletter
        newcommand{rescalesymbol}[2][0.75]{%
        binrel@{#2}% this makes binrel@@ to mean mathbin, mathrel or empty
        binrel@@{rescale@symbol{#1}{#2}}%
        }
        newcommand{rescale@symbol}[2]{%
        mathpaletterescale@@symbol{{#1}{#2}}%
        }
        newcommand{rescale@@symbol}[2]{%
        rescale@@@symbol#1#2%
        }
        newcommand{rescale@@@symbol}[3]{%
        % #1=math style, #2=scale factor, #3=symbol
        vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
        }
        makeatother

        begin{document}

        $A rescalesymbol{boxminus} B$

        $scriptstyle A rescalesymbol{boxminus} B$

        $A rescalesymbol[0.5]{boxminus} B$

        $scriptstyle A rescalesymbol[0.5]{boxminus} B$

        $A rescalesymbol{pitchfork} B$

        $scriptstyle A rescalesymbol{pitchfork} B$

        $A rescalesymbol[0.5]{pitchfork} B$

        $scriptstyle A rescalesymbol[0.5]{pitchfork} B$

        end{document}


        enter image description here



        If you want to set the kind of the symbol differently from its standard status of mathbin or mathrel, or you need a totally different kind, I suggest a trailing optional argument:



        documentclass{article}
        usepackage{amsmath}
        usepackage{amssymb}
        usepackage{graphicx}
        usepackage{xparse}

        makeatletter
        NewDocumentCommand{rescalesymbol}{O{0.75}mo}{%
        IfNoValueTF{#3}
        {%
        binrel@{#2}% this makes binrel@@ become mathbin, mathrel or empty
        binrel@@{rescale@symbol{#1}{#2}}%
        }
        {#3binrel@@{rescale@symbol{#1}{#2}}}%
        }
        newcommand{rescale@symbol}[2]{%
        mathpaletterescale@@symbol{{#1}{#2}}%
        }
        newcommand{rescale@@symbol}[2]{%
        rescale@@@symbol#1#2%
        }
        newcommand{rescale@@@symbol}[3]{%
        % #1=math style, #2=scale factor, #3=symbol
        vcenter{hbox{scalebox{#2}{$m@th#1#3$}}}%
        }
        makeatother

        begin{document}

        $A rescalesymbol{boxminus} B$

        $scriptstyle A rescalesymbol{boxminus} B$

        $A rescalesymbol[0.5]{boxminus} B$

        $scriptstyle A rescalesymbol[0.5]{boxminus} B$

        $A rescalesymbol{pitchfork} B$

        $scriptstyle A rescalesymbol{pitchfork} B$

        $A rescalesymbol[0.5]{pitchfork}[mathop] B$

        $scriptstyle A rescalesymbol[0.5]{pitchfork}[mathop] B$

        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 22 '18 at 11:39

























        answered Nov 22 '18 at 11:29









        egreg

        710k8618863171




        710k8618863171






























            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%2f461249%2fhow-do-you-resize-the-box-of-a-symbol-while-vertically-centering-it%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

            mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

            How to change which sound is reproduced for terminal bell?

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