12

It's not uncommon that answers to questions use a package which itself loads another package. In that case, details of the answer might end up being opaque if the answer uses commands documented in the dependency, but not in the actually loaded package.

Some common cases where this is the case:

  • various table packages that all load array
  • various packages that load xcolor and/or graphicx

I suggest that we try to explicitly mention and load the dependencies in answer code if the answer uses commands from both the main package and the dependency.

Here's some answers of the sort I have in mind: (I didn't really want to pick on people so I didn't add specific answers in my original version of the question.)

  • https://tex.stackexchange.com/a/39047/2693 This answer was what prompted my question in the first place. (The issue is much less obvious in the answers present state). Peter's initial answer just used the collcell package, but part of the answer used \newcolumntype. In fact, Martin (author of collcell) is explicit in his documentation about the use of array, so in this particular case, there isn't too much of a problem. In it's current state, since there has been some discussion independently about the array package, so the problem doesn't really arise any more.
  • https://tex.stackexchange.com/a/23690/2693 Here the comment makes it clear that the OP didn't necessarily understand the syntax of newcolumntype; the beamer documentation won't help other than (presumably) a pointer to array.

Here's an answer of mine that does what I'm suggesting:

  • https://tex.stackexchange.com/a/37240/2693 The solution here uses \resizebox which is a graphicx command. Although beamer loads graphicx it makes little sense to just use beamer in the solution, so I loaded graphicx explicitly with a comment in the code to that effect.
2
  • 2
    About your example answer: You actually never say that \resizebox comes from graphicx (which it actually doesn't, it comes from graphics; not that it really matters). You have a comment "loaded by beamer, but included here for explicitness" there, which for some new users might be more confusing than helpful. IMHO, it would be better mentioning it in the normal text before: "You could wrap the table in \resizebox from the graphicx package. This package is already loaded by beamer." (Also you still miss a % in this answer; see my comment there)
    – Martin Scharrer Mod
    Commented Dec 22, 2011 at 8:25
  • @Martin, yes, you're right. I've updated the answer. And the point of this question is to remind people that it's a good idea to do.
    – Alan Munn
    Commented Dec 22, 2011 at 15:06

1 Answer 1

9

I'm not so sure. It depends on how common the packages are. I'd say that array, xcolor and graphicx are 'standard', in the sense that I use them directly or indirectly in every real document I write. So anything which does not work with them is basically erroneous in itself. On the other hand, if a package requires say TikZ then I think it probably is worth a mention.

3
  • 4
    I guess what I have in mind is an answer that says "Use package X" and then uses a command from e.g. array in the answer. If the OP reads the documentation for package X, they won't find documentation for the command.
    – Alan Munn
    Commented Dec 21, 2011 at 20:33
  • 1
    @AlanMunn: I can imagine such situation. Do you have an example. Do you mean something like this: "You can manipulate the command via \preto provided by etoolbox. The package abc loads etoolbox by default". Commented Dec 21, 2011 at 23:29
  • 1
    @MarcoDaniel I've added some example answers. (I didn't really want to call people out.) But I think the answer to your question is 'yes'. If your answer uses something from a dependency, you should make that clear in the answer so that people can look at the documentation for that package, even if some other package loads it.
    – Alan Munn
    Commented Dec 22, 2011 at 0:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .