Any instructions to customize fancy and colorful environment in TeXmacs?

I think TeXmacs is the best for taking notes because of its professional formula display and WYSIWYG feature. And we always hope to have our own fancy styles in typesetting.

In LaTeX some fancy (and professional) theorem environments attract me and I dream to have them in TeXmacs, such as:

  1. From

In LaTeX we know package tcolorbox is a powerful tool to realize them. But how can we do in TeXmacs?

I believe try customizing environment is a very good way to learn TeXmacs macro systems as well. So, do you have any suggestions?

Thanks a lot!

1 Like

Hi @kaihuang, I think you can do a part of what you want, but not a crucial thing, that is choosing where to have colored lines (e.g. only on one side, or on top and bottom).

Using the “ornamented” environment one can insert another environment in a colored frame (with a colored background as well) but as far as I know all of the lines appear; one can have some customization but not enough to reproduce your examples with the lines on top and bottom or the line only on the left.

Using a table with a single cell one can control which side have borders, but the borders are only black.

Perhaps something more sophisticated is possible, but I need time to think about it.

For writing up the environments as macros, please take a look at, at the end, sentences starting with “An interesting technique for writing macros” (please ask if you cannot make it work).


For 2. you could try a table where the first cell has a fixed width (e.g. 2pt), put a theorem, definition,… in the second cell, then set the background colours:

When you have something you like, you can redefine the macros for theorem, definition etc. to look like the thing you want.

It seems you can switch the text colour outside of the table and reset the text colour to black inside the cell to colour the borders only.

1 Like