The LaTeX command for diag is \operatorname{diag} (diagonal matrix).
\operatorname{diag}Writing a paper? The table generator and the BibTeX cleaner are one click away, no account.
Write \operatorname{diag} inside math mode, that is between $…$ for inline math or in a \[ … \] or equation block for display math. This symbol needs the amsmath package, so add \usepackage{amsmath} to your preamble.
\operatorname{diag} sets the name upright with operator spacing; typed as plain letters it would print in italics, as a product of variables.
$\operatorname{diag}_{i=1}^{n} x_i$Open this example in the live preview: it renders as you type, with no compiler and no signup.
\gcd\deg\arg\hom\operatorname{sgn}\operatorname{tr}\operatorname{rank}\operatorname{span}\operatorname*{argmax}\operatorname*{argmin}\operatorname{lcm}\sin\cos\tanMath operators in LaTeX: the full table or search all 350+ LaTeX symbols.
Use \operatorname{diag} in math mode after adding \usepackage{amsmath} to your preamble. For example, $\operatorname{diag}_{i=1}^{n} x_i$.
It comes from the amsmath package: add \usepackage{amsmath} to your preamble.