I want to have a command that accepts 1 optional argument and 3 mandatory ones.


  1. \qe{a}{b}{c} produces ax^2+bx+c
  2. \qe[y]{-1}{0}{-c} produces -y^2-c

How to make this command?




alt text

See manual of polynomial for more options.



    \ifx\temp\MinusOne -\else #2\fi#1^2\fi
    \ifx\temp\MinusOne -\else+#3\fi#1\fi
  \ifx\relax#4\relax\else+ #4\fi}


  • @xport: see edit. However, it makes no real sense, because it becomes more and more complecated. +-c and +1x is also not a nice output. It is easier to type it as it is ... – user2478 Jan 22 '11 at 16:24
  • The only one of your test cases which actually looks right is the first. – Ryan Reich Jan 22 '11 at 16:36
  • @Ryan, edited the code – user2478 Jan 22 '11 at 17:24

what about what follows as a first attempt:

\newcommand{\qec}[4]{#1 #4^2 + #2 #4+ #3}

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.