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











up vote
5
down vote

favorite












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
    2 days ago












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    2 days ago















up vote
5
down vote

favorite












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
    2 days ago












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    2 days ago













up vote
5
down vote

favorite









up vote
5
down vote

favorite











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 2 days ago









Martin Scharrer

197k45629812




197k45629812










asked 2 days ago









Fosco Loregian

586515




586515








  • 1




    Are you sure it should be mathop? The use example suggests mathbin.
    – egreg
    2 days ago












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    2 days ago














  • 1




    Are you sure it should be mathop? The use example suggests mathbin.
    – egreg
    2 days ago












  • Mh. Of course it depends on the kind of symbol you have to rescale...
    – Fosco Loregian
    2 days ago








1




1




Are you sure it should be mathop? The use example suggests mathbin.
– egreg
2 days ago






Are you sure it should be mathop? The use example suggests mathbin.
– egreg
2 days ago














Mh. Of course it depends on the kind of symbol you have to rescale...
– Fosco Loregian
2 days ago




Mh. Of course it depends on the kind of symbol you have to rescale...
– Fosco Loregian
2 days ago










2 Answers
2






active

oldest

votes

















up vote
5
down vote



accepted










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
    2 days ago


















up vote
5
down vote













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',
    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








    up vote
    5
    down vote



    accepted










    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
      2 days ago















    up vote
    5
    down vote



    accepted










    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
      2 days ago













    up vote
    5
    down vote



    accepted







    up vote
    5
    down vote



    accepted






    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 2 days ago

























    answered 2 days ago









    AboAmmar

    31.1k22780




    31.1k22780












    • 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
      2 days ago


















    • 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
      2 days ago
















    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
    2 days ago




    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
    2 days ago










    up vote
    5
    down vote













    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



























      up vote
      5
      down vote













      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

























        up vote
        5
        down vote










        up vote
        5
        down vote









        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 2 days ago

























        answered 2 days ago









        egreg

        699k8518613132




        699k8518613132






























             

            draft saved


            draft discarded



















































             


            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

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy