Is mathrel always needed?
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}
math-mode relation-symbols
|
show 3 more comments
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}
math-mode relation-symbols
1
!
doesmskip-thinmuskip
wherethinmuskip=3mu
, whereasjoinrel
doesmathrel{mkern-3mu}
, so if the atoms on both sides ofjoinrel
are also rel atoms, the two commands are equivalent.
– Henri Menke
Jan 24 at 21:00
1
mathrel
likemathbin
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
Jan 24 at 21:02
@TeXnician but in this case probably the "class" is already correct, isn't it?
– CarLaTeX
Jan 24 at 21:06
I actually don't know in which classesmid
andmodels
are but as the spacing seems correct it is probablymathbin
ormathrel
. 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
Jan 24 at 21:14
@TeXnician Thank you, your thought is correct, see Henri's answer :)
– CarLaTeX
Jan 24 at 21:16
|
show 3 more comments
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}
math-mode relation-symbols
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}
math-mode relation-symbols
math-mode relation-symbols
asked Jan 24 at 19:46
CarLaTeXCarLaTeX
30.8k449129
30.8k449129
1
!
doesmskip-thinmuskip
wherethinmuskip=3mu
, whereasjoinrel
doesmathrel{mkern-3mu}
, so if the atoms on both sides ofjoinrel
are also rel atoms, the two commands are equivalent.
– Henri Menke
Jan 24 at 21:00
1
mathrel
likemathbin
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
Jan 24 at 21:02
@TeXnician but in this case probably the "class" is already correct, isn't it?
– CarLaTeX
Jan 24 at 21:06
I actually don't know in which classesmid
andmodels
are but as the spacing seems correct it is probablymathbin
ormathrel
. 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
Jan 24 at 21:14
@TeXnician Thank you, your thought is correct, see Henri's answer :)
– CarLaTeX
Jan 24 at 21:16
|
show 3 more comments
1
!
doesmskip-thinmuskip
wherethinmuskip=3mu
, whereasjoinrel
doesmathrel{mkern-3mu}
, so if the atoms on both sides ofjoinrel
are also rel atoms, the two commands are equivalent.
– Henri Menke
Jan 24 at 21:00
1
mathrel
likemathbin
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
Jan 24 at 21:02
@TeXnician but in this case probably the "class" is already correct, isn't it?
– CarLaTeX
Jan 24 at 21:06
I actually don't know in which classesmid
andmodels
are but as the spacing seems correct it is probablymathbin
ormathrel
. 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
Jan 24 at 21:14
@TeXnician Thank you, your thought is correct, see Henri's answer :)
– CarLaTeX
Jan 24 at 21:16
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
Jan 24 at 21:00
!
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
Jan 24 at 21:00
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
Jan 24 at 21:02
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
Jan 24 at 21:02
@TeXnician but in this case probably the "class" is already correct, isn't it?
– CarLaTeX
Jan 24 at 21:06
@TeXnician but in this case probably the "class" is already correct, isn't it?
– CarLaTeX
Jan 24 at 21:06
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
Jan 24 at 21:14
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
Jan 24 at 21:14
@TeXnician Thank you, your thought is correct, see Henri's answer :)
– CarLaTeX
Jan 24 at 21:16
@TeXnician Thank you, your thought is correct, see Henri's answer :)
– CarLaTeX
Jan 24 at 21:16
|
show 3 more comments
2 Answers
2
active
oldest
votes
You can figure out what is going on using the table on page 170 of the TeXbook.
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.
add a comment |
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}
Eventually, are you saying the currentmodels
is not perfect?
– CarLaTeX
Jan 24 at 21:50
2
@CarLaTeX I dare to!;-)
Besides, there are better symbols inamssymb
.
– egreg
Jan 24 at 22:01
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
Jan 25 at 6:05
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
You can figure out what is going on using the table on page 170 of the TeXbook.
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.
add a comment |
You can figure out what is going on using the table on page 170 of the TeXbook.
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.
add a comment |
You can figure out what is going on using the table on page 170 of the TeXbook.
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.
You can figure out what is going on using the table on page 170 of the TeXbook.
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.
edited Jan 25 at 6:04
answered Jan 24 at 21:10
Henri MenkeHenri Menke
72.6k8160270
72.6k8160270
add a comment |
add a comment |
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}
Eventually, are you saying the currentmodels
is not perfect?
– CarLaTeX
Jan 24 at 21:50
2
@CarLaTeX I dare to!;-)
Besides, there are better symbols inamssymb
.
– egreg
Jan 24 at 22:01
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
Jan 25 at 6:05
add a comment |
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}
Eventually, are you saying the currentmodels
is not perfect?
– CarLaTeX
Jan 24 at 21:50
2
@CarLaTeX I dare to!;-)
Besides, there are better symbols inamssymb
.
– egreg
Jan 24 at 22:01
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
Jan 25 at 6:05
add a comment |
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}
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}
edited Jan 24 at 21:43
answered Jan 24 at 21:37
egregegreg
716k8619023191
716k8619023191
Eventually, are you saying the currentmodels
is not perfect?
– CarLaTeX
Jan 24 at 21:50
2
@CarLaTeX I dare to!;-)
Besides, there are better symbols inamssymb
.
– egreg
Jan 24 at 22:01
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
Jan 25 at 6:05
add a comment |
Eventually, are you saying the currentmodels
is not perfect?
– CarLaTeX
Jan 24 at 21:50
2
@CarLaTeX I dare to!;-)
Besides, there are better symbols inamssymb
.
– egreg
Jan 24 at 22:01
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
Jan 25 at 6:05
Eventually, are you saying the current
models
is not perfect?– CarLaTeX
Jan 24 at 21:50
Eventually, are you saying the current
models
is not perfect?– CarLaTeX
Jan 24 at 21:50
2
2
@CarLaTeX I dare to!
;-)
Besides, there are better symbols in amssymb
.– egreg
Jan 24 at 22:01
@CarLaTeX I dare to!
;-)
Besides, there are better symbols in amssymb
.– egreg
Jan 24 at 22:01
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
Jan 25 at 6:05
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
Jan 25 at 6:05
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
!
doesmskip-thinmuskip
wherethinmuskip=3mu
, whereasjoinrel
doesmathrel{mkern-3mu}
, so if the atoms on both sides ofjoinrel
are also rel atoms, the two commands are equivalent.– Henri Menke
Jan 24 at 21:00
1
mathrel
likemathbin
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
Jan 24 at 21:02
@TeXnician but in this case probably the "class" is already correct, isn't it?
– CarLaTeX
Jan 24 at 21:06
I actually don't know in which classes
mid
andmodels
are but as the spacing seems correct it is probablymathbin
ormathrel
. 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
Jan 24 at 21:14
@TeXnician Thank you, your thought is correct, see Henri's answer :)
– CarLaTeX
Jan 24 at 21:16