Karakas Online

5.8. Admonitions

There is no “Admonition” environment in LyX, just as there are no “Admonitions” in TeX/LaTeX. Admonitions are a DocBook SGML element. They are those text passages which alert the reader of some important fact (see Section 1.7 for examples). They carry titles like “Caution!”, “Important!”, “Note”, “Tip”, “Warning!”. There is no oher way to introduce admonitions in a LyX DocBook document, than by creating an SGML environment and inserting the necessary SGML commands there. Here is an example for “Caution”:

<caution>
<title>Caution</title> 
<para> 
You will need to repeat the above steps for each and every image you produce! 
If you omit it, or use your own .pdf and .eps versions, most probably they 
will FAIL to be embedded in your PDF, resp. PS document! 
</para> 
</caution>

which looks like this:

Caution Caution
 

You will need to repeat the above steps for each and every image you produce! If you omit it, or use your own .pdf and .eps versions, most probably they will FAIL to be embedded in your PDF, resp. PS document!

Since the environment is SGML, you can put any legal (from the DTD point of view) SGML tag inside <caution>/</caution>, not only <para> or <title>. Here is a more complicated example that uses an itemized list (through the <itemizedlist> tag) , this time for the “Tip” admonition:

<tip>
<title>Tip</title> 
<para> 
FYI, all changes presented here refer to variables that were 
originally defined in one of the following files:
<itemizedlist>
</listitem>
<listitem>
<para>
/usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/html/dbparam.dsl
</para>
</listitem>
<listitem>
<para>
/usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/print/dbparam.dsl
</para>
</listitem>
<listitem>
<para>
/usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/print/db31.dsl
</para>
</listitem>
</itemizedlist>
As said above, you should not change these files directly, because 
you will run into a lot of work when you upgrade them.
</para>
</tip>

It looks like this:

Tip Tip
 

FYI, all changes presented here refer to variables that were originally defined in one of the following files:

  • /usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/html/dbparam.dsl

  • /usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/print/dbparam.dsl

  • /usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/print/db31.dsl

As said above, you should not change these files directly, because you will run into a lot of work when you upgrade them.

Another example (of a "Note" admonition) that makes use of a code example (though the <screen> tag):

<note>
<title>Please note:</title> 
<para> 
A file containing graphical callouts (see Section 4.8 and Section 5.9) 
will NOT be validated! You will get an error saying
<screen>
document type does not allow element "IMG" here
</screen>
</para>
</note>

It will look like this:

Note Please note:
 

A file containing graphical callouts (see Section 4.8 and Section 5.9) will NOT be validated! You will get an error saying

document type does not allow element "IMG" here
Last updated Mon Sep 24 01:19:25 CEST 2007 Permalink: http://www.karakas-online.de/mySGML/lyx-admonitions.html All contents © 2002-2007 Chris Karakas