TeX treats them both the same. Normally I would use _
first then ^
.
In examples like you gave with \sum
I'd normally say the lower bound first as in "sum from 0 to n...." and the other place where I'd use both is in subscripted variables: if it is xi squared I think x_i^2
is more natural than x^2_i
.
You are on the right track. It's always best practice to use semantic markup in text and define the layout somewhere else (preamble, config file, …).
csquotes
is a package, that can do this for you. It's even language aware (if set by babel
or polyglossia
). But bear in mind, that there are several semantically different things, that are usually or occasionally typed in quotes (actual quotes, irony, newly defined terms, …). Don't simply replace all occurances of \grqq[…]\glqq
or
"`[…]"'
by \enquote
from the csquotes
package. Use even higher markup like
\newcommand{\actualquote}[1]{\enquote{#1}}
\newcommand{\definedterm}[1]{\enquote{#1}}
\newcommand{\irony}[1]{\enquote{#1}}
so that you can change this easily, if you want to change the layout of just a single kind of this.
Concerning the question of
\grqq vs. "`
The former won't break anything, but the latter depends on "
being made active (by babel
for example). This activation might break other (babel
unaware or badly designed) packages.
PS: One can also have the point of view, that csquotes
only covers actual quotes. That way, you need not define \actualquote
but define \definedterm
and \irony
not using \enquote
. But this has the following disadvantage: What to do if there is newly defined term inside an actual quote? That's why I see \enquote
more of a way to deal with quotation marks instead of actual quotes.
Best Answer
When is it better to use
\operatorname
(or its wrapper\DeclareMathOperator
) instead of\mathop
? The answer is easy: always, unless you know precisely what's the behavior of\mathop
.First of all, one must of course recall that
\operatorname
and\DeclareMathOperator
are provided by theamsopn
package, which is automatically loaded byamsmath
, but is also available standalone.Let's see the main definitions:
The command
\qopname
is not really meant to be used in a document; the purpose of its first argument is to add some declarations such as\newmcodes@
before typesetting the operator name.The
\operatorname
and\DeclareMathOperator
each have a *-variant that passes to\qopname
a second argumentm
instead ofo
. The latter command is just a wrapper:are pretty much equivalent to saying
(but treated more efficiently) so what we need to examine is just
\operatorname
.A call of
\operatorname{xyz}
translates intowhich becomes
The
\newmcodes@
declaration takes care that some characters are treated differently as usual in math formulas (in particular the hyphen doesn't become a minus sign);\kern\z@
inserts an invisible object so that the entire contents of\mathop
will never be a single character (see https://tex.stackexchange.com/a/41267/4427 for details);\operator@fonts
chooses the predefined font for math operators, which usually is the upright text font;\nolimits@
is just an alias for\nolimits
, so following subscripts and superscripts won't be typeset above and below the operator, unless countermanded by a\limits
declaration.For
\operatorname*
it's exactly the same, with the only difference that\nmlimits@
will be executed instead of\nolimits@
. This macro is defined to be equivalent to\displaylimits
, which makes the operator behave like the standard\lim
or\min
.If an operator is used just a couple of times in a document, one can maybe dispense with defining a command with
\DeclareMathOperator
; but readability of the source is, in my opinion, enhanced if proper names for logical structures are used.For
\mathop
one has to remember that it doesn't choose any particular font and it doesn't correct some glitches: so the output ofwill be rather different from
and the latter is usually expected. In some rare cases
\mathop
is useful by itself:is an example, where the empty
\mathop
is used to provide the correct spacing before the "d". Note that if one really wants to have an upright "d", it would be incorrect to define it as\operatorname{d}
and the same as before with\mathrm{d}
instead ofd
should be used: explicitly, the alternative isAlso
\stackrel
and the betteramsmath
commands\overset
and\underset
are defined with an internal\mathop{...}\limits
but wrapped up in some other construction.