Why conflict between mathtools and Gonzalo's solution for auto-adjusting description environment?
Gonzalo Medina provided a nifty solution to "Automatically set description list labelwidth
based on widest label?." (The goal was to define a description
environment where the item text is automatically indented to the width of the widest label.)
I could replicate its success on a standalone basis, but when I incorporated it into my standard set of packages, it no longer produced the desired results. By a process of elimination, I discovered that simply loading the mathtools
package was sufficient to cause the problem.
I don't know where to begin to search for the conflict or a workaround, but I'm hoping someone with more experience, with mathtools
in particular, would spot it quickly.
Below is the MWE, straight out of Gonzalo's solution, except that I've inserted a commented-out usepackage{mathtools}
. (I've experimented with the order of loading mathtools
but nothing solved the problem.)
Without mathtools
, the proper output looks like:
With mathtools
, the improper output looks like:
documentclass{article}
usepackage{enumitem}
usepackage{environ}
%usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalsetlengthwidest{0pt}%
defitem[##1]{%
settowidth@tempdima{textbf{##1}}%
ifdim@tempdima>widestglobalsetlengthwidest{@tempdima}fi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
math-mode lists description calc
add a comment |
Gonzalo Medina provided a nifty solution to "Automatically set description list labelwidth
based on widest label?." (The goal was to define a description
environment where the item text is automatically indented to the width of the widest label.)
I could replicate its success on a standalone basis, but when I incorporated it into my standard set of packages, it no longer produced the desired results. By a process of elimination, I discovered that simply loading the mathtools
package was sufficient to cause the problem.
I don't know where to begin to search for the conflict or a workaround, but I'm hoping someone with more experience, with mathtools
in particular, would spot it quickly.
Below is the MWE, straight out of Gonzalo's solution, except that I've inserted a commented-out usepackage{mathtools}
. (I've experimented with the order of loading mathtools
but nothing solved the problem.)
Without mathtools
, the proper output looks like:
With mathtools
, the improper output looks like:
documentclass{article}
usepackage{enumitem}
usepackage{environ}
%usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalsetlengthwidest{0pt}%
defitem[##1]{%
settowidth@tempdima{textbf{##1}}%
ifdim@tempdima>widestglobalsetlengthwidest{@tempdima}fi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
math-mode lists description calc
add a comment |
Gonzalo Medina provided a nifty solution to "Automatically set description list labelwidth
based on widest label?." (The goal was to define a description
environment where the item text is automatically indented to the width of the widest label.)
I could replicate its success on a standalone basis, but when I incorporated it into my standard set of packages, it no longer produced the desired results. By a process of elimination, I discovered that simply loading the mathtools
package was sufficient to cause the problem.
I don't know where to begin to search for the conflict or a workaround, but I'm hoping someone with more experience, with mathtools
in particular, would spot it quickly.
Below is the MWE, straight out of Gonzalo's solution, except that I've inserted a commented-out usepackage{mathtools}
. (I've experimented with the order of loading mathtools
but nothing solved the problem.)
Without mathtools
, the proper output looks like:
With mathtools
, the improper output looks like:
documentclass{article}
usepackage{enumitem}
usepackage{environ}
%usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalsetlengthwidest{0pt}%
defitem[##1]{%
settowidth@tempdima{textbf{##1}}%
ifdim@tempdima>widestglobalsetlengthwidest{@tempdima}fi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
math-mode lists description calc
Gonzalo Medina provided a nifty solution to "Automatically set description list labelwidth
based on widest label?." (The goal was to define a description
environment where the item text is automatically indented to the width of the widest label.)
I could replicate its success on a standalone basis, but when I incorporated it into my standard set of packages, it no longer produced the desired results. By a process of elimination, I discovered that simply loading the mathtools
package was sufficient to cause the problem.
I don't know where to begin to search for the conflict or a workaround, but I'm hoping someone with more experience, with mathtools
in particular, would spot it quickly.
Below is the MWE, straight out of Gonzalo's solution, except that I've inserted a commented-out usepackage{mathtools}
. (I've experimented with the order of loading mathtools
but nothing solved the problem.)
Without mathtools
, the proper output looks like:
With mathtools
, the improper output looks like:
documentclass{article}
usepackage{enumitem}
usepackage{environ}
%usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalsetlengthwidest{0pt}%
defitem[##1]{%
settowidth@tempdima{textbf{##1}}%
ifdim@tempdima>widestglobalsetlengthwidest{@tempdima}fi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
math-mode lists description calc
math-mode lists description calc
edited Nov 21 '18 at 14:37
asked Nov 21 '18 at 3:15
Jim Ratliff
4831410
4831410
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
After loading the length widest
gets "reseted". This is not really triggered by mathtools
but by calc
, which gets loaded by mathtools
, as explained in this great answer. It is then easy to solve the problem: set the distance using =
rather than setlength
.
documentclass{article}
usepackage{enumitem}
usepackage{environ}
usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalwidest=0pt%
defitem[##1]{%
settowidth@tempdimb{textbf{##1}}%
ifdim@tempdima>widestrelax
globalwidest=@tempdimbfi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
1
I revised this answer quite a bit because I learned a lot from egreg's nice answer. Imagine how much I could learn from egreg's question, if he had one. ;-)
– marmot
Nov 21 '18 at 5:46
1
Wow. Super answer; both very interesting. (I keep discovering, mostly negatively, that commands are redefining things I rely on without my knowledge!) And very helpful. This saves the enterprise just by changing a few characters.
– Jim Ratliff
Nov 21 '18 at 5:52
1
@JimRatliff Thanks! I actually did not know any of this, so thanks a lot for this really nice question! (How did I get on track? I just addedtypeouts
at many positions of your/Gonzalo's code, which revealed thatwidest
got resetted. Then I did a google search withsite:tex.stackexchange.com mathtools setlength
, which lead me right to egregs answer. This kind of strategy, i.e.typeouts
and google searches withsite:tex.stackexchange.com
, can sometimes be useful.)
– marmot
Nov 21 '18 at 5:59
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%2f461056%2fwhy-conflict-between-mathtools-and-gonzalos-solution-for-auto-adjusting-descrip%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
After loading the length widest
gets "reseted". This is not really triggered by mathtools
but by calc
, which gets loaded by mathtools
, as explained in this great answer. It is then easy to solve the problem: set the distance using =
rather than setlength
.
documentclass{article}
usepackage{enumitem}
usepackage{environ}
usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalwidest=0pt%
defitem[##1]{%
settowidth@tempdimb{textbf{##1}}%
ifdim@tempdima>widestrelax
globalwidest=@tempdimbfi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
1
I revised this answer quite a bit because I learned a lot from egreg's nice answer. Imagine how much I could learn from egreg's question, if he had one. ;-)
– marmot
Nov 21 '18 at 5:46
1
Wow. Super answer; both very interesting. (I keep discovering, mostly negatively, that commands are redefining things I rely on without my knowledge!) And very helpful. This saves the enterprise just by changing a few characters.
– Jim Ratliff
Nov 21 '18 at 5:52
1
@JimRatliff Thanks! I actually did not know any of this, so thanks a lot for this really nice question! (How did I get on track? I just addedtypeouts
at many positions of your/Gonzalo's code, which revealed thatwidest
got resetted. Then I did a google search withsite:tex.stackexchange.com mathtools setlength
, which lead me right to egregs answer. This kind of strategy, i.e.typeouts
and google searches withsite:tex.stackexchange.com
, can sometimes be useful.)
– marmot
Nov 21 '18 at 5:59
add a comment |
After loading the length widest
gets "reseted". This is not really triggered by mathtools
but by calc
, which gets loaded by mathtools
, as explained in this great answer. It is then easy to solve the problem: set the distance using =
rather than setlength
.
documentclass{article}
usepackage{enumitem}
usepackage{environ}
usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalwidest=0pt%
defitem[##1]{%
settowidth@tempdimb{textbf{##1}}%
ifdim@tempdima>widestrelax
globalwidest=@tempdimbfi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
1
I revised this answer quite a bit because I learned a lot from egreg's nice answer. Imagine how much I could learn from egreg's question, if he had one. ;-)
– marmot
Nov 21 '18 at 5:46
1
Wow. Super answer; both very interesting. (I keep discovering, mostly negatively, that commands are redefining things I rely on without my knowledge!) And very helpful. This saves the enterprise just by changing a few characters.
– Jim Ratliff
Nov 21 '18 at 5:52
1
@JimRatliff Thanks! I actually did not know any of this, so thanks a lot for this really nice question! (How did I get on track? I just addedtypeouts
at many positions of your/Gonzalo's code, which revealed thatwidest
got resetted. Then I did a google search withsite:tex.stackexchange.com mathtools setlength
, which lead me right to egregs answer. This kind of strategy, i.e.typeouts
and google searches withsite:tex.stackexchange.com
, can sometimes be useful.)
– marmot
Nov 21 '18 at 5:59
add a comment |
After loading the length widest
gets "reseted". This is not really triggered by mathtools
but by calc
, which gets loaded by mathtools
, as explained in this great answer. It is then easy to solve the problem: set the distance using =
rather than setlength
.
documentclass{article}
usepackage{enumitem}
usepackage{environ}
usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalwidest=0pt%
defitem[##1]{%
settowidth@tempdimb{textbf{##1}}%
ifdim@tempdima>widestrelax
globalwidest=@tempdimbfi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
After loading the length widest
gets "reseted". This is not really triggered by mathtools
but by calc
, which gets loaded by mathtools
, as explained in this great answer. It is then easy to solve the problem: set the distance using =
rather than setlength
.
documentclass{article}
usepackage{enumitem}
usepackage{environ}
usepackage{mathtools}
newlengthwidest
makeatletter
NewEnviron{ldescription}{%
vbox{%
globalwidest=0pt%
defitem[##1]{%
settowidth@tempdimb{textbf{##1}}%
ifdim@tempdima>widestrelax
globalwidest=@tempdimbfi%
}%
setbox0=hbox{BODY}%
}
begin{description}[
leftmargin=dimexprwidest+0.5emrelax,
labelindent=0pt,
labelwidth=widest]
BODY
end{description}%
}
makeatother
begin{document}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A really really long label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
begin{ldescription}
item[Short] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
item[A medium label] text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
end{ldescription}
end{document}
edited Nov 21 '18 at 5:44
answered Nov 21 '18 at 5:38
marmot
87.7k4101189
87.7k4101189
1
I revised this answer quite a bit because I learned a lot from egreg's nice answer. Imagine how much I could learn from egreg's question, if he had one. ;-)
– marmot
Nov 21 '18 at 5:46
1
Wow. Super answer; both very interesting. (I keep discovering, mostly negatively, that commands are redefining things I rely on without my knowledge!) And very helpful. This saves the enterprise just by changing a few characters.
– Jim Ratliff
Nov 21 '18 at 5:52
1
@JimRatliff Thanks! I actually did not know any of this, so thanks a lot for this really nice question! (How did I get on track? I just addedtypeouts
at many positions of your/Gonzalo's code, which revealed thatwidest
got resetted. Then I did a google search withsite:tex.stackexchange.com mathtools setlength
, which lead me right to egregs answer. This kind of strategy, i.e.typeouts
and google searches withsite:tex.stackexchange.com
, can sometimes be useful.)
– marmot
Nov 21 '18 at 5:59
add a comment |
1
I revised this answer quite a bit because I learned a lot from egreg's nice answer. Imagine how much I could learn from egreg's question, if he had one. ;-)
– marmot
Nov 21 '18 at 5:46
1
Wow. Super answer; both very interesting. (I keep discovering, mostly negatively, that commands are redefining things I rely on without my knowledge!) And very helpful. This saves the enterprise just by changing a few characters.
– Jim Ratliff
Nov 21 '18 at 5:52
1
@JimRatliff Thanks! I actually did not know any of this, so thanks a lot for this really nice question! (How did I get on track? I just addedtypeouts
at many positions of your/Gonzalo's code, which revealed thatwidest
got resetted. Then I did a google search withsite:tex.stackexchange.com mathtools setlength
, which lead me right to egregs answer. This kind of strategy, i.e.typeouts
and google searches withsite:tex.stackexchange.com
, can sometimes be useful.)
– marmot
Nov 21 '18 at 5:59
1
1
I revised this answer quite a bit because I learned a lot from egreg's nice answer. Imagine how much I could learn from egreg's question, if he had one. ;-)
– marmot
Nov 21 '18 at 5:46
I revised this answer quite a bit because I learned a lot from egreg's nice answer. Imagine how much I could learn from egreg's question, if he had one. ;-)
– marmot
Nov 21 '18 at 5:46
1
1
Wow. Super answer; both very interesting. (I keep discovering, mostly negatively, that commands are redefining things I rely on without my knowledge!) And very helpful. This saves the enterprise just by changing a few characters.
– Jim Ratliff
Nov 21 '18 at 5:52
Wow. Super answer; both very interesting. (I keep discovering, mostly negatively, that commands are redefining things I rely on without my knowledge!) And very helpful. This saves the enterprise just by changing a few characters.
– Jim Ratliff
Nov 21 '18 at 5:52
1
1
@JimRatliff Thanks! I actually did not know any of this, so thanks a lot for this really nice question! (How did I get on track? I just added
typeouts
at many positions of your/Gonzalo's code, which revealed that widest
got resetted. Then I did a google search with site:tex.stackexchange.com mathtools setlength
, which lead me right to egregs answer. This kind of strategy, i.e. typeouts
and google searches with site:tex.stackexchange.com
, can sometimes be useful.)– marmot
Nov 21 '18 at 5:59
@JimRatliff Thanks! I actually did not know any of this, so thanks a lot for this really nice question! (How did I get on track? I just added
typeouts
at many positions of your/Gonzalo's code, which revealed that widest
got resetted. Then I did a google search with site:tex.stackexchange.com mathtools setlength
, which lead me right to egregs answer. This kind of strategy, i.e. typeouts
and google searches with site:tex.stackexchange.com
, can sometimes be useful.)– marmot
Nov 21 '18 at 5:59
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f461056%2fwhy-conflict-between-mathtools-and-gonzalos-solution-for-auto-adjusting-descrip%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