As already noted in Section 5.18, we can't include the Appendix in the main document, even if we mark it as an appendix with LyX' aproppriate check box in the Layout -> “Start Appendix here” menu item. We must include an extra LyX document of DocBook article type that is marked as an Appendix itself and contains our Appendix.
If such a file with the name appendix. lyx exists, lyxtox will take a series of actions to incorporate it into the final SGML document automatically:
The appendix. lyx file is exported to SGML:
# Export the Appendix to DocBook SGML. if test -e appendix.lyx; then $LYX -e docbook appendix.lyx fi |
A series of SGML code corrections take place through successive runs of 3 sed scripts:
if test -e appendix.lyx; then $RUNSED $SEDSCRABI $1.sgml $RUNSED $SEDSCR appendix.sgml $RUNSED $SEDSCRAPP appendix.sgml fi |
With the sedscr_abi sed script, the ending tags </book> or </article> are substituted with SGML code that inserts the SGML entities of the Appendix, Bibliography and Index as defined in the Preample (see Section 4.6). For example, the following sed commands from sedscr_abi:
/<\/book>/s/<\/book>/\ \&appendix;\ \&bibliography;\ \&index;\ <\/book>/ |
will substitute
&appendix; &bibliography; &index; </book> with &appendix; &bibliography; &index; &appendix; &bibliography; &index; </book> |
Note that the inserted lines before the closing </book> tag contain SGML entities that were defined as SYSTEM files with the names appendix.sgml, bibliography.sgml and index.sgml respectively in the Preample (see Section 4.6). Similar sed commands in sedscr_abi will do the same for the closing </article> tag.
The sedscr sed script will correct the SGML code of appendix.sgml, as it will do for the main document. See Section 7.1.4.1 for an explanation of its inner workings.
Finally, the sedscr_app sed script will replace the first line of appendix.sgml and its subsequent 3 lines with the correct SGML incantation for an Appendix:
<appendix label="A"><title>Appendix</title> |
It also replaces the closing </article> tag (remember that we created the appendix. lyx file as a document of type "DocBook article (SGML)", see Section 5.18) with the right </appendix> one.
If Mathematics processing is ON (with the variable $process_math set to 1 at the start of lyxtox), the appendix.sgml file is undergone the same transformations as the main document using the awkscr_math awk script (explained in Section 10.3):
$AWK -f $AWKSCRMATH appendix.sgml > appendix.awk.sgml mv appendix.awk.sgml appendix.sgml |
Openjade (Section 3.4), called by the lyxtox script, will process both the main document and appendix.sgml and will insert the contents of the latter in place of the appendix SGML entity that was inserted by sedscr_abi above.
| Last updated Mon Sep 24 01:19:25 CEST 2007 | Permalink: http://www.karakas-online.de/mySGML/explain-appendix.html | All contents © 2002-2007 Chris Karakas |