Chapter 18 Renaming Elements
The preceding sections have provided a lengthy list of PreTeXt tags that behave interchangeably. Perhaps you don't like one of their names. For instance, suppose your project will not involve any <algorithm>
s, but you need another theorem-like tag whose name you would like to have rendered as “Porism”. To do this, you need to add a <rename>
element to the <docinfo>
element of your code. For our example, the necessary code would be <rename element="algorithm">Porism</rename>
. A <rename>
element generates a global change; it is not possible to rename a single instance of an element or to define your own tags (without writing your own XSLT code.
We have included this <rename>
code in this guide's <docinfo>
, and as such, we can do the following.
<algorithm>
<statement>
<p>
This is a short little ditty that follows immediately from the previous proof.
</p>
</statement>
<proof>
<p>
We'll still include a proof though.
</p>
</proof>
</algorithm>
<algorithm>
and <rename>
The code in Listing 18.0.1 produces the following output:
Porism 18.0.2.
This is a short little ditty that follows immediately from the previous proof.
Proof.
We'll still include a proof though.
A special note about renaming <exercise>
s.
Because of the range of divisions that can contain an <exercise>
element with different names displayed (such as “Checkpoint” for an inline exercise), one cannot simply use @element
with value exercise
in a <rename>
element. The value of @element
to rename an <exercise>
is as follows:
divisionalexercise
for an<exercise>
inside<exercises>
,<subexercises>
, or<exercisegroup>
with default “Exercise”inlineexercise
for an inline exerise with default “Checkpoint”worksheetexercise
for an<exercise>
contained in a<worksheet>
with default “Worksheet Exercise”readingquestion
for an<exercise>
contained in a<reading-questions>
with default “Reading Question”