In my MWE below, I wanted the create a shortcut for some operators. How can I get the \DeclareMathOperator command to show up like the conventional way of using the actual command $\mathbf{z}(k)$ ?

Also, is there an even shorter way to get this command, like say for example just type \z instead of $\z$ ?

Here is my code:

\usepackage{amsmath,amsfonts,amssymb,amsthm, bm} 


How do I get this Math operator $\z$ to show like this $\mathbf{z}(k)$?
  • just use \newcommand{\z}{{\mathbf{z}}(k)} but $\mathbf{z}(k)$ has strange spacing, perhaps better would be \DeclareMathOperator\z{z} then $\z(k)$ so \z gets the same space rules as \log – David Carlisle Oct 13 '15 at 20:38
  • There's no reason for using \DeclareMathOperator in this case. – egreg Oct 13 '15 at 22:44

Quoting from this question, DeclareMathOperator is designed to create commands that should typeset operator names such as sin and lim. The default font for these quantities is upright. If you want part of the operator name to be slanted (in the way variables are usually typeset), you have to specify this explicitly:


On the other hand, I would guess that what you actually want is that only the 'z' itself is the operator name:


The part in parenthesis should be the argument to this operator. If you frequently use the same argument, you could define a short hand for this, using \newcommand:


Concerning your second question, if you encapsulate your definition with \ensuremath, you can use your command both within or outside of math environments:


With the last definition, both $\zk$ and \zk{} should give the same result.

| improve this answer | |

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.