2

The integers modulo n, given by

\mathbb{Z}/n\mathbb{Z}

is cumbersome to write. Accordingly, I would like to set up a new command that allows me to specify an input 'n'. Something like

\newcommand{\Z[character]}{\mathbb{Z}/[character]\mathbb{Z}}

But the above code is not right. Does anyone have any idea how this might be done?

1
  • 2
    This might be a little grumpy of me, but if you google "latex newcommand" you get all manner of links describing how it works, including this feature. The LaTeX wikibook (the first result) is a good source, by the way.
    – Ryan Reich
    Nov 4, 2011 at 4:06

2 Answers 2

10
\newcommand\Z[1]{\mathbb{Z}/#1\mathbb{Z}}
1
  • And use it as $\Z{n}$.
    – Leo Liu
    Nov 4, 2011 at 2:26
10

If you want it to work in normal text mode too, i.e. without dollar signs:

\newcommand{\Z}[1]{\ensuremath{\mathbb{Z}/#1\mathbb{Z}}}
2
  • Eek, sorry. This is nearly a duplicate of Leo's. That'll learn me to refresh...
    – qubyte
    Nov 4, 2011 at 2:57
  • 3
    It's fine. This question is trivial for all experienced LaTeX users, but fewer ones know \ensuremath.
    – Leo Liu
    Nov 4, 2011 at 3:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .