I want to define a macro for the normal ordering of operators as done in this question.

The LaTeX code produced by LyX for this macro is:


However, when I invoke it:


it gives an error:

...ven by $\norder{\hat{a}\hat{a}^{\dagger}} $ The control sequence at the end of the top line of your error message was never \def'ed.

I don't understand why it gives the error. I have more macros in the document and they work perfectly. amsmath and amssimb are loaded through LyX's "Math Options" (and I have checked that I can use commands such as \mathbb inside macros). Looks like the problem is the \vcentcolon command but I don't see why or how to fix it. Thank you!

PS. This is what I have before the begin{document} in the LaTeX source generated by LyX.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
| improve this question | | | | |

The command \ventcolon has not been defined. Load the package mathtools; you can load it instead of amsmath. Moreover, wrap the stuff between the colons into a \mathrel command to improve the spacing.


enter image description here

$A \norder{\hat{a}\hat{a}^{\dagger}} B$
| improve this answer | | | | |
  • Adding mathtools solved the issue. Thanks! – VictorSeven May 1 '17 at 15:28

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.