Have written the command teora that prints with the colour defined in \pigm. Could \teora be changed to accept the colour as an optional parameter? \newtheorem already accepts an optional theorem naming parameter, and most likley that I cannot have multiple optional parameters. But I am not sure.


How can a user change the colour for \pigm so that one can have a different colour when calling \teora.

\begin{teora}[Pythagorean theorem]
  To prove it by contradiction try and assume that the statement is
  false, proceed from there and at some point you will arrive to a

There is the possibility of doing \begin{teora}[\color{Green}Pythagorean theorem] but this only changes the name, with the theorem numbering keeping with the old colour.

1 Answer 1


You might use an optional argument in parentheses, so as not to conflict with the standard optional argument for the name.


\newcommand{\teoracolor}{}% initialize




This theorem is green, with no name.

This theorem is green, with a name.

This theorem is red, with no name.

This theorem is red, with a name.


enter image description here

  • Could I build it without \usepackage{amsthm}?
    – Veak
    Sep 29, 2022 at 22:59
  • With \newcommand{\pigm}{Green} in a style file, is there a way for users to change the value of \pigm to another taken from xcolor?
    – Veak
    Sep 29, 2022 at 23:06
  • \NewDocumentEnvironment is a latex built-in that is not associated with amsthm, right?
    – Veak
    Sep 29, 2022 at 23:16
  • @konmi I always use amsthm because it adds punctuation, but is not necessary for the job. You can use \pigm instead of the teora color, if you so prefer, but is it a sensible name?
    – egreg
    Sep 30, 2022 at 8:00
  • I have no problem using the colour you defined.
    – Veak
    Sep 30, 2022 at 12:13

You must log in to answer this question.

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