I'm currently trying to write a command using xparse, which translates into



Also the full functionality of paired delimiters should work (\A[\Big]{Test} or \A*{Test}). I already found a way to achieve the desired behaviour:



Now, I'm wondering whether there is a way to write this code more elegantly (for example without passing the star manually).

  • 1
    note that xparse has been incorporated into the latex format and normally does not need to be explicitly loaded with current releases but g is deprecated and not in the pre-loaded version It is still available if you load xparse package for compatibility but we recommend not using it in new code. Jan 19, 2021 at 21:26
  • Thank you. What should I use instead of g? Jan 19, 2021 at 21:33
  • 1
    {} delimited arguments shouldn't be optional (breaks so many latex syntax assumptions), so the recommended syntax would be \A[\big]{text}, \A{} so making the text argument mandatory, but dropping the parens when it is empty, or making it optional so \A[\big][text] but that form might be messy to code with the * form as well. Jan 19, 2021 at 21:38
  • @user7802048 I can mention that a package of mine, semantex, is more or less built to create commands of the type you mention. Note that it does use g-type argument, despite the LaTeX3 team’s recommendations, as I do not agree with the team that this practise should be deprecated. I, on the other hand, find the g-syntax entirely natural.
    – Gaussler
    Feb 13, 2021 at 10:18

1 Answer 1


A package of mine, semantex, was built exactly for creating functions with this kind of syntax. Note that I do use g-type arguments, despite the LaTeX3 team’s official recommendations. My own, personal, controversial opinion is that g-type arguments are completely natural and should not be deprecated. Feel free to agree with the LaTeX3 team instead.






$ \A $

$ \A{Test} $

$ \A[par=\big]{Test} $

$ \A[par=auto]{ \displaystyle\int } $


enter image description here

  • To be clear, the issue with g is not that “it can't be used”. It can, and it will always be available in xparse. The problem is that it's a bit strange (for example you can fool it with \A\bgroup, and \bgroup will be the argument (although we have code to improve on that), but mainly because it is not “standard LaTeX syntax”. LaTeX has a very strict set of argument types: mandatory {}, optional [], and () for coordinates, and optional {} doesn't fit, so when moving xparse to the kernel we left g in the package (as it has always been, so no visible change to the user). Feb 13, 2021 at 14:40
  • @PhelypeOleinik Yes, and as I make quite clear, I simply don't agree with the assessment that optional braced arguments are an issue. And if you look at the fundamental ideas of SemanTeX, you'll notice that it simply cannot work without g-type arguments.
    – Gaussler
    Feb 13, 2021 at 18:22

You must log in to answer this question.

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