One occasionally encountered problem with LaTeX is incompatibility between packages. What are best practices for package authors to deal with package conflicts?
For example:
- What is the best way to deal with package option conflicts?
- How should package conflicts be documented? (Is there a uniform/recommended way for presenting this in package documentation? I think thre isn't.)
- There is
\PassOptionsToPackage
. - Is there a way of throwing an error if a particular package has already been loaded?
- Is there a standard way of telling the user (via a warning or error) to change the package loading order?
- How can a package detect an incorrect package loading order upon being loaded (if the respective dependencies are known to that package's author)?
- Is there a recommended way/interface for packages to communicate with regard to indicating or checking whether/how a certain command has already been patched/modified?
- Is there a recommended way for packages to document or warn other packages against what sorts of patches to existing commands they are executing?
(I have a suspicion that the "best" answer to some of these questions is "wait for LaTeX3", but this doesn't mean one can't or shouldn't document workarounds in the meantime. In fact I am asking these questions partly to provide a record of documentation.)
Some questions on TeX.SE constituting partial answers or asking for related information:
- Two conflicting packages in one document — doable?
- choosing macro names so as to avoid namespace conflicts
- Could using different packages cause a contradiction for the compiler?
- Creating a dependency tree (\RequirePackage) for packages used in my document
- Package options and \RequirePackage: order of commands and option conflicts?
xparse
", though I'm clearly the wrong person to be specific in this regard).\AtBeginDocument
and by using KOMA-Script'sscrlfile
package which defines such useful commands like\AfterPackage
.