herries-press
herries-press copied to clipboard
Make \RequirePackage{tocloft} work before \documentclass
As pointed out on TeX.SE, \RequirePackage{tocloft} currently doesn't work before \documentclass and that's too bad : it would be helpful for classes which load packages that need tocloft to be loaded before them, such as etoc.
Hence, would it be possible to make \RequirePackage{tocloft} work before \documentclass, e.g. by postponing the \@ifundefined{chapter} and \@ifundefined{section} checks \AtBeginDocument?
Thanks for posting this. I agree it would be good to make this change... but looking at the code it's not trivial as many of the conditional branches are in the "top level" of the package code. It's not just a matter of moving the check itself, I'm afraid.
Out of curiosity why do you need to load tocloft before \documentclass ?
Thanks for posting this.
You're welcome!
I agree it would be good to make this change... but looking at the code it's not trivial as many of the conditional branches are in the "top level" of the package code. It's not just a matter of moving the check itself, I'm afraid.
I sympathize with you :worried:
Out of curiosity why do you need to load
tocloftbefore\documentclass?
My yathesis class loads etoc (mainly in order to provide an easy way for having local ToCs). And a user of this class who wanted to make also use of tocloft couldn't load it thanks to \usepackage because it would then be loaded after etoc but the latter clearly stipulates:
One should load
etocaftertocloft. A warning is issued if otherwise, because ifetocis loaded before it will realize that at the time of\begin{document}and tricktocloftinto believing having been loaded with the titles option.
Hence tocloft being able to be loaded before \documentclass would have been a workaround.
Am 10.01.20 um 21:14 schrieb Denis Bitouzé:
My |yathesis| https://ctan.org/pkg/yathesis class loads |etoc| (mainly in order to provide an easy way for having local ToCs). And a user of this class who wanted to make also use of |tocloft| couldn't load it thanks to |\usepackage| because it would then be loaded after |etoc| but the latter clearly stipulates:
One should load |etoc| /after/ |tocloft|. A warning is issued if otherwise, because if |etoc| is loaded before it will realize that at the time of |\begin{document}| and trick |tocloft| into believing having been loaded with the titles option.Hence |tocloft| being able to be loaded before |\documentclass| would have been a workaround.
a better solution might be to allow for tocloft being loaded in the class then by providing a suitable option. Definitely superior in my opinion than telling people to use \RequirePackage.
Mid-term that should get resolved by a hook management concept that allows to resolve such conflicts.
a better solution might be to allow for tocloft being loaded in the class then by providing a suitable option. Definitely superior in my opinion than telling people to use \RequirePackage.
Indeed, but scared by all the possibly needed options for taking in account all those packages that need to be loaded in a specific order. BTW, this trouble with tocloft was precisely the reason of the https://github.com/latex3/latex2e/issues/187 feature request of mine :smile:
Mid-term that should get resolved by a hook management concept that allows to resolve such conflicts.
Do you mean something related to https://github.com/latex3/latex2e/issues/187#issuecomment-552552779?