Is mathrel always needed?












10















I answered another question (LaTeX models symbol that goes both ways) creating a new symbol, a relation, without using mathrel.



In his answer to the same question, Werner used it (he also used joinrel, a command I didn't know, where I used !).



In this case, however, I see no difference in the results with or without mathrel. Is it always needed?



documentclass{article} 
newcommand{mymod}{mathrel{models!mid}}
newcommand{mymode}{models!mid}
newcommand{mymodel}{mathrel{modelsjoinrelmid}}
begin{document}
This is without verb|mathrel|, with verb|!|:
[ A mymod Bquad {scriptstyle A mymod B }quad {scriptscriptstyle A mymod B }]
This is with verb|mathrel|, with verb|!|:
[ A mymode Bquad {scriptstyle A mymode B }quad {scriptscriptstyle A mymode B } ]
This is with verb|mathrel| and verb|joinrel|:
[ A mymodel B quad {scriptstyle A mymodel B }quad {scriptscriptstyle A mymodel B }]
They seem the same to me. What is the difference?
end{document}


enter image description here










share|improve this question


















  • 1





    ! does mskip-thinmuskip where thinmuskip=3mu, whereas joinrel does mathrel{mkern-3mu}, so if the atoms on both sides of joinrel are also rel atoms, the two commands are equivalent.

    – Henri Menke
    2 days ago






  • 1





    mathrel like mathbin etc. adjust the "class" of the following group. The different groups are described in the TeX Book. It's basically to tell the system the semantics of your symbol.

    – TeXnician
    2 days ago











  • @TeXnician but in this case probably the "class" is already correct, isn't it?

    – CarLaTeX
    2 days ago











  • I actually don't know in which classes mid and models are but as the spacing seems correct it is probably mathbin or mathrel. The only semantic difference is that you now do not have one relation but actually two following each other (models and mid). I don't know whether this might have any side effects on the spacing but I think that, as long as you are not adding any groups inbetween, you are safe.

    – TeXnician
    2 days ago











  • @TeXnician Thank you, your thought is correct, see Henri's answer :)

    – CarLaTeX
    2 days ago
















10















I answered another question (LaTeX models symbol that goes both ways) creating a new symbol, a relation, without using mathrel.



In his answer to the same question, Werner used it (he also used joinrel, a command I didn't know, where I used !).



In this case, however, I see no difference in the results with or without mathrel. Is it always needed?



documentclass{article} 
newcommand{mymod}{mathrel{models!mid}}
newcommand{mymode}{models!mid}
newcommand{mymodel}{mathrel{modelsjoinrelmid}}
begin{document}
This is without verb|mathrel|, with verb|!|:
[ A mymod Bquad {scriptstyle A mymod B }quad {scriptscriptstyle A mymod B }]
This is with verb|mathrel|, with verb|!|:
[ A mymode Bquad {scriptstyle A mymode B }quad {scriptscriptstyle A mymode B } ]
This is with verb|mathrel| and verb|joinrel|:
[ A mymodel B quad {scriptstyle A mymodel B }quad {scriptscriptstyle A mymodel B }]
They seem the same to me. What is the difference?
end{document}


enter image description here










share|improve this question


















  • 1





    ! does mskip-thinmuskip where thinmuskip=3mu, whereas joinrel does mathrel{mkern-3mu}, so if the atoms on both sides of joinrel are also rel atoms, the two commands are equivalent.

    – Henri Menke
    2 days ago






  • 1





    mathrel like mathbin etc. adjust the "class" of the following group. The different groups are described in the TeX Book. It's basically to tell the system the semantics of your symbol.

    – TeXnician
    2 days ago











  • @TeXnician but in this case probably the "class" is already correct, isn't it?

    – CarLaTeX
    2 days ago











  • I actually don't know in which classes mid and models are but as the spacing seems correct it is probably mathbin or mathrel. The only semantic difference is that you now do not have one relation but actually two following each other (models and mid). I don't know whether this might have any side effects on the spacing but I think that, as long as you are not adding any groups inbetween, you are safe.

    – TeXnician
    2 days ago











  • @TeXnician Thank you, your thought is correct, see Henri's answer :)

    – CarLaTeX
    2 days ago














10












10








10








I answered another question (LaTeX models symbol that goes both ways) creating a new symbol, a relation, without using mathrel.



In his answer to the same question, Werner used it (he also used joinrel, a command I didn't know, where I used !).



In this case, however, I see no difference in the results with or without mathrel. Is it always needed?



documentclass{article} 
newcommand{mymod}{mathrel{models!mid}}
newcommand{mymode}{models!mid}
newcommand{mymodel}{mathrel{modelsjoinrelmid}}
begin{document}
This is without verb|mathrel|, with verb|!|:
[ A mymod Bquad {scriptstyle A mymod B }quad {scriptscriptstyle A mymod B }]
This is with verb|mathrel|, with verb|!|:
[ A mymode Bquad {scriptstyle A mymode B }quad {scriptscriptstyle A mymode B } ]
This is with verb|mathrel| and verb|joinrel|:
[ A mymodel B quad {scriptstyle A mymodel B }quad {scriptscriptstyle A mymodel B }]
They seem the same to me. What is the difference?
end{document}


enter image description here










share|improve this question














I answered another question (LaTeX models symbol that goes both ways) creating a new symbol, a relation, without using mathrel.



In his answer to the same question, Werner used it (he also used joinrel, a command I didn't know, where I used !).



In this case, however, I see no difference in the results with or without mathrel. Is it always needed?



documentclass{article} 
newcommand{mymod}{mathrel{models!mid}}
newcommand{mymode}{models!mid}
newcommand{mymodel}{mathrel{modelsjoinrelmid}}
begin{document}
This is without verb|mathrel|, with verb|!|:
[ A mymod Bquad {scriptstyle A mymod B }quad {scriptscriptstyle A mymod B }]
This is with verb|mathrel|, with verb|!|:
[ A mymode Bquad {scriptstyle A mymode B }quad {scriptscriptstyle A mymode B } ]
This is with verb|mathrel| and verb|joinrel|:
[ A mymodel B quad {scriptstyle A mymodel B }quad {scriptscriptstyle A mymodel B }]
They seem the same to me. What is the difference?
end{document}


enter image description here







math-mode relation-symbols






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 days ago









CarLaTeXCarLaTeX

30.7k449129




30.7k449129








  • 1





    ! does mskip-thinmuskip where thinmuskip=3mu, whereas joinrel does mathrel{mkern-3mu}, so if the atoms on both sides of joinrel are also rel atoms, the two commands are equivalent.

    – Henri Menke
    2 days ago






  • 1





    mathrel like mathbin etc. adjust the "class" of the following group. The different groups are described in the TeX Book. It's basically to tell the system the semantics of your symbol.

    – TeXnician
    2 days ago











  • @TeXnician but in this case probably the "class" is already correct, isn't it?

    – CarLaTeX
    2 days ago











  • I actually don't know in which classes mid and models are but as the spacing seems correct it is probably mathbin or mathrel. The only semantic difference is that you now do not have one relation but actually two following each other (models and mid). I don't know whether this might have any side effects on the spacing but I think that, as long as you are not adding any groups inbetween, you are safe.

    – TeXnician
    2 days ago











  • @TeXnician Thank you, your thought is correct, see Henri's answer :)

    – CarLaTeX
    2 days ago














  • 1





    ! does mskip-thinmuskip where thinmuskip=3mu, whereas joinrel does mathrel{mkern-3mu}, so if the atoms on both sides of joinrel are also rel atoms, the two commands are equivalent.

    – Henri Menke
    2 days ago






  • 1





    mathrel like mathbin etc. adjust the "class" of the following group. The different groups are described in the TeX Book. It's basically to tell the system the semantics of your symbol.

    – TeXnician
    2 days ago











  • @TeXnician but in this case probably the "class" is already correct, isn't it?

    – CarLaTeX
    2 days ago











  • I actually don't know in which classes mid and models are but as the spacing seems correct it is probably mathbin or mathrel. The only semantic difference is that you now do not have one relation but actually two following each other (models and mid). I don't know whether this might have any side effects on the spacing but I think that, as long as you are not adding any groups inbetween, you are safe.

    – TeXnician
    2 days ago











  • @TeXnician Thank you, your thought is correct, see Henri's answer :)

    – CarLaTeX
    2 days ago








1




1





! does mskip-thinmuskip where thinmuskip=3mu, whereas joinrel does mathrel{mkern-3mu}, so if the atoms on both sides of joinrel are also rel atoms, the two commands are equivalent.

– Henri Menke
2 days ago





! does mskip-thinmuskip where thinmuskip=3mu, whereas joinrel does mathrel{mkern-3mu}, so if the atoms on both sides of joinrel are also rel atoms, the two commands are equivalent.

– Henri Menke
2 days ago




1




1





mathrel like mathbin etc. adjust the "class" of the following group. The different groups are described in the TeX Book. It's basically to tell the system the semantics of your symbol.

– TeXnician
2 days ago





mathrel like mathbin etc. adjust the "class" of the following group. The different groups are described in the TeX Book. It's basically to tell the system the semantics of your symbol.

– TeXnician
2 days ago













@TeXnician but in this case probably the "class" is already correct, isn't it?

– CarLaTeX
2 days ago





@TeXnician but in this case probably the "class" is already correct, isn't it?

– CarLaTeX
2 days ago













I actually don't know in which classes mid and models are but as the spacing seems correct it is probably mathbin or mathrel. The only semantic difference is that you now do not have one relation but actually two following each other (models and mid). I don't know whether this might have any side effects on the spacing but I think that, as long as you are not adding any groups inbetween, you are safe.

– TeXnician
2 days ago





I actually don't know in which classes mid and models are but as the spacing seems correct it is probably mathbin or mathrel. The only semantic difference is that you now do not have one relation but actually two following each other (models and mid). I don't know whether this might have any side effects on the spacing but I think that, as long as you are not adding any groups inbetween, you are safe.

– TeXnician
2 days ago













@TeXnician Thank you, your thought is correct, see Henri's answer :)

– CarLaTeX
2 days ago





@TeXnician Thank you, your thought is correct, see Henri's answer :)

– CarLaTeX
2 days ago










2 Answers
2






active

oldest

votes


















10














You can figure out what is going on using the table on page 170 of the TeXbook.




enter image description here



Here 0, 1, 2, and 3 stand for no space, thin space, medium space, and thick space, respectively; the table entry is parenthesized if the space is to be inserted only in display and text styles, not in script and scriptscript styles.




First we look at the definitions of models, mid, !, and joinrel. For simplicity I use the definitions from Plain TeX (the LaTeX definitions are similar but with some extra protect and stuff).



defmodels{mathrel|joinrel=}
mathchardefmid="326A
def!{mskip-thinmuskip} % thinmuskip=3mu
defjoinrel{mathrel{mkern-3mu}}


Checking in the table the spacing between a Rel and a Rel atom we find 0, i.e. no spacing at all. That means that there will be no space inserted between any of the atoms in any of the following sequences because all the atoms are Rel (except mskip which is not an atom)



models!mid
modelsjoinrelmid


Because the leftmost and rightmost atoms in these sequences are of type Rel, the whole sequence will behave like a Rel atom (with respect to spacing). So in this case the enclosing mathrel is redundant.






share|improve this answer

































    9














    The ugly



    newcommand{mymodel}{mathrel{modelsjoinrelmid}} 


    The bad



    newcommand{mymod}{mathrel{models!mid}} 
    newcommand{mymode}{models!mid}


    The good



    newcommand{foo}{modelsjoinrelmid}


    The best™



    DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}
    letmodelsrelax % undefine models
    DeclareRobustCommand{models}{mathrel{|}xjoinrelRelbar} %% YES!
    DeclareRobustCommand{mymod}{mathrel{|}xjoinrelRelbarxjoinrelmathrel{|}}


    Explanations



    TeX never adds space between two consecutive relation symbols. Since models is defined as mathrel{|}joinrelRelbar and all three are relation symbols, the first method has a redundant mathrel.



    The command joinrel is mathrel{mkern-3mu}. Using mid and mathrel{|} is the same, but in this context mathrel{|} is better because mid might be used for a different symbol.



    Why are the other two bad? Because ! is not the right spacing.



    The good is just what's needed, because it gives a relation and adds no spaces in between.



    The best method avoids the little gap between the Relbar and mid. Look closely in the table below.



    documentclass{article}
    usepackage{amsmath}
    usepackage{booktabs}

    DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}

    renewcommand{models}{%
    mathrel{|}
    xjoinrel
    Relbar
    }
    newcommand{modeledby}{%
    Relbar
    xjoinrel
    mathrel{|}
    }
    newcommand{doublemodels}{%
    mathrel{|}
    xjoinrel
    Relbar
    xjoinrel
    mathrel{|}
    }

    begin{document}

    begin{tabular}{cc}
    toprule
    New & Old \
    midrule
    $Amodels B$ & $AmidjoinrelRelbar B$ \
    $Amodeledby B$ & $A Relbarjoinrelmid B$ \
    $Adoublemodels B$ & $A midjoinrelRelbarjoinrelmid B$ \
    bottomrule
    end{tabular}

    end{document}


    enter image description here






    share|improve this answer


























    • Eventually, are you saying the current models is not perfect?

      – CarLaTeX
      2 days ago






    • 2





      @CarLaTeX I dare to! ;-) Besides, there are better symbols in amssymb.

      – egreg
      2 days ago













    • It has been very difficult to choose which answer to accept. I accepted Henri's one because it is more focalized on the general problem rather than the specific symbol. Moreover: tex.meta.stackexchange.com/a/7463/101651 :)

      – CarLaTeX
      yesterday











    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%2f471713%2fis-mathrel-always-needed%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









    10














    You can figure out what is going on using the table on page 170 of the TeXbook.




    enter image description here



    Here 0, 1, 2, and 3 stand for no space, thin space, medium space, and thick space, respectively; the table entry is parenthesized if the space is to be inserted only in display and text styles, not in script and scriptscript styles.




    First we look at the definitions of models, mid, !, and joinrel. For simplicity I use the definitions from Plain TeX (the LaTeX definitions are similar but with some extra protect and stuff).



    defmodels{mathrel|joinrel=}
    mathchardefmid="326A
    def!{mskip-thinmuskip} % thinmuskip=3mu
    defjoinrel{mathrel{mkern-3mu}}


    Checking in the table the spacing between a Rel and a Rel atom we find 0, i.e. no spacing at all. That means that there will be no space inserted between any of the atoms in any of the following sequences because all the atoms are Rel (except mskip which is not an atom)



    models!mid
    modelsjoinrelmid


    Because the leftmost and rightmost atoms in these sequences are of type Rel, the whole sequence will behave like a Rel atom (with respect to spacing). So in this case the enclosing mathrel is redundant.






    share|improve this answer






























      10














      You can figure out what is going on using the table on page 170 of the TeXbook.




      enter image description here



      Here 0, 1, 2, and 3 stand for no space, thin space, medium space, and thick space, respectively; the table entry is parenthesized if the space is to be inserted only in display and text styles, not in script and scriptscript styles.




      First we look at the definitions of models, mid, !, and joinrel. For simplicity I use the definitions from Plain TeX (the LaTeX definitions are similar but with some extra protect and stuff).



      defmodels{mathrel|joinrel=}
      mathchardefmid="326A
      def!{mskip-thinmuskip} % thinmuskip=3mu
      defjoinrel{mathrel{mkern-3mu}}


      Checking in the table the spacing between a Rel and a Rel atom we find 0, i.e. no spacing at all. That means that there will be no space inserted between any of the atoms in any of the following sequences because all the atoms are Rel (except mskip which is not an atom)



      models!mid
      modelsjoinrelmid


      Because the leftmost and rightmost atoms in these sequences are of type Rel, the whole sequence will behave like a Rel atom (with respect to spacing). So in this case the enclosing mathrel is redundant.






      share|improve this answer




























        10












        10








        10







        You can figure out what is going on using the table on page 170 of the TeXbook.




        enter image description here



        Here 0, 1, 2, and 3 stand for no space, thin space, medium space, and thick space, respectively; the table entry is parenthesized if the space is to be inserted only in display and text styles, not in script and scriptscript styles.




        First we look at the definitions of models, mid, !, and joinrel. For simplicity I use the definitions from Plain TeX (the LaTeX definitions are similar but with some extra protect and stuff).



        defmodels{mathrel|joinrel=}
        mathchardefmid="326A
        def!{mskip-thinmuskip} % thinmuskip=3mu
        defjoinrel{mathrel{mkern-3mu}}


        Checking in the table the spacing between a Rel and a Rel atom we find 0, i.e. no spacing at all. That means that there will be no space inserted between any of the atoms in any of the following sequences because all the atoms are Rel (except mskip which is not an atom)



        models!mid
        modelsjoinrelmid


        Because the leftmost and rightmost atoms in these sequences are of type Rel, the whole sequence will behave like a Rel atom (with respect to spacing). So in this case the enclosing mathrel is redundant.






        share|improve this answer















        You can figure out what is going on using the table on page 170 of the TeXbook.




        enter image description here



        Here 0, 1, 2, and 3 stand for no space, thin space, medium space, and thick space, respectively; the table entry is parenthesized if the space is to be inserted only in display and text styles, not in script and scriptscript styles.




        First we look at the definitions of models, mid, !, and joinrel. For simplicity I use the definitions from Plain TeX (the LaTeX definitions are similar but with some extra protect and stuff).



        defmodels{mathrel|joinrel=}
        mathchardefmid="326A
        def!{mskip-thinmuskip} % thinmuskip=3mu
        defjoinrel{mathrel{mkern-3mu}}


        Checking in the table the spacing between a Rel and a Rel atom we find 0, i.e. no spacing at all. That means that there will be no space inserted between any of the atoms in any of the following sequences because all the atoms are Rel (except mskip which is not an atom)



        models!mid
        modelsjoinrelmid


        Because the leftmost and rightmost atoms in these sequences are of type Rel, the whole sequence will behave like a Rel atom (with respect to spacing). So in this case the enclosing mathrel is redundant.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday

























        answered 2 days ago









        Henri MenkeHenri Menke

        72k8159268




        72k8159268























            9














            The ugly



            newcommand{mymodel}{mathrel{modelsjoinrelmid}} 


            The bad



            newcommand{mymod}{mathrel{models!mid}} 
            newcommand{mymode}{models!mid}


            The good



            newcommand{foo}{modelsjoinrelmid}


            The best™



            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}
            letmodelsrelax % undefine models
            DeclareRobustCommand{models}{mathrel{|}xjoinrelRelbar} %% YES!
            DeclareRobustCommand{mymod}{mathrel{|}xjoinrelRelbarxjoinrelmathrel{|}}


            Explanations



            TeX never adds space between two consecutive relation symbols. Since models is defined as mathrel{|}joinrelRelbar and all three are relation symbols, the first method has a redundant mathrel.



            The command joinrel is mathrel{mkern-3mu}. Using mid and mathrel{|} is the same, but in this context mathrel{|} is better because mid might be used for a different symbol.



            Why are the other two bad? Because ! is not the right spacing.



            The good is just what's needed, because it gives a relation and adds no spaces in between.



            The best method avoids the little gap between the Relbar and mid. Look closely in the table below.



            documentclass{article}
            usepackage{amsmath}
            usepackage{booktabs}

            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}

            renewcommand{models}{%
            mathrel{|}
            xjoinrel
            Relbar
            }
            newcommand{modeledby}{%
            Relbar
            xjoinrel
            mathrel{|}
            }
            newcommand{doublemodels}{%
            mathrel{|}
            xjoinrel
            Relbar
            xjoinrel
            mathrel{|}
            }

            begin{document}

            begin{tabular}{cc}
            toprule
            New & Old \
            midrule
            $Amodels B$ & $AmidjoinrelRelbar B$ \
            $Amodeledby B$ & $A Relbarjoinrelmid B$ \
            $Adoublemodels B$ & $A midjoinrelRelbarjoinrelmid B$ \
            bottomrule
            end{tabular}

            end{document}


            enter image description here






            share|improve this answer


























            • Eventually, are you saying the current models is not perfect?

              – CarLaTeX
              2 days ago






            • 2





              @CarLaTeX I dare to! ;-) Besides, there are better symbols in amssymb.

              – egreg
              2 days ago













            • It has been very difficult to choose which answer to accept. I accepted Henri's one because it is more focalized on the general problem rather than the specific symbol. Moreover: tex.meta.stackexchange.com/a/7463/101651 :)

              – CarLaTeX
              yesterday
















            9














            The ugly



            newcommand{mymodel}{mathrel{modelsjoinrelmid}} 


            The bad



            newcommand{mymod}{mathrel{models!mid}} 
            newcommand{mymode}{models!mid}


            The good



            newcommand{foo}{modelsjoinrelmid}


            The best™



            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}
            letmodelsrelax % undefine models
            DeclareRobustCommand{models}{mathrel{|}xjoinrelRelbar} %% YES!
            DeclareRobustCommand{mymod}{mathrel{|}xjoinrelRelbarxjoinrelmathrel{|}}


            Explanations



            TeX never adds space between two consecutive relation symbols. Since models is defined as mathrel{|}joinrelRelbar and all three are relation symbols, the first method has a redundant mathrel.



            The command joinrel is mathrel{mkern-3mu}. Using mid and mathrel{|} is the same, but in this context mathrel{|} is better because mid might be used for a different symbol.



            Why are the other two bad? Because ! is not the right spacing.



            The good is just what's needed, because it gives a relation and adds no spaces in between.



            The best method avoids the little gap between the Relbar and mid. Look closely in the table below.



            documentclass{article}
            usepackage{amsmath}
            usepackage{booktabs}

            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}

            renewcommand{models}{%
            mathrel{|}
            xjoinrel
            Relbar
            }
            newcommand{modeledby}{%
            Relbar
            xjoinrel
            mathrel{|}
            }
            newcommand{doublemodels}{%
            mathrel{|}
            xjoinrel
            Relbar
            xjoinrel
            mathrel{|}
            }

            begin{document}

            begin{tabular}{cc}
            toprule
            New & Old \
            midrule
            $Amodels B$ & $AmidjoinrelRelbar B$ \
            $Amodeledby B$ & $A Relbarjoinrelmid B$ \
            $Adoublemodels B$ & $A midjoinrelRelbarjoinrelmid B$ \
            bottomrule
            end{tabular}

            end{document}


            enter image description here






            share|improve this answer


























            • Eventually, are you saying the current models is not perfect?

              – CarLaTeX
              2 days ago






            • 2





              @CarLaTeX I dare to! ;-) Besides, there are better symbols in amssymb.

              – egreg
              2 days ago













            • It has been very difficult to choose which answer to accept. I accepted Henri's one because it is more focalized on the general problem rather than the specific symbol. Moreover: tex.meta.stackexchange.com/a/7463/101651 :)

              – CarLaTeX
              yesterday














            9












            9








            9







            The ugly



            newcommand{mymodel}{mathrel{modelsjoinrelmid}} 


            The bad



            newcommand{mymod}{mathrel{models!mid}} 
            newcommand{mymode}{models!mid}


            The good



            newcommand{foo}{modelsjoinrelmid}


            The best™



            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}
            letmodelsrelax % undefine models
            DeclareRobustCommand{models}{mathrel{|}xjoinrelRelbar} %% YES!
            DeclareRobustCommand{mymod}{mathrel{|}xjoinrelRelbarxjoinrelmathrel{|}}


            Explanations



            TeX never adds space between two consecutive relation symbols. Since models is defined as mathrel{|}joinrelRelbar and all three are relation symbols, the first method has a redundant mathrel.



            The command joinrel is mathrel{mkern-3mu}. Using mid and mathrel{|} is the same, but in this context mathrel{|} is better because mid might be used for a different symbol.



            Why are the other two bad? Because ! is not the right spacing.



            The good is just what's needed, because it gives a relation and adds no spaces in between.



            The best method avoids the little gap between the Relbar and mid. Look closely in the table below.



            documentclass{article}
            usepackage{amsmath}
            usepackage{booktabs}

            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}

            renewcommand{models}{%
            mathrel{|}
            xjoinrel
            Relbar
            }
            newcommand{modeledby}{%
            Relbar
            xjoinrel
            mathrel{|}
            }
            newcommand{doublemodels}{%
            mathrel{|}
            xjoinrel
            Relbar
            xjoinrel
            mathrel{|}
            }

            begin{document}

            begin{tabular}{cc}
            toprule
            New & Old \
            midrule
            $Amodels B$ & $AmidjoinrelRelbar B$ \
            $Amodeledby B$ & $A Relbarjoinrelmid B$ \
            $Adoublemodels B$ & $A midjoinrelRelbarjoinrelmid B$ \
            bottomrule
            end{tabular}

            end{document}


            enter image description here






            share|improve this answer















            The ugly



            newcommand{mymodel}{mathrel{modelsjoinrelmid}} 


            The bad



            newcommand{mymod}{mathrel{models!mid}} 
            newcommand{mymode}{models!mid}


            The good



            newcommand{foo}{modelsjoinrelmid}


            The best™



            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}
            letmodelsrelax % undefine models
            DeclareRobustCommand{models}{mathrel{|}xjoinrelRelbar} %% YES!
            DeclareRobustCommand{mymod}{mathrel{|}xjoinrelRelbarxjoinrelmathrel{|}}


            Explanations



            TeX never adds space between two consecutive relation symbols. Since models is defined as mathrel{|}joinrelRelbar and all three are relation symbols, the first method has a redundant mathrel.



            The command joinrel is mathrel{mkern-3mu}. Using mid and mathrel{|} is the same, but in this context mathrel{|} is better because mid might be used for a different symbol.



            Why are the other two bad? Because ! is not the right spacing.



            The good is just what's needed, because it gives a relation and adds no spaces in between.



            The best method avoids the little gap between the Relbar and mid. Look closely in the table below.



            documentclass{article}
            usepackage{amsmath}
            usepackage{booktabs}

            DeclareRobustCommand{xjoinrel}{mathrel{mkern-3.5mu}}

            renewcommand{models}{%
            mathrel{|}
            xjoinrel
            Relbar
            }
            newcommand{modeledby}{%
            Relbar
            xjoinrel
            mathrel{|}
            }
            newcommand{doublemodels}{%
            mathrel{|}
            xjoinrel
            Relbar
            xjoinrel
            mathrel{|}
            }

            begin{document}

            begin{tabular}{cc}
            toprule
            New & Old \
            midrule
            $Amodels B$ & $AmidjoinrelRelbar B$ \
            $Amodeledby B$ & $A Relbarjoinrelmid B$ \
            $Adoublemodels B$ & $A midjoinrelRelbarjoinrelmid B$ \
            bottomrule
            end{tabular}

            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









            egregegreg

            715k8619003186




            715k8619003186













            • Eventually, are you saying the current models is not perfect?

              – CarLaTeX
              2 days ago






            • 2





              @CarLaTeX I dare to! ;-) Besides, there are better symbols in amssymb.

              – egreg
              2 days ago













            • It has been very difficult to choose which answer to accept. I accepted Henri's one because it is more focalized on the general problem rather than the specific symbol. Moreover: tex.meta.stackexchange.com/a/7463/101651 :)

              – CarLaTeX
              yesterday



















            • Eventually, are you saying the current models is not perfect?

              – CarLaTeX
              2 days ago






            • 2





              @CarLaTeX I dare to! ;-) Besides, there are better symbols in amssymb.

              – egreg
              2 days ago













            • It has been very difficult to choose which answer to accept. I accepted Henri's one because it is more focalized on the general problem rather than the specific symbol. Moreover: tex.meta.stackexchange.com/a/7463/101651 :)

              – CarLaTeX
              yesterday

















            Eventually, are you saying the current models is not perfect?

            – CarLaTeX
            2 days ago





            Eventually, are you saying the current models is not perfect?

            – CarLaTeX
            2 days ago




            2




            2





            @CarLaTeX I dare to! ;-) Besides, there are better symbols in amssymb.

            – egreg
            2 days ago







            @CarLaTeX I dare to! ;-) Besides, there are better symbols in amssymb.

            – egreg
            2 days ago















            It has been very difficult to choose which answer to accept. I accepted Henri's one because it is more focalized on the general problem rather than the specific symbol. Moreover: tex.meta.stackexchange.com/a/7463/101651 :)

            – CarLaTeX
            yesterday





            It has been very difficult to choose which answer to accept. I accepted Henri's one because it is more focalized on the general problem rather than the specific symbol. Moreover: tex.meta.stackexchange.com/a/7463/101651 :)

            – CarLaTeX
            yesterday


















            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%2f471713%2fis-mathrel-always-needed%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

            Origin of the phrase “under your belt”?