summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-newfunction.html
blob: 2651b36a52d340a20b25c3d77f0aa7755a61dbc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<head>
<title>UK TeX FAQ -- question label newfunction</title>
</head><body>
<h3>Defining a new log-like function in LaTeX</h3>
<p>Use the <code>\</code><code>mathop</code> command, as in:
<pre>
  \newcommand{\diag}{\mathop{\mathrm{diag}}}
</pre>
<p>Subscripts and superscripts on <code>\</code><code>diag</code> will be placed as they are on
<code>\</code><code>lim</code>.  If you want your subscripts and superscripts always placed
to the right, do:
<blockquote>

<pre>
\newcommand{\diag}{\mathop{\mathrm{diag}}\nolimits}
</pre>
</blockquote>
<p>AMSLaTeX (in its <i>amsopn</i> package) provides a command
<code>\</code><code>DeclareMathOperator</code> that takes does the same job as the first
definition above.  To create our original <code>\</code><code>diag</code> command, one would
say:
<pre>
  \DeclareMathOperator{\diag}{diag}
</pre>
<code>\</code><code>DeclareMathOperator*</code> declares the operator always to have its
sub- and superscripts in the 
"<a href="FAQ-limits.html"><code>\</code><code>limits</code> position</a>".
<p>(It should be noted that "log-like" was reportedly a <em>joke</em> on
Lamport's part; it is of course clear what was meant.)
<dl>
<dt><tt><i>amsopn.sty</i></tt><dd>In the AMSLaTeX distribution <a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/amslatex.zip">macros/latex/required/amslatex</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/amslatex.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/amslatex/">browse</a>)
</dl>
<p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=newfunction">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=newfunction</a>
</body>