7

A topic that appear over and over is to explain the difference about commands such as \operatorname vs. \DeclareMathOperator. So far I've seen discussions about using one or the other, but no one explains if there is a substantial difference between them.

My question, however, goes a bit further. I believe that commands with capital letters in their names are a sort of special commands, say a lower level language of the programming (Am I right?).

Thus,

Questions

  • What is (are) the difference(s) between \operatorname and \DeclareMathOperator?
  • Is it customary to reserve "capitalised" commands to writing of classes?
  • In the same spirit, What is the difference between \usepackage and \RequirePackage

I'll stop asking to avoid a lengthy post. Cheers.

7

The answer referenced in the comments answers the general question (and "yes" to the midle item).

For the other two items:

\operatorname is a document-level command that typesets a name at that point \operatorname{foo} typesets foo with the spacing and font of an operator. \DeclareMathOperator is a package level command that defines a command that prodiuces an operator name.

\usepackage and \RequirePackage are identical apart from their name the definition of the former is \let\usepackage\RequirePackage

  • 1
    I think it's worth pointing out that this (\DeclareMathOperator) is a case where the distinction between package and document level commands is blurred. I certainly use \DeclareMathOperator in documents. – Ian Thompson Aug 19 '13 at 13:08
  • 1
    @IanThompson sure but probably in the preamble (which is essentially a local unnamed package) you wouldn't I assume use it like \operatorname in the middle of a formula? – David Carlisle Aug 19 '13 at 13:15
  • I do use it in the preamble, which I never really thought of as a package. It seems the distinction between a package and a document is also blurred! – Ian Thompson Aug 19 '13 at 13:25
  • 1
    @IanThompson In my mental model the document begins at \begin{document} (there is a hint in the syntax:-) (the \usepackage/\RequirePackage distinction breaks that model, but life's complicated) – David Carlisle Aug 19 '13 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.