Recently I found to my big surprise that there are no system variables to know the underline status.
As you can have up to 10 underlines running at the same time, I propose the following:
- %ul: 1 if any underline style is active, 0 if none
- %ul1: 1 if underline style 1 is active, 0 if not
- %ul2: same for underline style 2
- %ul10: same for underline style 10
Example use case:
<title>text text <emph mode="bold">more text</emph> more title text</title>
In this case the title tag was underlining the text and the emph tag had several possible modes, one being the underline.
In the implementation of the <emph> tag, you simply store the state before the emph tag to restore that state at the end of emph.
To store the state you use the different system variables that are available, %fvariant, %ffamily, %color, etc.
Unfortunately the is no system variables available to detect if there is already an underline style active...