There is a notation:


How can it be defined using \newcommand ?

PS The variables m, b, n should be as arguments

  • \newcommand*\mysymbol{\mathbf{P}^{m}_{b}(n)} and then in the document use \mysymbol in math mode. – Skillmon likes topanswers.xyz Oct 7 '19 at 7:59
  • Thanks, it works, but I want to be able to edit the vaieables, how could I do it ? – PKK Oct 7 '19 at 8:09
  • In mathematical practice, you will want these various arguments to be optional, so you really want to use xparse. – Benjamin McKay Oct 7 '19 at 8:17
  • @BenjaminMcKay, it is true, but need to be very careful using xparse package, since the not all online tex processors are able to use new version of xparse, for example, in case of submission to arXiv.org, you have to proceed xparse of TeX-Live 2016, i.e avoid to use the actual syntax of xparse, but proceed the old one – PKK Oct 17 '19 at 9:07

In LaTeX you can define a new macro with \newcommand. \newcommand can have an optional star, which determines whether arguments of the newly created macro can contain a \par (or two consecutive newlines) or not. The next is the name of the new macro. After that are two optional arguments, the first specifying the number of arguments and the second if used defines a default for an optional argument, which is always the first argument. And after that follows the definition of the macro.

\newcommand*\mycmd{my replacement}

defines a new macro called \mycmd that is replaced by my replacement when expanded.

\newcommand\mycmd[1]{my replacement with the argument ``#1''}

defines a new macro that takes one argument. Correct usage would be something like \mycmd{mandatory}.

\newcommand\mycmd[2][default]{optional argument: ``#1''; mandatory argument: ``#2''}

defines a new macro with two arguments, the first being optional, the second mandatory. Correct usage would be something like \mycmd[optional]{mandatory} or \mycmd{mandatory}.

So in your case, if nothing should change, you could use


if you want the indices to be flexible, you can use


and then you could use \mynotation{m}{b} in the document.

If also the P should be changeable, you can use something like


Then you could use \mynotation[P]{m}{b} or \mynotation{m}{b}.

If you even want the (n) to be variable, you can add another argument


Then \mynotation[P]{m}{b}{n} or \mynotation{m}{b}{n} could be used.

To get a more powerful interface to define macros, you could use xparse, with it you could define your macro with

\NewDocumentCommand \mynotation { O{P} E{^_}{mb} D(){n} }{\mathbf{#1}^{#2}_{#3}(#4)}

Then you could use

  • \mynotation and it would expand to \mathbf{P}^{m}_{b}(n)

  • \mynotation[B] and it would expand to \mathbf{B}^{m}_{b}(n)

  • \mynotation^{e} and it would expand to \mathbf{P}^{e}_{b}(n)

  • \mynotation_{d} and it would expand to \mathbf{P}^{m}_{d}(n)

  • \mynotation(x) and it would expand to \mathbf{P}^{m}_{b}(x)

  • \mynotation[B]^{e}_{d}(x) and it would expand to \mathbf{B}^{e}_{d}(x), which would be the same as \mynotation[B]_{d}^{e}(x).

| improve this answer | |
  • Thanks, exactly what required – PKK Oct 7 '19 at 8:18
  • @PetroKolosov take a look at the xparse example. – Skillmon likes topanswers.xyz Oct 7 '19 at 8:22
  • Ah, I dont even have this package installed on my tex editor :( [And I don't know how to install it actually :)] – PKK Oct 7 '19 at 8:27
  • @PetroKolosov which LaTeX distribution and which version of it do you use? xparse is a pretty standard package that is used by many other packages. If your installation isn't ancient, xparse should be contained in it. – Skillmon likes topanswers.xyz Oct 7 '19 at 8:29
  • I use WinEdt 8.1 and MikTeX 2.9 on board, seems that long time i've not updated it – PKK Oct 7 '19 at 8:33

Following the usual notations for projective space, I use:

projective space notations

\(\Proj^n, \Proj_k, \Proj^n_k, \Proj(V), \Proj^n(k)\)
| improve this answer | |
  • good suggestion, I'd giva an upvote, but acnnot [too low score] :) – PKK Oct 7 '19 at 9:39

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.