Okay, so I want to make an enviroment, preferably using tikz, that looks like this, which I made with paint (and I like to use black squares for my qed symbol): Intended look for environment Okay, that qed symbol and last line are supposed to match up.

Anyways, I tried doing this with tikz, and I'm having a bit of a hard time. Plus, I don't know how to turn these into environments. I also don't know how to use the "theorem" counter based on section/chapter, etc.

Couple details though, this sort of thing should be a style of its own. That is, I want to input what gets replaced into the word where "theorem" is, like in amsthm package I can go

\newtheoremstyle{<command name>}{<box name>}

where I can let "box name" be theorem, corollary, etc.

I want however, to be able to choose 3 different colours:

  • The colour for the box, ie. red in this case.
  • The colour for the theorem, in this case a tint of blue.
  • The colour for the proof, in this case something like "red!25" or something.

Third, I also don't know how to do optional arguments. That is, if the name for the theorem isn't there, I want it to look something like htis instead, that is: no line next to theorem. No theorem name case.

I especially prefer the use of tikz given that I understand tikz code slightly, though I am slightly not great at it.

I've never used mdframed so Idk if a code in that would help. But if you do wish to use mdframed, please provide as much details as possible about what each bit in the code means.

But to summarize, I want

  1. A code for the name and options. It should look something along the lines of this:

  2. A separate code for when I give it a name vs when I don't. I prefer it to be similar to the code used for theorems in amsthm package or something. Not the same, as I want its proof environment to be inside the second box.

Any assistance in any portion of the code will help. It's fine if a full code with every detail isn't given to me. Help on any of the following would be great:

  • Tikz code for such a theorem box.
  • The environment construction for any one of the two styles of boxes. (ie. The text should be inside an ienvironment instead of a node.)
  • How to provide optional arguments for codes and how to change the code based on the optional arguments. (Though this, I can figure out from other questions.)

I know the full thing may be a bit too much, but any help would be useful! Thanks!

1 Answer 1


And what about tcolorbox?:



    before lower={\textit{Proof:~}},


\begin{mytheo}{This is a theorem}{A}
This is the theorem definition
This is the theorem proof.

As you can see in theorem~\ref{theo:A} \dots

enter image description here

  • This is actually very simple and easy to understand. Thanks! Jan 9, 2017 at 18:30
  • Is there a way to get rid of rounded corners? Jan 9, 2017 at 18:30
  • 1
    @OsamaKawish Yes, add option sharp corners to mytheo definition. I'd suggest to look a tcolorbox documentation for more details about configuration.
    – Ignasi
    Jan 9, 2017 at 18:55
  • @user49915 Add after lower={\hfill\blacksquare} to mytheo definition.
    – Ignasi
    Dec 11, 2018 at 18:53

You must log in to answer this question.

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