I would like to define a command using another one to make it short. But the old command includes paranthesis and square and curly brackets. For example


I would like to define a command named new and write \new(A,0,4,B) or \new{A,0,4,B} to make it short. I tried to write simply


But it is not working.

How can I achieve this?

  • 1
    With your current definition you cannot use \new{A,0,4,B} but you must use \new{A}{0}{4}{B}. Something like \newcommand*{\new}[1]{\newaux#1\relax} \def\newaux#1,#2,#3,#4\relax{\oldlongcommand[#1]{#2}{#3}{#4}} might go in the right direction, but it can depend on how the old command is defined, and whether the arguments can be commas or not. – campa May 24 '18 at 14:17
  • Sorry, but it is not working. The arguments are just as I write. There is a : in the paranthesis. can it be the reason? – Muhsin May 24 '18 at 17:31
  • @campa You did not obey syntax according to \oldlongcommand's parameter text. I think it could be: \newcommand*{\new}[1]{\newaux#1\relax} \def\newaux#1,#2,#3,#4\relax{\oldlongcommand[#1](#2:#3){#4}} – Ulrich Diez May 29 '18 at 22:09
  • @UlrichDiez Absolutely true. The troubles of copy-pasting snippets :-) – campa May 30 '18 at 6:47

You defined:


From the parameter text of your definition one can see that your macro \new does process four undelimited arguments.
Thus you need to provide four undelimited arguments and not just one.
Syntax with your definition is:


Using delimited arguments implementing syntax \new(A,0,4,B) is feasible as well.
Be aware that with the example below nesting parenthesis is not a good idea.
Also spaces/space tokens surrounding the commas will not get removed.
Braces around the single comma-delimited arguments will get stripped off.



\newinternal A,0,4,B,

With this approach one level of surrounding braces will be stripped off when \newinternal gathers its comma-delimited arguments – e.g.:

\new({A},{0},{4},{B})\oldlongcommand[A](0:4){B} instead of

With this approach spaces surrounding commata/parenthesis will not get removed – e.g.:

\new(A , 0, 4, B )\oldlongcommand[A ]( 0: 4){ B } instead of

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.