Customizing arbitrary tags |
Imagine that you want to change the rendering of a given tag, like
However, in some cases, it may not be clear which
“well-chosen” macro to customize. If we just wanted to
change the presentation of lemmas and not of any other theorem-like
environments, then we clearly cannot modify
So imagine that you want all lemmas to appear in red. One thing you can always do is copy the original definition of lemmas in a safe place and redefine the lemma macro on top of the original definition:
<document|<assign|orig-lemma|lemma>|<assign|lemma|<macro|body|<with|color|red|<orig-lemma|body>>>>>
Alternatively, if only the text inside the lemma should be rendered in red, then you may do:
<document|<assign|orig-lemma|lemma>|<assign|lemma|<macro|body|<orig-lemma|<with|color|red|body>>>>>
Of course, you have to be careful that the name
Another frequent situation is that you only want to modify the
rendering of a tag when it is used inside another one. On the web, the
Cascading Style Sheet language (CSS)
provides a mechanism for doing this. In TeXmacs, you may simulate this
behaviour by redefining macros inside a
<
document
|
<
assign
|
orig-render-theorem
|
render-theorem
>
|
<
assign
|
render-theorem
|
<
macro
|
name
|
body
|
<
with
|
orig-render-list
|
render-list
|
<
with
|
render-list
|
<
macro
|
x
|
<
with
|
par-par-sep
|
0fn
|
<
orig-render-list
|
x
>
>
>
|
<\orig-render-theorem|
name
body
On the one hand side, this mechanism is a bit more complex than
CSS, where it suffices to respecify the par-par-sep attribute of lists inside theorems.
On the other hand, it is also more powerful, since the