# Tag Info

82

There are many differences. The main one is in the fact that \mathrm{xyz} behaves like an ordinary letter, while \operatorname{xyz} behaves like function names such as \sin. Here's an illustration $\sin x + \sin(x+y) + a\sin z$ $\mathrm{sin} x + \mathrm{sin}(x+y) + a\mathrm{sin}z$ where it's clear that the second line is wrongly typeset. Even if your ...

58

I've found an answer in a usenet post by Heiko Oberdiek and another by Donald Arseneau. Improved code thanks to shiznick. The issue is that \left and \right introduces an inner atom (see The TeXbook, chapter 18, section 4), which has different spacing rules than ordinary atoms, produced by ( and ) (and the other delimiters). To remove this spurious ...

57

As Pieter says in his comment, \DeclareMathOperator*{\argmin}{arg\,min} is indeed the correct LaTeX way to do that. This requires \usepackage{amsmath} (actually amsopn would be sufficient, it's automatically loaded by amsmath which is recommended for math typesetting anyway). Note: the * that follows \DeclareMathOperator sets the underscored option (the ...

52

There is a standard: it should be upright, not italicized. Read Typesetting mathematics for science and technology according to ISO 31/XI I suggest using the commath package to correctly typeset differentials.

47

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 the amsopn package, which is automatically loaded by amsmath, but is also ...

45

\DeclareMathOperator{\foo}{foo} and \DeclareMathOperator*{\hocolim}{hocolim} for sub- and superscripts in the limits position.

41

\DeclareMathOperator is designed to create commands that should typeset operator names such as sin and lim. Some of these are already defined in base TeX or LaTeX so one writes 2\sin\theta instead of 2sin\theta giving correct spacing and font. If you need an operator of this type that is not predefined, then you create it with \DeclareMathOperator, ...

38

You have been told how to get a curved L. But here's some more general advice, which also applies in this situation: In cases such as this, always create your own shortcut macro, say \newcommand{\Lagr}{\mathcal{L}} This way, if you ever decide that that curly L is not quite the one you like, it is easy to switch. Also, even before you knew the answer to ...

38

the xlop package does this sort of thing. It does warn that it uses "french conventions", but at least for multiplication it looks fine, to me. disclaimer: i last did multiplication sums in school in the 1950s... \documentclass{article} \usepackage{xlop} \begin{document} \opmul{384}{56}\qquad \end{document}

36

I'd say it really depends on the context. As Emre pointed out, there's an ISO standard; according to wikipedia, ISO 31-11 was superseded in 2009 by ISO 80000-2. The latter carries the title "Quantities and units -- Part 2: Mathematical signs and symbols to be used in the natural sciences and technology". As a mathematician I think: Why should I use the same ...

29


29

Operators such as \sum are not defined with \DeclareMathOperator that should be used (with or without a *) for “textual” operators. The definition of \sum is \DeclareMathSymbol{\sum}{\mathop}{largesymbols}{"50} that becomes, internally, \mathchardef\sum="1350 The macro \DeclareMathOperator uses \mathop, which has a strange property: if its argument ...

28

You should place the expression in the subscript, as shown below. Most LaTeX books explain this. \documentclass{article} \begin{document} Display mode: $\max_{1 \leq j \leq n}$ Inline mode: $\max_{1 \leq j \leq n}$, $\max\limits_{1 \leq j \leq n}$. \end{document} Note how I used \limits to force the subscript under the operator in inline mode (if ...

27

tl,dr: It's complicated, but be consistent. I believe the answers here tend to miss the point. While Emre mentions that there is an international norm regarding typesetting mathematics that is very explicit about this topic, Hendrik Vogt makes the right argument, but doesn't take it far enough. This question doesn't have an answer as simple as yes or no, ...

27

The package cancel can draw a diagonal line. \documentclass[a4paper]{article} \usepackage{amsmath} \usepackage{cancel} \begin{document} $\cancel{\mathcal{R}}$ \end{document}

25


24

I assume, the replacements should be done in math mode only. Then the starting characters can be made active via a special value "8000 for \mathcode. The characters behave in text mode as usual, but they became special in math mode. The following example document provides parsers for the following shorthands: << : \ll (latexsym/amsmath) <> : ...

23

Alternatively, if you are using any of the packages from the AMS (amsart.cls or amsmath.sty) then there is a command \DeclareMathOperator which does what it says on the tin! For example, \DeclareMathOperator{\Det}{Det} I think that it can handle variants, but I don't recall off the top of my head.

22

There are several ways to do it using different programming facilities of different packages. Here's what it looks like using the LaTeX2e kernel command \@for to map over a comma-separated list: \makeatletter \newcommand\MakeMathOperators[1]{% \@for\@ii:=#1\do{% \expandafter\DeclareMathOperator\@ii }% } \makeatother \MakeMathOperators{ \rep {Rep} ...

22

\mathop allows you to perform operator-related things (like sub-/superscripting underneath/over top in display style) on non-operator symbols: \documentclass{article} \begin{document} $\mathop{\sum\sum}_{i\neq j}$ \end{document} Using amsmath, it is also possible to declare a new operator, say \sumsum, if you're using this notation on a more ...

22

\not is designed for negating relation symbols basically as wide as the equals sign. But it doesn't always work and, for instance, one should use \notin rather than \not\in because the membership sign is too high. Here's a possible solution for your “negated relations”: \documentclass{article} \usepackage{xparse} \NewDocumentCommand{\calrel}{sm} {% ...

21

The scalerel package allows you to scale a symbol to the size (and vertical positioning) of another symbol. So in this case, I define \foo to scale \maltese to the size of \sum. Thus, it piggybacks its sizing off the well defined behavior of \sum. It wasn't clear to me if the questioner wanted to keep the maltese cross the same size in all operations. ...

21

You can use \substack: If this is desired in inline math you can use \limits to obtain the limits underneath the summation symbol: However this is not recommended as it may not look good depending on how much adjacent text there is as it will affect interline spacing. Code: \documentclass{article} \usepackage{amsmath} \begin{document} $... 21 mathrm: It is like math mode (no spaces), but in upright mode. The font size isn't changed. \operatorname: The argument is written in upright mode but with some additional space before and behind. The following example shows the differences: \documentclass[]{article} \usepackage{amsmath} \begin{document} \[x\operatorname{foo}y$ $x\mathrm{foo}y$ ...

21

\newcommand{\periodplus}{\mathbin{{.}{+}}} $$a=b\periodplus 1$$ TeX (and so LaTeX) doesn't interpret spaces in the code for math formulas, but relies on its predefined rules. For TeX a, . and b represent "ordinary" symbols and + a binary operation symbol. Consecutive ordinary symbols are set without any space between them; instead, the combination ...

20


20

Something like: \mathop{\sum_{j=1}^{\infty}\sum_{k=1}^{\infty}}_{j>k} maybe? Looks like this: Or if you want it on the same line as j=1 and k=1, then maybe: \mathop{\sum^{\infty}\sum^{\infty}}_{j=1\ j>k\ k=1}

20

The package mathtools has implemented a general solution for that problem. It defines the command \DeclarePairedDelimiter that you can use as follows: \DeclarePairedDelimiter\parentheses{\lparen}{\rparen}. With this single declaration you have a new powerful command for several cases: \parentheses{x} just replaces $(x)$ \parentheses*{x} will do the right ...

19

\mathop is the most primitive command, declaring the class of a character or subformula to be a unary math operator like \sum, for instance. This has consequences for spacing, compared to binary operators declared with \mathbin or binary relations declared with \mathrel, for instance. Most math operators are written out as textual names. Some definitions ...

19

Probably I don't have the precedence rules exactly as you need, but something like \def\p{0} \def\power#1#2{% \ifnum\p>20(\fi {\def\p{20}#1}^{\def\p{0}#2}% \ifnum\p>20)\fi} \def\product#1#2{% \ifnum\p>20(\fi {\def\p{20}#1#2}% \ifnum\p>20)\fi} \def\add#1#2{% \ifnum\p>10(\fi {\def\p{10}#1+#2}% \ifnum\p>10)\fi} \def\subtract#1#2{% ...

Only top voted, non community-wiki answers of a minimum length are eligible