* Add translation links for the current page. But how does the
header know the link to the current page? Here's where the
constants DOMAIN, DIRNAME and FILENAME come into play:
DOMAIN is set in the .start file (see Section 4.11), DIRNAME is
replaced in lyxtox with the parameter you passed it:
${SED} -e "s/_DIRNAME_/$1/g" part2_1.tmp > part2_2.tmp
Since the parameter you pass to lyxtox is supposed to be the
basename of your .lyx file, which will also become the name of the
directory where everything is going to be placed, you can see that
DIRNAME will be replaced with the right directory name (actually,
what will be replaced is _DIRNAME_, but the underscores are there
only to make sure there is no other DIRNAME variable by accident
there). Finally, FILENAME is determined in lyxtox as the basename
of the HTML file:
${SED} -e "s/_FILENAME_/${BASENAME}/g" part2_2.tmp > part2_3.tmp
* Add some "breadcrumbs", i.e. navigation links separated by a "|".
Here the links point to the various formats of the document, with
a nice example of how to mail the current page to a friend using a
custom text and the right page link:
* Add translation links to the current page. These are the same as
the ones for the header, only that they are centered instead of
being aligned to the right of the page:
Once again, the DOMAIN, DIRNAME and FILENAME constants come into play.
* Finally, add some icons. Some of them point to the validator
services of the W3C (see Chapter 8). These are also nice examples
of how to compute the right link that is to be sent to the
validator so that it will be able to validate the current page:
you have to use "http%3A%2F%2F_DOMAIN_%2F_DIRNAME_%2F_FILENAME_"
for the CSS validator, but is is enough to use
"http://validator.w3.org/check/referer" for the HTML validator.
And don't miss the special link to "validate your browser"! :-)
Tip How to set the constants in the part* files
Do not set the DOMAIN, DIRNAME and FILENAME constants in the part*
files. Set only TITLE, DOMAIN, FORMATSFILE, COPYRIGHT and HOMEFILE in
the .start file. DIRNAME and FILENAME are computed automatically in
lyxtox.
_________________________________________________________________
4.13. Set up your bibliographic database
If you don't want to use RefDB, there is nothing you have to do at
this stage, so you can skip this section. However, you will have more
work in the long run, as you will need to enter the bibliographic
references each time by hand in pure SGML in a separate file, see
Section 5.19.
If you want to use RefDB, to take advantage of all the automated
processing offered to you by a bibliographic database, RefDB and the
lyxtox script, there is some prelimnary work to do: before you use
your bibliographic treasures in citations and the reference list, you
have to import them into the RefDB database you created during
installation of the RefDB package (see Section 3.11). Further, you
must give the name of your database as the value of the RefDB_db
variable in lyxtox and also set process_RefDB to "1", indicating you
wish bibliographic processing through RefDB.
Adding references boils down to running the addref command with proper
input files. The input files have to be valid RIS files. They may
contain one or more RIS datasets.
An example of a RIS file is refdb.ris. A typical bibliographic entry
in the RIS format looks like:
TY - ELEC
ID - Walsh2002
AU - Walsh,Norman
AU - Muellner,Leonard
TI - DocBook: The definitive Guide - Apendix
KW - guide
KW - docbook
RP - NOT IN FILE
PB - O'Reilly & Associates, Inc.
UR - http://docbook.org/tdg/en/html/appa.html
N1 - Accessed 29.06.2003
PY - 2002/06/17/Version 2.0.8
SN - 156592-580-7
ER -
Each line starts with a two-letter tag followed by the string " - "
(two spaces, a dash, and another space). Each RIS dataset starts with
the TY (type) tag and ends with the ER (End of Reference) tag. In
between, tag sequence is arbitrary. The meaning of the tags is:
TY:
Citation type. Can attain many values, some of the most usual
being:
* ABST (abstract reference)
* BOOK (whole book reference)
* COMP (computer program)
* DATA (data file)
* ELEC (electronic citation)
* GEN (generic)
* JOUR (journal/periodical reference)
ID:
Unique citation ID string. This can either be explicitly set by
you, or automatically set by the RefDB system. It plays the
same role as the citation key in the standard methods provided
by LyX for citation purposes (see Section 7.1.10).
AU:
Author. Synonym: A1.
TI:
Title
KW:
Keyword
RP:
Reprint status. Can be one of
* IN FILE
* NOT IN FILE
* ON REQUEST MM/DD/YY
PB:
Publisher
UR:
URL (for electronic citations)
Multiple AU and KW tags are possible. For a complete list of the RIS
tags and their possible values see Writing RefDB data input - here is
a more elaborate example of a bibliographic entry in RIS format, taken
from this document:
TY - CHAP
T1 - Physiological studies of the natriuretic peptide family
A1 - Lewicki,J.A.
A1 - Protter,A.A.
Y1 - 1995///
N1 - Atrial Natriuretic Peptide Cardiac synthesis and secretion of /
ANP Regulation of ANP Gene Expression Regulation of ANP Release /
ANP Receptors Biologic Actions of ANP Brain Natriuretic Peptide (BNP) /
BNP Structure Biosynthesis of BNP Biological Actions of BNP C-Type /
Natriuretic Peptide (CNP) Biologic Actions of CNP Modulators of /
Natriuretic Peptide Clearance Effects of Clearance Receptor Blockers /
Effects of Neutral Endopeptidase Inhibitors Role of the Natriuretic /
Peitedes in Physiology and Disease Hypertension Congestive Heart /
Failure Supraventricular Tachyarrhythmias Acute Renal Dysfunction
KW - natriuretic
KW - ANF
KW - ANP
KW - receptors
KW - BNP
KW - CNP
KW - hypertension
KW - congestive heart failure
KW - review
KW - cardiac
KW - regulation
KW - gene expression
KW - expression
KW - brain
KW - structure
KW - biosynthesis
KW - receptor
KW - inhibitor
KW - physiology
KW - renal
KW - study
KW - Peptides
KW - atrial natriuretic peptide
KW - MODULATOR
KW - secretion
KW - Gene Expression Regulation
RP - IN FILE
SP - 1029
EP - 1053
VL - 2
T2 - Hypertension: Pathophysiology, Diagnosis, and Management
A2 - Laragh,J.H.
A2 - Brenner,B.M.
IS - 61
CY - New York
PB - Raven Press, Ltd.
ER -
To build your own bibliographic database, you thus need all your
references in the RIS format. If you found your reference in the web
edition of some scientific journal, or one of the specialized
bibliographic databases on the Internet, like PubMed, chances are that
you will be able to copy the RIS version of the bibliographic entry
with a mouse click on some link. Otherwise, you will either have to
import it with the use of one of the input filters shipped with RefDB,
use the Web interface (which you installed in Section 3.11), or write
all those tags and their values by hand.
For automatic import, RefDB offers the following input filters:
* dos2unix: A simple shell script to convert text files like RIS
documents from DOS-style line endings to Unix-style line endings.
Most refdb tools need their input files with Unix-style line
endings. This is a valuable tool to import reference databases
from Windows reference managers.
* med2ris.pl: A tool to convert Pubmed data in both the tagged and
the XML format to RIS.
* bib2ris: A tool to convert BibTeX data to RIS.
* db2ris: A tool to convert reference data in DocBook SGML/XML
documents to RIS.
* marc2ris.pl: A tool to convert references in MARC format to RIS.
To import all references from a RIS file called, say, refdb.ris, start
refdbc and then type:
addref refdb.ris
Once you have populated your own bibliographic database with entries,
you should export it to a file - it will serve you as a backup and
reference. To export all entries in a file called refdb.ris (this will
overwrite any existing refdb.ris file, so take care):
getref -t ris -o refdb.ris -s "ALL" :ID:>0
Open the refdb.ris file with a text editor and examine it. Pay special
attention to the values of the ID field - we will use this field in a
somewhat tricky way to refer to the bibliographic entries from LyX.
How this is done, is explained in Section 5.19.
_________________________________________________________________
4.14. Use a CSS for DocBook
The following two definitions in the HTML stylesheets (see Section
4.2) specify the CSS that is to be used for HTML output:
(define %stylesheet%
;; Name of the stylesheet to use
;;#f)
"ck-style.css")
(define %stylesheet-type%
;; The type of the stylesheet to use
"text/css")
Of course, you may decide that you don't need a CSS, in which case you
should define %stylesheet% to "#f". But this is only part of the
story! You may discover that your HTML documents still need the
ck-style.css, even if you set %stylesheet% to "#f"! This is because of
the extra processing that the header, body and footer are subject to,
as described in Chapter 8. You will have to change part2 too to
reflect the right CSS.
Talking about a "right" CSS for DocBook, you may find out that there
not so many out there available - see CSS for DocBook for a rare
example. The problem is that the HTML produced by the tools presented
here uses its own classes which don't seem to be widely used outside
DocBook. Instead of inventing the wheel for the third time, just grab
my ck-style.css and use it as is, or adapt it to your purposes. As the
scripts currently use it, it has to be installed in the working
directory, but you can certainly change that easily.
_________________________________________________________________
4.15. Use coolthumbs
coolthumbs is a small, fine script that will create antialiased
thumbnails for your PDF document (those icons that look like miniature
copies of your pages, in the left column of Acrobat Reader, besides
the bookmarks tab). Whithout it, the thumbnails will look "high
contrast" or "edgy". Using coolthumbs will produce hight quality
thumbnails, with the help of Ghostscript and The GIMP (which, of
course, you must also have installed, if you decide to use it). You
can get coolthumbs from the Linux LaTeX-PDF HOW-TO (I would love to
include it here, but unfortunately its copyright notice does not allow
it explicitly).
Install coolthumbs in, say, /usr/local/bin. Then enter its location in
lyxtox and set the use_coolthumbs parameter to 1:
# Shall we use the coolthumbs script to create the PDF thumbnails?
# You can get coolthumbs from
# http://www.ringlord.com/publications/latex-pdf-howto/
# Note that you will also need to have GIMP installed
# and that you will have to edit some lines in coolthumbs too.
use_coolthumbs="1"
These are the values I had to change in my copy of coolthumbs:
* The location of The GIMP:
# Program locations
GIMP="/usr/bin/gimp"
My GIMP scripts directory:
# GIMPSCRIPTS: Your GIMP scripts directory. the file named by
# SCALEALL will be CREATED there and then DELETED again:
GIMPSCRIPTS=${HOME}/.gimp-1.2/scripts
* Width and height of the thumbnails:
THUMBNAIL_W=74
THUMBNAIL_H=105
* Some explanation on the choice of those values is due here: the
ISO/DIN paper sizes (in mm) for the various DIN paper sizes are
shown in Table 4-1 (taken from Paper size).
Table 4-1. ISO/DIN paper sizes
A
B
C
0
841x1189
1000x1414
917x1297
1
594x841
707x1000
648x917
2
420x594
500x707
458x648
3
297x420
353x500
324x458
4
210x297
250x353
229x324
5
148x210
176x250
162x229
6
105x148
125x176
114x162
7
74x105
88x125
81x114
8
52x74
62x88
57x81
9
37x52
44x62
40x57
10
26x37
31x44
28x40
From Table 4-1 we see that if, as the author of coolthumb says,
the values of 82/106 are "pretty much dead-on" for US Letter
paper, then the values 74/105 must be just as "dead on" for DIN
paper (we try to match one paper side as good as possible - and in
this case we see that 106-105 is pretty much as good as can be).
More precisely, it's dead-on for for DIN A7 paper, but DIN papers
have the same aspect ratio throughout the whole paper range (see
Figure 4-2), so the ratio 74/105 for DIN A7 is the same as the
ratio 210/297 for DIN A4 (which is mostly used outside the USA)
and also the same as every other DIN paper.
Figure 4-2. ISO-DIN paper sizes.
[paper-sizes.png]
ISO-DIN paper sizes.
* DPI (dots-per-inch) value for the thumbnails:
SNAPSHOT_DPI=133
* This is the DPI value of my monitor, as taken from the output of
the graphic card driver in /var/log/XFree86.0.log, where it says:
DPI set to (133, 133)
Of course, YMMV (=Your Monitor May Vary ;-)).
* I use thumbpdf version 3.2, so I set
THUMBPDF_V2=0
_________________________________________________________________
Chapter 5. Writing in LyX, thinking in SGML
You have now installed the required software (see Chapter 3) and taken
the required preliminary steps (see Chapter 4) to ensure that
everything is in place and configured correctly. In this chapter I
will describe how write in LyX in order to achieve the desired
results. This may at first look trivial, but is not:
LyX is a frontend for LaTeX. It was designed with TeX/LaTeX in mind,
not SGML. The TeX language and the LaTeX macros describe a document
not only from the structural point of view (using markup that
expresses facts like "this is a paragraph", "this is an itemized
list"), but also from the descriptive one ("use 12pt here", "indent
5cm there"). SGML, on the other side, separates structure from style.
It is clear that when you export a TeX/LaTeX document not each and
every TeX/LaTeX construct that is possible in LyX will find its
equivalent in SGML. Clearly, you will have to use only those
constructs that are common to both, or at least can be mapped to each
other with some reasonable processing of LyX' SGML (done by lyxtox
using runsed and sedscr). Remember this each time you try something in
LyX, only to find out that it does not work in SGML.
Tip Use the .lyx version of this document as a template
Even if this chapter goes into a lot of details regarding writing in
LyX in a manner that is compatible with SGML processing, a real
example is still worth a thousand words. You should thus study real
LyX documents that use the constructs discussed here and compare with
the results in the other versions (HTML, PDF, PS, RTF, TXT and of
course SGML). The best starting point is to use the .lyx version of
this document (to be found in the links of Section 1.2).
Load the LyX version of this document in LyX and study the way various
elements are used. Use it as your template, your starting point for
your own document! If you look attentively, you will see that I am
trying out quite a few non-trivial tricks here, which you can copy for
your own use. [icon_wink.png]
_________________________________________________________________
5.1. LyX environments
Different parts of a document have different purposes; we call these
parts environments. Most of a document is made up of regular text.
Section (chapter, subsection, etc.) titles let the reader know that a
new topic or subtopic will be discussed. Certain types of documents
have special environments. A journal article will have an abstract,
and a title. A letter will have neither of these, but will probably
have an environment that gives the writer's address.
Environments are a major part of the "What You See Is What You Mean"
philosophy of LyX. A given environment may require a certain font
style, font size, indenting, line spacing, and more. This problem is
aggravated, because the exact formatting for a given environment may
change: one journal may use boldface, 18 point, centered type for
section titles while another uses italicized, 15 point, left justified
type; different languages may have different standards for indenting;
and bibliography formats can vary widely. LyX lets you avoid learning
all the different formatting styles.
The Environment box is located on the left end of the toolbar (just
under the File menu). It indicates which environment you're currently
writing in. While you were writing your first document, it said
"Standard," which is the default environment for text. Now you will
put a number of environments in your new document so that you can see
how they work. You'll do so with the Environment menu, which you open
by clicking on the "down arrow" icon just to the right of the
Environment box.
Important Don't use the "Paragraph" environment!
Use "Standard" instead! Using "Paragraph" interferes with the changes
that runsed and sedscr try to effect in the SGML code as exported by
LyX. Writing paragraphs in LyX is treated in Section 5.5 - although
there is actually nothing more to say on this subject for the moment.
Just choose "Standard" and write. [icon_smile.png]
An important thing to keep in mind is that whatever environment you
set in LyX, it will NOT, per se, affect the formatting of your
document! LyX environments tell something about the structure of the
document, never about its formatting (at least not in the context we
will be using them here, i.e. as equivalent to SGML tags). Thus, an
environment of "Standard" will induce the tag when exported to
SGML from LyX. The following quote from the sgml-tools mailing list
deals with a common misconception of (see Use of within
mangles list items):
> I think the definition of means to start on a new line and
break on a new line.
At the risk of being pedantic, I think you're making a mistake of
interpreting DocBook markup tags as having any bearing on format,
which they do not. This is unlike many HTML tags, so if that's the
particular SGML DTD that you have more experience with, it may be
coloring your intepretation.
DocBook tags (and to be honest, most SGML DTDs) are used to
identify the type and purpose of information, but not how that
information might be portrayed in a formatted fashion. That's part
of the whole power of it - by separating formatting/display from
content, you are free to both ignore such issues when documenting,
and yet be totally flexible during formatting on how you want to
present marked up text.
In DocBook, the element is just defined as a "paragraph", a
container sort of element for other inline, and some block,
elements. It says nothing about starting nor breaking on a newline,
although of course such could be selected by a style sheet as an
implementation. In that respect the more tags you have in a
document (and the more granularity of the information so tagged)
the better - it gives the formatter and style sheet the most
flexibility in handling how the formatted output should appear.
We talk about stylesheets in Section 4.2, Section 4.14, Section 7.1.5,
Section 7.1.8 and Section 10.3.2.1.
_________________________________________________________________
5.2. Authors, Credits, Roles
If you have a more complicated situation than just an author for your
document, like affiliations, translators, contributors etc., here's
the right way to enter such information in LyX, so that it can be
exported to SGML:
Create an environment (Section 5.1) of type "SGML" just after the
title and before the abstract. There, enter the information as in the
following example:
ChrisKarakasWebmasterwww.karakas-online.deConversion from LyX to DocBook SGML, Index generationChrisKarakaswww.karakas-online.deTranslation from italianChrisKarakaswww.karakas-online.de
_________________________________________________________________
5.3. Keywords
The metainformation on keywords is not as relevant today (in the
context of search engine optimization) as it was a few years ago.
Nevertheless it may be a good practice to incorporate some keywords in
the header as there are still some search engines around that use them
(Google does not). Here's how you enter keywords in LyX:
After the title and before the abstract, create an environment
(Section 5.1) of type "SGML". There, enter the keywords as in the
following example:
LyXSGMLDocBook
_________________________________________________________________
5.4. Revision history
You enter a revision history as follows:
Create an environment (Section 5.1) of type "SGML" that is located
after the abstract and before the first chapter/section. In this
environment, enter the revision history as in the following example:
1.2
29.05.2003
CK
Some remarks about this revision.
1.1
13.02.2003
CK
Some remarks about this revision.
Revision numbers should be entered in reverse order (i.e., the latest
revision should appear first on the list).
_________________________________________________________________
5.5. Paragraphs
Do NOT use the "Paragraph" environment (Section 5.1) when writing a
paragraph. Use "Standard" instead. Using "Paragraph" interferes with
the changes that runsed and sedscr try to effect in the SGML code as
exported by LyX.
_________________________________________________________________
5.6. Cross references
Cross-references work in exactly the same way as usually in LyX: you
first insert a label (choosing Insert-->Label from the menu), then
insert a cross-reference at a point of your choice (choosing
Insert-->Cross-reference from the menu). BUT: You can't
cross-reference anything! Although it is certainly possible in LyX, it
will not work when exported to SGML: you will get the error
xref to ANCHOR unsupported
See Chapter 6 for a discussion of this error. For the moment, just
remember that the only cross-references that work for our purposes are
cross-references to
* chapters, sections, subsections, subsubsections
* figures
* tables
but that's quite enough for cross-referencing.
Important Always set labels!
Labels of chapters and sections will become the HTML filenames of the
files that contain them. Choose them wisely and make it a habit to
always create a label for your new chapter and section as soon as you
write down their titles! See Section 5.15 for more tips on this
important issue.
_________________________________________________________________
5.6.1. Mass insertion of cross-references in LyX
If you have to add hundreds of cross-references in just one section
(e.g. more than 500, as in Credits for version 2.0 of the PHP-Nuke
HOWTO), you will soon notice that, although a single cross-reference
is inserted very easily in LyX (just choose Insert->Cross-reference
from the menu, then choose the label of the reference you want), it
becomes a real pain if you have to enter hundreds of them.
My solution to this was to write a script that reads a LyX file and
outputs another LyX file that contains references to all labels of the
first one. It was then easier to copy the references from the file
thus created, paste them in Credits for version 2.0 of the PHP-Nuke
HOWTO and then delete the unneeded ones, than try to insert all
cross-references by hand using the LyX menu.
The following script, call it lyxrefs, will print a LyX file in
standard output, containing cross-references to each and every label
of the LyX file whose name was passed on the command line as argument:
#!/bin/bash
#
AWK="/usr/bin/awk"
function preample() {
cat <<-EOF
#LyX 1.2 created this file. For more info see http://www.lyx.org/
\lyxformat 220
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
EOF
}
function label() {
n=$1
echo ""
echo "\layout Standard"
echo ""
echo ""
echo "\begin_inset LatexCommand \label{cit:$n}"
echo ""
echo "\end_inset"
}
preample
# Output LyX commands for Chapter "All references"
cat <<-EOF
\layout Section
All references
EOF
# Output all references.
$AWK 'BEGIN {FS=" "} /\\begin_inset LatexCommand \\label{/ {gsub("label","ref")
;
printf("\n%s\n\n%s%s\n\n%s\n","\\layout Standard",
"\\begin_inset LatexCommand",$3,"\\end_inset")}' $1 > all-references.tmp
cat all-references.tmp
rm all-references.tmp
# Output LyX commands for Chapter "All references"
cat <<-EOF
\layout Section
All figure references
EOF
# Output only the figures.
$AWK 'BEGIN {FS=" "} /\\begin_inset LatexCommand \\label{fig-/ {gsub("label","r
ef");
printf("\n%s\n\n%s%s\n\n%s\n","\\layout Standard",
"\\begin_inset LatexCommand",$3,"\\end_inset")}' $1 > fig-references.tmp
cat fig-references.tmp
rm fig-references.tmp
# Output LyX commands for Chapter "All references"
cat <<-EOF
\layout Section
All table references
EOF
# Output only the tables.
$AWK 'BEGIN {FS=" "} /\\begin_inset LatexCommand \\label{tab-/ {gsub("label","r
ef");
printf("\n%s\n\n%s%s\n\n%s\n","\\layout Standard",
"\\begin_inset LatexCommand",$3,"\\end_inset")}' $1 > tab-references.tmp
cat tab-references.tmp
rm tab-references.tmp
echo "\the_end"
The script will even create three sections, with cross-references to
all labels, all figures and all tables respectively. If you named it
lyxrefs, you would call it as follows:
lyxrefs some-LyX-file.lyx > refs.lyx
Then refs.lyx will contain cross-references to all labels of
some-LyX-file.lyx. You can open refs.lyx with LyX, copy all or part of
the cross-references there and paste them in some-LyX-file.lyx. The
cross-references in Credits for version 2.0 of the PHP-Nuke HOWTO were
entered this way.
_________________________________________________________________
5.7. Images
You insert an image quite simply: from the menu, choose
Insert-->Graphics. Enter the basename of your image (this is the name
without the ending), followed by the ending ".eps". Example: If your
image is called myimage.png, enter "myimage.eps" in the file field.
Don't worry that LyX cannot find your image. Don't worry that all your
images are located in the images directory beneath your working
directory, but you didn't enter any paths. The scripts will take care
of this (see Section 7.1 for the gory details). You just enter
"myimage.eps", that's all.
If you want to see figure captions and titles (and the "alternative
text" in HTML), or if you want to be able to reference a figure, or
see your figure in the "List of Figures" that is created
automatically, then you have to use floats. Follow the instructions
exactly as given:
* Be sure that your cursor is in the "Standard" environment.
* From the menu, choose Insert-->Floats-->Figure.
* In the float, insert an image as explained previously
* While the cursor is still besides the (empty) figure box and
inside the float, change the environment to "Caption" (Section
5.1).
* Now you see the text "Figure#:" to the left of the image box,
followed by the image box . Insert a label (Insert-->Label)
directly after (to the right of) the image box. Through this label
you will be able to cross-reference this figure in your document.
* Type the figure caption text directly after the label. It will
become the figure title and caption text (there is currently no
way to get different texts for figure title and caption text from
LyX, although SGML would support this. If you find an alternative,
please send it to me).
_________________________________________________________________
5.7.1. Inline graphics
I will disappoint you: there is no way to include inline graphics with
the method described in this document - see Section 7.1.6 for the
reason.
Well, almost... [icon_wink.png]
You have always the possibility to write SGML in LyX: just create an
environment (Section 5.1) of type SGML and enter your text (in
elements), followed by
]]>
]]>
]]>
]]>
Inline graphic
Substitute "1" with the basename of the inline graphic (i.e. the name
without path information and without ending). Of course all necessary
formats (PNG, EPS, PDF and BMP) with the right density settings must
be available under the ./images directory, see Section 4.9.
Caution Caution:
You must insert the above SGML code without introducing newline
characters, which in LyX will produce
elements when exported to SGML. Thus, for the above sentence and
inline icon, you would have to enter
Well, almost... ]]> <
![ %output.print.pdf; [ ]]> ]]> ]]> Inline graphic
_________________________________________________________________
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
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!
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 /, not only
or . Here is a more complicated example that uses an itemized
list (through the tag) , this time for the "Tip"
admonition:
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.
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/dbpara
m.dsl
* /usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/print/dbpar
am.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 tag):
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
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
_________________________________________________________________
5.9. Callouts
Callouts are those reverse-video circled numbers or "(1)", "(2)", etc.
that you see appended to selected lines in some code examples, like
the following:
baseurl={http://www.karakas-online.de/mySGML/}, (1)
pdftitle={Document processing with LyX and SGML}, (2)
pdfsubject={Linux,document formatting}, (3)
pdfauthor={Copyright \textcopyright 2004, Chris Karakas}, (4)
pdfkeywords={Linux SGML LyX DSSSL DocBook} (5)
(1)
The baseurl will be added in front of any relative WWW link
that you have in your PDF document.
(2)
The pdftitle will appear as the title of your PDF document in
Acrobat® Reader under File-->Document Info-->General.
(3)
The pdfsubject will appear as the subject of your PDF document
in Acrobat® Reader under File-->Document Info-->General.
(4)
The pdfauthor will appear as the author of your PDF document in
Acrobat® Reader under File-->Document Info-->General. You may
add copyright information as shown here.
(5)
The pdfkeywords will appear as a list of keywords for your PDF
document in Acrobat® Reader under File-->Document
Info-->General. Keywords are separated by blanks.
Just as is the case with admonitions (see Section 5.8), there is no
LyX environment (Section 5.1) for callouts (there is no such
environment for TeX/LaTeX either, which is the reason why it is absent
from LyX too). The only way to get callouts to work with LyX ist to
create an SGML environment and put the SGML code there. For the
example above, here is what you would have to write in the SGML
environment:
baseurl={http://www.karakas-online.de/mySGML/},
pdftitle={Document processing with LyX and SGML},
pdfsubject={Linux,document formatting},
pdfauthor={Copyright \textcopyright 2003, Chris Karakas},
pdfkeywords={Linux SGML LyX DSSSL DocBook}
The baseurl will be added in front of any relative WWW link
that you have in your PDF document.
The pdftitle will appear as the title of your PDF document
in Acrobat® Reader under File-->Document Info-
->General.
The pdfsubject will appear as the subject of your PDF document
in Acrobat® Reader under File-->Document Info-
->General.
The pdfauthor will appear as the author of your PDF document
in Acrobat® Reader under File-->Document Info-
->General. You may add copyright information as shown here.
The pdfkeywords will appear as a list of keywords for your PDF documen
t
in Acrobat® Reader under File-->Document Info-
->General. Keywords are separated by blanks.
_________________________________________________________________
5.10. Tables
For table captions and titles to be output correctly, you have to
insert tables in the following way:
* Be sure that your cursor is in the "Standard" environment (see
Section 5.1).
* Insert a table float (from the menu: Insert-->Floats-->Table)
* You get a table float containing one line. Change the environment
on that line to "Caption".
* You see the text "Table#:" and the cursor is positioned
immediately to the right of it. Insert a label for the table (from
the menu: Insert-->Label).
* After the label, on the same one line: type the table title and
press . This will produce a element we will
eliminate in sedscr (see Section 7.1.4.1).
* On the new line, insert your table as usual.
A warning about an "end tag for element "TABLE" which is not open",
when processing the SGML file with Jade, is the less evil we can get
(see Chapter 6) and is harmless (probably caused by a LyX bug in
version 1.2.0).
A LyX related concern is that text within a cell will not wrap to fit
the page, so if a line of text in a table is too long, the table will
extend beyond the right margin of the page. Similarly, LyX's table
inset will not split itself at the bottom of a page, and so might
extend below the bottom margin. You have these options to resolve this
problem (taken from the LyX User's Guide):
1. Split it into two tables, to correctly handle pagebreaks and
margins.
2. Select the Longtable button in the Table Layout dialog. This
automatically splits the table over more pages, if it is too high.
After doing this, the list of Longtable buttons activate
themselves and you may now define:
a. FirstHead: The current row and all rows above that don't have
any special options defined, are defined to be the
header-lines of the first page of the multipage-table.
b. Head: The current row and all rows above that don't have any
special options defined, are defined to be the header-lines
of all pages of the multipage-table except for the first page
if FirstHead is defined.
c. Foot: The current row and all rows above that don't have any
special options defined, are defined to be the footer-lines
of all pages of the multipage-table except for the last page
if LastFoot is defined.
d. LastFoot: The current row and all rows above that don't have
any special options defined, are defined to be the
footer-lines of the last page of the multipage-table.
e. NewPage: This forces a pagebreak after the row where this
flag is defined.
If you define more flags in the same table row, you should be
aware of the fact that only the first flag is used in the defined
table rows. The others will the be defined as empty. In this
context, first means first in this order: Foot, LastFoot, Head,
FirstHead. See the TableExamples.lyx example file to see how this
works.
3. Use the Width entry in the Table Layout dialog to restrict the
width of the table till it fits horizontally.
4. A table can also be placed in a float, as described below, which
will allow TeX to place it as well as it can within the page.
One last remark: Longtable and Rotate 90° use special LaTeX packages,
so you should look into LaTeX configuration in the Help menu to see if
your system supports these features.
_________________________________________________________________
5.11. Table of contents
LyX provides its own command for the creation of a Table of Contents
(from the menu: Insert-->Lists&TOC-->Table of Contents) - but you
should not use it! Whether a table of contents will be created or not
is entirely controlled by the stylesheets (see Section 4.2 and Section
7.1.5). For example, the following code in a stylesheet specifies that
a Table of Contents has to be created for document type "Article":
(define %generate-article-toc%
;; Should a Table of Contents be produced for Articles?
#t)
_________________________________________________________________
5.12. List of figures, tables and equations
A list of figures is created automatically for the document type "
DocBook book SGML". You don't need to undertake anything here. The
same is true for lists of tables and equations. This is true as long
as you use the DSSSL stylesheets (that form part of DocBook,
seeSection 3.2) with their default settings. In case you don't get a
list, when you think you should, read in Section 7.1.5 about the
generate-book-lot-list stylesheet parameter.
_________________________________________________________________
5.13. Epigraphs
An epigraph is a short inscription at the beginning of a document or
component. LyX only provides the "Quotation" environment, which is
mapped onto the blockquote SGML element, when exported. For an
epigraph as such, there is no provision (as is the case with all SGML
tags that do not have a clear correspondence to TeX/LaTeX environments
- see Section 5.1 for the notion of an environment in LyX).
However, you can always define an SGML environment and write the
necessary SGML tags there. For an epigraph, you would then write for
Norm's favourite quote: [icon_wink.png]
William Safire
Knowing how things work is the basis for appreciation, and is
thus a source of civilized delight.
See Chapter 7 for how the end result looks like.
_________________________________________________________________
5.14. SGML code in program listings
If you want to write executable SGML code in LyX, e.g. to implement an
admonition (see Section 5.8) or a callout (see Section 5.9), there is
no problem: just create an environment of type "SGML" and enter your
code there. It will be part of the exported SGML file.
But if you want to give some example SGML code, like in a program
listing, then it might be a better idea to move the code in a separate
file and include that file per reference. This is because if the SGML
code contains "", it is likely to interefere with
the normal SGML processing, causing errors like the following:
/usr/bin/openjade:0:382:323:E: marked section end not in marked section d
eclaration
To include a file, choose from the menu Insert-->Include file. In the
dialog box, choose "Verbatim" and enter the file name. The file should
best be located in the same directory as the SGML file exported from
LyX (but need not necessarily to).
LyX will use the "inlinegraphic" SGML tag to include the file. This
will collide with inline graphics, if you want to include them using
this method too (see Section 5.7.1 and Section 7.1.6).
_________________________________________________________________
5.15. Filenames
It would be nice to have a "Filename" environment for DocBook SGML
articles or books in LyX, it would make computer documentation much
nicer. But I was unable to find one, or a workaround to it. If you
find a way, please let me know. Of course, a poor man's solution could
be to mark a filename with the "!" button, making it part of an
tag, which would then appear in italics. But this
contradicts the very idea of SGML - separation of content from
formatting.
_________________________________________________________________
5.15.1. Labels as filenames
You should always put a label after the
chapter/section/subsection/subsubsection title (from the LyX menu:
Insert-->Label). The text you use for the label will become the name
of the HTML file that contains that chapter/section etc. See Section
7.1.5 for the code that controls this setting in the stylesheets (it
is the use-id-as-filename DSSSL parameter. that does this).
Tip SEO (Search Engine Optimization) tips
There is circumstancial evidence that the search engines (especially
Google) weigh substantially the keywords that appear between
,
,
tags (that's the chapter's and sections' titles) especially
if they also appear as part of the HTML filename. You are thus well
advised to follow some simple rules for your titles (er...filenames
[icon_wink.png] ):
* Always create a label. Failing to do so, will produce and
automatic, nothing-saying filename. You loose a potential
(although small) ranking boost from the search engines, if your
section is about, say, blue widgets, but is called x543.html,
instead of blue-widgets.html.
* The label should contain the same text as the title. The title you
enter in LyX will automatically be the HTML title in the header
part of the resulting HTML file (this is a meta-information, not
visible to you, but very well visible to the search engines), as
well as the title inside the
,
, or
tag that is
produced in the HTML body automatically as well. If the label is
similar to the title, then the HTML filename will be similar to
the titles (meta-title and actual text title) of the text inside
it. This wil be rewarded with more weight in the search engine
ranking, resulting in a higher place in the SERPS (Search Engine
Result Pages). And believe me, even if you hate search engines, it
is much easier to find a chapter by reading "talking" filenames,
like blue-widgets.html, than cryptic ones like x543.html!
* Dont'use blanks. Use hyphen "-" instead. This makes use of the
fact that for most search engines "-" is equivalent to a blank.
This is not the case for underscore "_".
* Don't use illegal characters, i.e. characters that are not allowed
in HTML filenames.
_________________________________________________________________
5.15.2. Cool labels don't change!
There is one thing to keep in mind when regrouping: chapter and
section labels - DON'T change existing ones! You may change their
position, but please not the label. Subsection and subsubsection
labels can be changed without problem.
Why? Because chapters and sections will become separate HTML
documents. There is a DSSSL stylesheet setting which controls how deep
a level will still produce a separate HTML document (see the
decription of chunk-section-depth in Section 7.1.5). The name of the
documents will be the label of the chapter and section respectively.
This is a behaviour we explicitly set in the DSSSL stylesheets (see
Section 7.1.5) through the use-id-as-filename DSSSL parameter..
Obviously, you can move a section around, without affecting the HTML
name of the resulting file, if you don't change its label. You can of
course change its contents, put it somewhere else as a section of a
different chapter etc., but you should leave the label untouched.
The problem is that, if the document is already on the Web and is
receiving a lot of visits, most of them (experience suggests a number
around two-thirds of the total number of visits) will be from search
engines. If you change the section label, the HTML name changes.
Consequently, the link from the search engines is no longer valid. The
same is true for private bookmarks, or public bookmark lists.
But there is more to it: it's not only a matter of waiting 2-3 weeks
for the new HTML document that contains the old (a bit reorganized)
content to be indexed by the search engines. It's that the old name
might have been at page 1 of the SERPS (Search Engine Result Pages) of
some search engine for some keyword, because a lot of other people
linked to it. Now, with a changed label and, consequently, a new HTML
file name, those links do not reference the new document, and it gets
a ranking close to "nowhere" (because search engines, notably Google,
take links to a document to mean "votes" for that document and rank
that document accordingly). The result: nobody finds it.
[icon_frown.png]
Note It's not a question of sacrificing quality!
I am not trying to tie up your hands in favour of a higher search
engine ranking here! This discussion is not one of quality vs.
ranking, but one of consistency. All I am advocating is: keep your
labels (and consequently your filenames) consistent between various
releases of your document! Once you have chosen a label for a chapter
of section, stick with it.
Please also note that we are not talking about the title of a chapter
or section, but its label. "Label" is LyXese for the "SGML id". You
get a label from the "Insert -> Label" menu of LyX. Don't confuse
title and label in this discussion!
For example, suppose a chapter with the title "Blue widgets" is at
around place 6 out of 2,5 million (!) for "blue widgets" on Google. If
you change the label of the chapter from "blue-widgets" to something
else, then the original URI will disappear and you loose readers. Of
course, changing the title also affects the SERPS (Search Engine
Result Pages), but not as drastically as to eliminate the document
altogether. However, Google likes a title that is correlated to the
file name, so a title "Blue widgets" and a label "blue-widgets" are
optimal from the SEO (Search Engine Optimization) point of view (see
Section 5.15.1).
"But you are talking me into subjecting my writing to the whims of a
search engine!", you might counter. Nothing more far away than that!
The point is not to restrict your writing. The point is: you write
whatever you like, however you like and structure it as you please.
There are rules for good writing that you might choose to observe, or
not. There are also rules for good "copy" , from the point of view of
keywords, search engines and ranking - which you are also free to
observe or defy.
Then, at some point, you decide to put the document on the web. People
will come, read it and, hopefully, find it good. Those people may like
your document so much, as to go into the trouble to say something like
"there's a cool document on blue widgets in this link here" - and link
to it. Hundreds of people may do this perhaps - even thousands.
Imagine the effort!
Now you come up with a new restructuring of you document - fine! You
change the content - also fine! Then you change the label from:
Blue widgets
to:
Blue widgets revisited
In LyX, this is equivalent to changing the title from "Blue widgets"
to "Blue widgets revisited" and the label from "blue-widgets" to
"blue-widgets-2". Perhaps you thought it would be a nice idea to
change the title to reflect the reorganization. This will affect your
ranking too, but then, almost everything that you write will affect
it, so we will not discuss it here. (Actually, it will affect it a
little more because it's on the title - but that's again not the
point.).
But by changing that label from "blue-widgets" to "blue-widgets-2" you
just managed to throw your document from place 6 to place 600 (or
6000, or...) in the SERPS. You just killed all the efforts of
thousands of people that linked to your document!
Why?
Because labels become filenames in the document process from SGML to
HTML (see Chapter 7 for a detailed explanation of this process). The
document that would be blue-widgets.html now is blue-widgets-2.html.
The original blue-widgets.html is nowhere to be found in your domain -
hundreds, or even thousands of links on the Web now point to vacuum!
Google - and every other search engine - sees this and takes the old
URL out of the index. Of course, it indexes the new one. But the new
one does not have any links pointing to it - not yet. And perhaps
people will not be willing to go into the trouble of changing all
their documents, just because you wanted to keep your freedom of
choosing (and changing!) the label (and the resulting HTML filename)
at your whim. Thus, noone points to the new "reorganized" document. It
is rated very low and appears at place...uhmm 1 million something, out
of 2,5 million results for "blue widgets", where nobody will find it
and nobody will read it. Remember, the original document ranked at
place 6 out of 2,5 million!
You might think that, since the label-to-filename connection exists
only for the "chunked" version (the version where openjade is
instructed to split the document into separate HTML files, one per
chapter or section, the so-called "chunks", as explained in Section
7.1.4.6), the "unchunked" document will save you from this disaster.
You are correct, the "single chunk documents" (single, big HTML file,
TXT, PDF or PS versions) will not be affected .
If you only make the big HTML file, or the TXT, PDF and PS versions of
your document available on the web, then you are not affected. But if
you also made the chunked HTML version available at some point, the
search engines will prefer to return results from this version, than
from the others.
There are various reasons for this, one of them being that search
engines don't read a document that is too long till the end and will
thus index small chunks much better than huge textst. Another reason
is that you need more links to a PDF document, to force a search
engine to consider it important for indexing.
So forget about the huge, one-chunk docs as a search engine strategy.
If you want to be found by the SEs, you must rely on the chunked
versions - and perhaps a little on PDF, but only a little.
However, my point goes even further: we are not talking about a user
who is searching for a unique, multiple keyword phrase that identifies
the content of your reorganized document. We are talking about a user
who just searches for, two keywords: "blue widgets". If you change the
label, you change the filename of the chunked version. If you do so,
the search engine will NOT think "Ahh...the file blue-widgets.html is
not there, let's present the huge document that contains all chapters,
including the one on blue widgets - at the same ranking place"! There
are three resons that this will not happen - and you should not rely
on it:
1. First, the search engine does not know that blue-widgets.html is
just a chunk of some "whole" document, book1.html. There is
nothing that a search engine does to find this out - not with
today's technology. The two documents are different from the
search engine point of view.
2. Second, the big one, book1.html, contains much more text,
therefore the importance of the "blue widgets" chapter is
"diluted" from the surrounding, irrelevant text (irrelevant to
what the user is searching with those keywords, namely "blue
widgets"). This has to do with " keyword density", titles,
structure and other "on-page" factors that the search engine
calculates and takes into account for each page. Therefore, the
document will rank at a place that is way back - invisible to all
but the most determined searchers, practically dead.
3. Third, if you are a HOWTO author, you may put your document on The
Linux Documentation Project, which is a great place with good
exposure to the Web, but that alone does not guarantee good
ranking. What is also important, is that people link to it. But if
you change an existing label, thus changing the filename of the
chunked version (which is the most important one from the search
engine point of view for the reasons stated above), then you kill
all the links to the previous URL. You destroy what you were able
to gather up to that point in terms of search engine visibility.
You start anew.
Tip Use permanent redirects, if you do choose to change the label!
Let me put a preemtive disclaimer here: I know that you can put a
"HTML permanent redirect" in your .htaccess file to indicate that the
resource is now somewhere else, under a different name. But this makes
URL management difficult for a webmaster. How on earth shall the
webmaster know which labels some author, whose document he hosts on
his website, changed in his last reorganization? Is he supposed to do
nothing else a whole day, other than chasing diff outputs and editing
.htaccess files? Just because the author wants to keep his freedom of
changing labels at his whim? Remember, if it is a free document, it
will find its way to other people's websites. People may link to files
of those websites containing your document, even more often than they
do to yours. When you release a new version with changed labels (and
accordingly, filenames), do you send a list of changed labels to all
those webmasters who host it, with the request to update their
.htaccess files?
Certainly not.
Nevertheless, if you are the author and have decided to change the
label of some chapter or section, don't let your web server send an
"Error 404: not found" for the old URI. Let it send a "permanent
redirect" instead. See Managing URIs and the links therein, for the
preferred ways to handle this situation.
But again, a redirect has to be in your .htaccess file (or web conf
file) until the last request has been seen in your web logs for the
old URI (theoretically, at least, otherwise you loose the visitor).
How long is this? One year? Ten years? How big does your .htaccess
become if an author starts "reorganizing" his labels(!) every other
week? How much of a performance penalty will you have to pay for your
web server having to read and process huge .htaccess files on every
page request?
Thus, every redirect will hurt you, either in terms of visibility in
the SERPS, or in terms of complexity, or both. But if you change a
label, don't forget the permanent redirect.
For the above reasons, most of the time, you will not feel the need to
change labels while reorganizing, but think doubly about it if you
must. Your best bet is to choose a label wisely (for the same reasons
that you would Choose URIs wisely), perhaps with a name that is a bit
more general than you might wish, but will still fit if you choose to
change content, or even title, later on.
Cool URIs don't change. Cool labels don't change either.
[icon_cool.png]
_________________________________________________________________
5.16. Examples
There is no "Example" environment in LyX for document types of DocBook
SGML book/article. You could certainly "simulate" it with a pure SGML
environment, just as we did it for admonitions (Section 5.8) and
callouts (Section 5.9), but I will not pursue this further here.
_________________________________________________________________
5.17. Mathematics
You write Mathematics in LyX the usual way (see, for example, the
Tutorial and the User's Guide that come with LyX). There is absolutely
nothing special you have to take care of. Here is an example:
Equation 5-1. (eq1)
[12208.png]
Whatever you type in math, it will be typeset by TeX and be available
in all formats - HTML, PDF, PS and RTF! Isn't it great?
You should nevertheless read Section 10.1 to ensure that you installed
the necessary software for math processing and Chapter 10 to get an
idea of what is going on in the background. There are more Mathematics
examples for LyX in Section 10.2, where the subject is discussed in
more details.
_________________________________________________________________
5.18. Appendix
LyX offers the possibility to mark a part of the document as being the
Appendix: from the top menu, choose Layout -> Start Appendix here.
Unfortunately, this will not work when the document is exported to
SGML. We are thus left alone and have to implement a workaround. I
have implemented the following solution:
* The writer provides an extra LyX file, with the fixed name
"appendix.lyx", in the same directory as the main document.
* The appendix. lyx file must be of type " DocBook article (SGML)",
to be chosen from the LyX menu: Layout -> Document. A document
type of " DocBook book (SGML)" will NOT work, even if the main
document is of book type! This is because if you set the document
type to book, you will have to start with Chapters (instead of
Sections) and then you will get parsing errors from openjade
saying that CHAPTER is not allowed by the DTD at that place.
* The appendix is marked as such, using LyX' menu: Layout -> Start
Appendix here, with the cursor at the very start of the Appendix.
That's all! The lyxtox script will check if a file called appendix.
lyx is there and will take the aproppriate steps to incorporate it
into the document (see Section 7.1.9).
Tip How to insert cross-references to the Appendix
To insert a cross-reference to the Appendix (more precisely to a
section, subsection, subsubsection, table, figure or equation in the
Appendix), you use the same mechanism in LyX, as you would do for
cross-references to labels that exist in a separate file: from the
Insert menu, choose "Label", then, from the drop-down list for
"Buffer", choose the appendix.lyx file (which you should have already
opened in LyX). LyX will then present you with all available labels
from the appendix.lyx file to choose for your cross-reference.
_________________________________________________________________
5.19. Bibliography
So you want to use LyX to process citations and include a reference
list at the end of your document? And all this in SGML? You are at the
right place! [icon_smile.png]
To begin with, here is just a test citation: (8) . And another one:
(9) . Take the time to examine them and their formatting in the
version (HTML, PDF, PS, RDF or TXT) you are currently reading.
_________________________________________________________________
5.19.1. Bibliography without RefDB
As stated in Section 3.11, you are not confined to using RefDB whith
my lyxtox script. If you don't feel like building your own
bibliographic database, you can just supply a bibliography. lyx file
together with your LyX document. Set the process_RefDB variable in
lyxtox to "0" and it will use your own bibliography. lyx to produce a
bibliography.sgml file, instead of trying to create one automatically
through RefDB. The bibliography. lyx file should then contain the SGML
code for the references list, in the SGML environment of LyX. The
GNU/Linux Command-Line Tools Summary HOWTO uses this approach, for
example.
This means that if you don't want to use RefDB, but still want to have
a bibliography, your bibliography. lyx file should look like:
KarakasChrisNeuronale Lernregeln und andere Methoden für lineare Assoziation und Tre
nnungBoD GmbH, Norderstedt
An examination of neural network methods and methods from classic optimization
theory for solving the problem of linear association and separation. After a fo
rmal mathematical definition of neural networks, the linear association problem
and some so-called "learning rules" for its solution are considered:
...more Abstract text here.
...
more elements here
...
The whole code should be in the LyX SGML environment (see Section 5.1
for an explanation of LyX environments). You can even insert URLs and
cross-references the usual LyX way (from the LyX Insert menu) and they
will be correctly exported to SGML. The layout of bibliography. lyx
should be " DocBook Chapter (SGML)" (to be set from the LyX Layout
menu). You don't need anything in the preample or elsewhere. See the
bibliography.lyx file in the Formats section of GNU/Linux Command-Line
Tools Summary HOWTO for an example.
To cite a reference from a reference list created this way, you have
to switch to the SGML environment for the whole paragraph containing
the citation, then write as in the following example:
Consult KARAKAS1992 for more details on
neural learning rules.
Note that we use the value of the xreflabel attribute to refer to the
reference entry.
Note Formatting your Reference List.
Note that this way of creating a Reference List and citations does NOT
cover formatting of either citations or the entries in the Reference
List itself. Note also that each journal (or medium) has its own
formatting expectations as far as the Bibliogrphy is concerned. You
will have to write your own DSSSL driver file to accomodate for this
need. RefDB (10) (Section 5.19.2) takes this burden out of your work
for the slight overhead of setting up a database and installing the
RefDB package (Section 3.11).
_________________________________________________________________
5.19.2. Bibliography with RefDB
You don't need to care about a bibliography.sgml file if you use RefDB
- the lyxtox file will create it automatically with the help of RefDB,
totally transparently to you. All you need is install and set up RefDB
(see Section 3.11 and Section 4.13 respectively), and set the
following variables in lyxtox:
* Process_RefDB to "1".
* RefDB_db to the name of the RefDB database containing the
bibliographic entries you plan to cite (you created this database
in Section 3.11, the name in the example was "ck_refdb" and is the
default one in lyxtox - you should of course change this).
* REFDB_style to the style of the journal you want your Bibliography
to conform to.
Note that this name must contain a dot at the end, because lyxtox will
create, the file ${REFDB_style}dsl.
Example: for REFDB_style="J.Biol.Chem.", lyxtox will automatically
create (through RefDB) the file J.Biol.Chem.dsl, i.e. the "dsl" ending
is appended without any extra dot. The default value is
"J.Biol.Chem.", one of the two standard styles shipped with RefDB, and
should get you starting. See How to manage bibliography styles for
more details on bibliography styles in RefDB.
The only thing that remains is... cite of course!
Citing with RefDB in LyX is a bit tricky, since LyX does not allow
citing the way RefDB is expecting it: with a role attribute with the
value "REFDB" in the SGML citation code. Of course, we could use a
pure SGML environment as in Section 5.19.1 and write:
Consult
for more details on neural learning rules.
each time we want to cite something. But there is a better way: RefDB
can create that SGML code automatically, if it finds something like:
Consult "KARAKAS1992"
for more details on neural learning rules.
in the SGML file. But how can we convince LyX to output something like
the above for each citation when it exports our file to SGML?
The solution I found to this is:
1. Export all the bibliographic entries you plan to use in a file,
say refdb.ris (see Section 4.13 on how to do this).
2. Use the awkscr_cit AWK script to create a new LyX file from
refdb.ris:
awkscr_cit refdb.ris > citlabels.lyx
The citlabels.lyx file is a LyX file containing only labels, one
for each bibliographic entry in refdb.ris. The labels have the
prefix "cit:" to distinguish them from true labels. To stay with
the above example, the bibliographic entry with ID "KARAKAS1992"
will produce a label "cit:KARAKAS1992" in the citlabels.lyx file
created by awkscr_cit.
3. Open the citlabels.lyx file in LyX, together with your document.
4. To cite an entry, you (mis)use the "Insert Cross-Reference"
feature of LyX: from the LyX menu, choose "Insert -> Cross
Reference". In the upcoming dialog box there is a drop-down list
field called "Buffer". The Buffer serves as the source of the
labels you want to reference. Usually, "Buffer" is set to the
current file. You change this to "citlabels.lyx" by clicking on
the dropdown field and choosing the citlabels.lyx file. Now you
are presented with all labels of citlabels.lyx. Choose the label
containing the ID of the RefDB bibliographic entry you want to
cite. In our example, you choose "cit:KARAKAS1992", if you want to
cite the entry with ID "KARAKAS1992".
That's all! Don't worry about that "cit:" prefix, sedscr takes care
about it. For every cross-reference to a label of the form
"cit:IDsome", sedscr will create a citation of the form:
"IDsome"
in the exported SGML file. Then, lyxtox will call the aproppriate
RefDB tools to transform this citation to
or some more complex form according to the bibliographic style in use.
Again, you don't have to worry about this procedure. Just create the
citlabels.lyx file as shown above and insert cross-references to its
labels in place of your citations. You don't have to bother about SGML
code and you can't get the ID's wrong since you get a list of all
available labels in citlabels.lyx to choose from. On the other hand,
you can't get anything but "simple" citations this way, but at the
moment I can live with that. See Section 7.1.10 for a detailed
explanation of what lyxtox and RefDB do for you in the background to
produce correctly formatted citations and a correctly formatted
Reference List.
More elaborate solutions (using a citlabels.lyx file containing two or
more labels for each bibliographic ID, each one with a different
prefix, serving different citation purposes, "simple" or "complex"
ones) are possible, but my hope is that this work will convince the
LyX development team to incorporate RefDB directly in LyX in a future
version. In the meantime, the method presented works fine - here and
now. [icon_cool.png]
_________________________________________________________________
5.20. Index
The index will be generated automatically by the lyxtox script (which
will call the collateindex.pl Perl script that came with the
docbook-dsssl-stylesheets package you installed in Section 3.2) as a
separate file. You must arrange to have this file incorporated into
your document. The easiest way to do this is by file entity reference.
In the preample of your document, add an internal subset that defines
the index file entity:
We have done this already in Section 4.6. See Section 7.1.9 for the
sed scripts that insert the appendix SGML entity at the end of the
SGML file and Section 7.1.11 for the explanation of the subsequent
index generation.
From the user perspective, all it remains is to enter the words that
shall be included in the index. This is done as usual in LyX: from the
menu, choose either Insert-->"Index entry of preceding word" (which I
personally find easier), or Insert-->"Index entry", then enter the
required word.
Important Don't underestimate the importance of an Index!
It is easy to neglect index generation. It is so boring, having to
read the whole document again, word for word, and hour for hour use
the menu to "insert index entry of preceding word"! But don't
underestimate the importance of a good, complete index for your
document, especially if it is of the order of a book! A knowledgeable
reader will allways appreciate the possibility to use the Index to
arrive at the information he is searching, rather than the usual
time-consuming physical, or, even worse, virtual page browsing. Plan a
whole working day for index generation of every 100 pages of text.
_________________________________________________________________
5.20.1. Automatic Index generation
LyX provides an easy way to insert an Index entry (see Section 5.20):
from the menu, choose either Insert-->"Index entry of preceding word"
(which I personally find easier), or Insert-->"Index entry", then
enter the required word. This method works fine - if you have a small
document, with only a few keywords to insert. But what if your
document has grown to hundreds of pages, with hundreds (or even
thousands) of index entries to insert? See the Index of the PHP-Nuke
HOWTO for an example of an Index that cannot be generated manually -
unless you want to drive yourself crazy!
Clearly, for a comprehensive Index of large documents, an automatic
procedure is necessary. However, the general problem of automatic
Index generation is subject of extensive (and still not conclusive)
research and I am not going to address it in its full generality here.
For our purposes, even a semi-automatic procedure would be very
helpful. To this end, I have created the following 4 scripts:
* sedscr_list_index_items: lists all index entries contained in a
LyX document.
* sedscr_delete_index_items: deletes all index entries from a LyX
document.
* awkscr_create_index_items: creates a list of words used in a LyX
document. The list can be subsequently edited manually, mostly
deleting unwanted or uninteresting words, to yield a list of words
that are used in the document and are interesting enough to be
part of its Index.
* awkscr_insert_index_items: uses an externally supplied document
containing a list of index entries to insert an index entry in a
LyX document for every word appearing in that list.
They can be used in the following semi-automatic Index generation
procedure:
1. Optional: create a list of all existing index entries in your
document. This is useful not only because you are going to
eliminate all index entries from the document in the next step,
but also as a backup of the index entries that were currently in
use - you might want to reuse them in some later step.
To create a list of all existing index entries in your document,
type:
sedscr_list_index_items document.lyx > indexitems
The generated indexitems file will contain a list of all index
entries in document.lyx, one index entry per line, with a
semicolon at the end of each line. The semicolon will be used
later as a record delimiter in the awk scripts that follow, so
don't let it irritate you.
To get an alphabetically sorted list of index items, without
duplicate entries and with all symbols at the beginning of the
list, use the sort and uniq utilities as follows:
cat indexitems | sort | uniq > indexitems.sorted
mv indexitems.sorted indexitems
2. Remove all previous index entries from the LyX document. You need
this preliminary step because, if you forget to remove already
existing index entries, a subsequent run of the
awkscr_insert_index_items script may substitute even the existing
index terms (those already inside the LyX \index commands) with
LyX \index commands. This may or may not happen, depending on the
regular expressions used in the current implementation of
awkscr_insert_index_items, but it is better to err on the side of
caution. What will happen, however, is that repeated invocations
of awkscr_insert_index_items will add index entries besides
already existing ones. You will thus end up with a document that
contains double index entries for each index term in your
indexitems file.
Besides, there is another reason why you might want to remove all
index entries from your LyX document: a LyX text cluttered with
index entries may still be a breeze to read for a computer, but
quite a headache to read for humans.
To remove all index entries from a LyX document, type:
sedscr_delete_index_items document.lyx > document-noindexitems.lyx
The generated document-noindexitems. lyx will contain everything
from document.lyx - except the index entries.
3. Create a list of all index entries to be used in the LyX document.
This is the most difficult part: as said above, this problem is
not trivial. We will thus content ourselves with a list of all
words used in the document. Once we have all words, we can still
edit the list manually and delete all unwanted entries. This is
what makes this procedure semi-automatic and not automatic. The
idea is that it is still better having to delete 10000 lines from
a 12000 line document, than having to insert 2000 index entries
from the LyX Insert menu.
To create a list of all words used in a LyX document, type:
awkscr_create_index_items document.lyx > words
There is even some code in awkscr_create_index_items that checks
whether the current word is in some "trivia" list of trivial words
and discards it. In such a case, you would call the script with
two arguments, as follows:
awkscr_create_index_items trivia document.lyx > words
However, this part of the code is either too slow, or buggy, so it
is commented for the moment (feel free to send corrections or
suggestions).
It is a good idea to sort your words alphabetically and delete
double entries, so do:
cat words | sort | uniq > words-unique
mv words-unique words
Once the list of all words of your document is created, all you
have to do is open it with a text editor and delete all unwanted
words or correct the ones that are in plural or have some
punctuation at the end and so on. This is still hard if your
document is large, but still a faster alternative than targeting
the Insert menu with the mouse 8000 times (I guess each one of my
2000 index entries appears 4 times in my document, which gives me
an estimate of 8000 menu selections with the mouse - unfortunately
no keyboard bindings were found to work on my system).
You should delete all lines containing characters that could be
interpreted as metacharacters of regular expressions: *, +, ?, $,
&, ^, \ - and probably many others. Don't try to escape them, it
will not work: awkscr_create_index_items will replace the correct,
string with the escaped string, adding an index entry for the
escaped string too! This is not what you will want. What is rather
needed here is a mechanism to search for the escaped string, but
replaced it with the verbatim one (i.e. the string without the
escaping backslashes). This is still work to be done (FIXME).
Practically, this restriction means that you will have to add your
index entries for symbols like *, +, ?, $, &, ^, \ manually, each
time after you run awkscr_create_index_items.
4. Once you have a file, say indexitems, with all words that should
appear in the Index of a LyX file, type:
awkscr_insert_index_items indexitems - < document-noindexitems.lyx > document-i
ndexitems.lyx
to create from document-noindexitems. lyx a document with index
entries (document-indexitems.lyx) for all words in indexitems.
Warning Long execution time!
The current implementation of awkscr_insert_index_items takes really
long to execute, if the indexitems file is large: For 3000 words in
indexitems, producing about 9000 index entries in the final document
(of which 3000 are duplicate), the script may well need 1-2 hours on a
Pentium 3.4 GHz - go get a cup of coffe! [icon_smile.png]
Some notes on awkscr_insert_index_items's mode of operation:
* The "-" in the above invocation is important: it forces the awk
script to continue reading from standard input, after it has read
indexitems. This, together with the code
FILENAME == "indexitems" {
n++
indexentry[$1] = $1
next
}
in awkscr_insert_index_items, causes the words in indexitems to be
imported into the indexentry[] associative array.
* The file separator in awkscr_insert_index_items is set to the
semicolon ";", instead of the default, which is space. This makes
it possible to enter index entries with more than one words.
Accordingly, the awkscr_create_index_items script appends a
semicolon at the end of each word it prints - you should leave
these untouched!
* awkscr_insert_index_items follows a simple algorithm to insert the
index entries at the right places in the document: to insert an
index entry, we have to know what LyX environment (Section 5.1) we
are in. In essence, this means we have to parse the LyX document.
Since the \ layout commands in the LyX file do NOT have what we
would call "closing tags" in other markup languages, we cannot
tell awk "if you are between the start and the end of the
Paragraph environment, do the following", or anything like that -
there is no easy way to find the "end " of an environment, given
all the environment nestings that are possible. Luckily, another
easy way exists: whenever a \ layout command is encountered, we
are in the environment specified by that \ layout command, so we
only need to set a variable, call it layout, accordingly:
/\\layout SGML/ { layout = "SGML"; print; next }
/\\layout Chapter/ { layout = "Chapter"; print; next }
/\\layout Section/ { layout = "Section"; print; next }
/\\layout Subsection/ { layout = "Subsection"; print; next }
/\\layout Subsubsection/ { layout = "Subsubsection"; print; next }
/\\layout Standard/ { layout = "Standard"; print; next }
...and so on
* Clearly, we should not insert index entries everywhere, e.g. in
the "Code" environment. That's why we check if we are in the
"Standard", "Itemize", "Enumerate", "Quotation", "Description"
environment (warning: the way sedscr works currently, you should
not insert index entries in the "Caption" environment) and, if we
are (and only then), we substiture every word in the indexentry[]
array with the LyX "insert index entry" command:
{
if ( ( layout == "Standard" ||
layout == "Itemize" ||
layout == "Enumerate" ||
layout == "Quotation" ||
layout == "Description" ) && ( inset == 0 ) ) {
for (item in indexentry) {
if (gsub(" " item " "," " item " \n\\begin_inset LatexC
ommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub("^" item " "," " item " \n\\begin_inset L
atexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " item "$"," " item "\n\\begin_inset La
texCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " item ":"," " item ":\n\\begin_inset L
atexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " item "\\."," " item ".\n\\begin_inset
LatexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " item ","," " item ",\n\\begin_inset L
atexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " item "\\?"," " item "?\n\\begin_inset
LatexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " item ";"," " item ";\n\\begin_inset L
atexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " item "\n"," " item "\n\n\\begin_inset
LatexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { continue }
else if (gsub(" " "\"" item "\""," " "\"" item "\"\n\\b
egin_inset LatexCommand \\index{" indexentry[item] "}\n\n\\end_inset \n")) { co
ntinue }
}
{ print; next }
}
}
Some tips regarding the (necessary) manual editing of the words file,
the file output by awkscr_create_index_items above:
* Leave the semicolons at the end of each line untouched! They are
needed as record separators in the awk scripts.
* You will see a lot of words (or their declinations) that are not
useful. It is one thing to have a lot of words and another to have
a set of really useful words and phrases. That's the price we pay
for the simplicity of our method.
* You may need to supply some extra terms you feel are missing from
that file. Feel free to do this, awkscr_insert_index_items does
not know how you created the indexitems file you give it.
* Keep backups of your word lists from subsequent runs of the
scripts. Combine word lists from other projects. No matter how
long your word list, only the terms that really appear somewhere,
will make it to the Index, so don't worry if your list is too long
- given enough computing time, that is.
* Take care to delete everything in your word list that looks like a
regular expression with metacharacters - because it will be
interpreted as such, with unpredictable results (unless you really
know what you are doing). I once had ".*" on one line and I forgot
to delete it. I then wondered how come that my document was full
of index entries to ".*" while the text was almost gone! See
regular expressions, for a brief introduction to regular
expressions.
* Take out any ":", ";", "?" from the end of the words, as well as
enclosing double quotes. Those characters are already taken care
of when it comes to inserting the entries, i.e. the indexentries
file should contain only the "pure" words, without any punctuation
signs.
* Don't leave in "config" if your LyX file contains "config.php". If
you do, the latter will look ugly in the LyX editor, as it will
contain an index entry for "config" just in the middle of it. This
will not affect the rendered formats, however.
* Don't leave in words that might form parts of a LyX command. I
once left "Enumerate" in my word list. The resulting LyX file
contained an index entry for "Enumerate" in front of every item in
every enumeration list! Clearly, the awk script
awkscr_insert_index_items "sees" the LyX commands in the file that
are invisible to you. This bug has been fixed in the current
version of the script, but there maybe others lurking around.
Finally, there are a few known limitations of the collateindex script
that creates the index (see Automatic Indexing with the DocBook DSSSL
Stylesheets:
* Duplicate page numbers are not suppressed in the index. If the
document contains three indexing hits on page 4, the generated
index will contain 4, 4, 4.
* Ranges are not automatically constructed. If the document contains
indexing hits on pages 4, 5, 6, and 7, the generated index will
contain 4, 5, 6, 7 instead of 4-7.
_________________________________________________________________
5.21. The final step: invoking lyxtox
If you have followed all the above, your working directory should now
contain:
awkscr_create_index_items
awkscr_insert_index_items
awkscr_math
awkscr_refdb_html
awkscr_refdb_print
ck-style.css
images
jadetex.cfg
lyxtox
lyxtox-html.dsl
lyxtox-onehtml.dsl
lyxtox-print.dsl
lyxtox-print-howto.dsl
lyxtox-print-pdf.dsl
lyxtox-print-ps.dsl
lyxtox-print-rtf.dsl
lyxtox-print-txt.dsl
sedscr
sedscr_abi
sedscr_app
sedscr_bib
sedscr_delete_index_items
sedscr_list_index_items
sedscr_math
sedscr_ris
sedscr_top
sedscr_val
Now, to create all the other formats from your LyX source, you just
call lyxtox with one argument: the name of your . lyx file without the
. lyx ending:
lyxtox myTemplate
It's time for a cup of coffee now. Relax while your computer is busy
creating a whole bunch of nice formatted documents. [icon_cool.png]
For a detailed explanation of what is going behind the scenes, see
Chapter 7.
Now, let's see a more realistic example: the creation of the GNU/Linux
Command-Line Tools Summary HowTo. This HowTo is an attempt to provide
a comprehensive summary of useful command-line tools available to a
GNU/Linux based operating system, i.e. commands needed by the majority
of users. The document is authored by Gareth Anderson and I assist him
in the document conversion process. So, how do I go about such a
project?
Here's how[7]:
My home directory is /home/chris. This is not my working directory for
a lyxtox project. A working directory is, say, myLinuxCommands,
beneath my home directory. That is, I create a working directory
specific to a project. In our case, let's say this is
/home/chris/myLinuxCommands.
Now, I change to the working directory and make sure I have all files
mentioned above. These are at least
awkscr_create_index_items
awkscr_insert_index_items
awkscr_math
awkscr_refdb_html
awkscr_refdb_print
ck-style.css
images
jadetex.cfg
lyxtox
lyxtox-html.dsl
lyxtox-onehtml.dsl
lyxtox-print.dsl
lyxtox-print-howto.dsl
lyxtox-print-pdf.dsl
lyxtox-print-ps.dsl
lyxtox-print-rtf.dsl
lyxtox-print-txt.dsl
sedscr
sedscr_abi
sedscr_app
sedscr_bib
sedscr_delete_index_items
sedscr_list_index_items
sedscr_math
sedscr_ris
sedscr_top
sedscr_val
sedscr_ima
sedscr_apa
and may well have forgotten others (please tell me if I have). I copy
these files from yet another directory in my home, where I have
extracted a pristine copy of mySGML.tar.gz.
So now I have created the files
/home/chris/myLinuxCommands/awkscr_create_index_items
/home/chris/myLinuxCommands/awkscr_insert_index_items
/home/chris/myLinuxCommands/awkscr_math
/home/chris/myLinuxCommands/awkscr_refdb_html
/home/chris/myLinuxCommands/awkscr_refdb_print
/home/chris/myLinuxCommands/ck-style.css
/home/chris/myLinuxCommands/images
/home/chris/myLinuxCommands/jadetex.cfg
/home/chris/myLinuxCommands/lyxtox
/home/chris/myLinuxCommands/lyxtox-html.dsl
/home/chris/myLinuxCommands/lyxtox-onehtml.dsl
/home/chris/myLinuxCommands/lyxtox-print.dsl
/home/chris/myLinuxCommands/lyxtox-print-howto.dsl
/home/chris/myLinuxCommands/lyxtox-print-pdf.dsl
/home/chris/myLinuxCommands/lyxtox-print-ps.dsl
/home/chris/myLinuxCommands/lyxtox-print-rtf.dsl
/home/chris/myLinuxCommands/lyxtox-print-txt.dsl
/home/chris/myLinuxCommands/sedscr
/home/chris/myLinuxCommands/sedscr_abi
/home/chris/myLinuxCommands/sedscr_app
/home/chris/myLinuxCommands/sedscr_bib
/home/chris/myLinuxCommands/sedscr_delete_index_items
/home/chris/myLinuxCommands/sedscr_list_index_items
/home/chris/myLinuxCommands/sedscr_math
/home/chris/myLinuxCommands/sedscr_ris
/home/chris/myLinuxCommands/sedscr_top
/home/chris/myLinuxCommands/sedscr_val
/home/chris/myLinuxCommands/sedscr_ima
/home/chris/myLinuxCommands/sedscr_apa
as exact copies of the original ones (which are, as I said, in some
other directory).
Now, in the /home/chris/myLinuxCommands directory, I create (or copy)
the LyX file that I want to process. In our case, this is the
gnu-linux-tools-summary.lyx file, together with bibliography.lyx and
appendix.lyx. In other cases, the bibliography.lyx and appendix.lyx
are not needed, so they are not there.
I change to the /home/chris/myLinuxCommands directory, which, as I
said, is the working directory for the specific project in our
example. Since my LyX file is gnu-linux-tools-summary.lyx, I call
lyxtox with the basename of gnu-linux-tools-summary.lyx, i.e. with
"gnu-linux-tools-summary", as its first and only parameter:
lyxtox gnu-linux-tools-summary
The name of the parameter is $1 in the lyxtox script.
(Of cource, I have taken care to adjust all parameters at the start of
lyxtox to my situation, as described in Chapter 4).
If all goes well, I get another directory inside my working directory,
named exactly as the parameter of the script, in our case
gnu-linux-tools-summary. Everything I need is there: the one, big HTML
file, the many HTML files ("chunks"), the PDF, PS.GZ, TXT files, the
images directory, the math directory...simply everything. I can just
tar the whole directory, upload it to my web site, extract it and I
will have the whole project there!
Indeed, it is here:
http://www.karakas-online.de/gnu-linux-tools-summary/.
[icon_smile.png]
Thus http://www.karakas-online.de/gnu-linux-tools-summary is an exact
copy of my local /home/chris/myLinuxCommands/gnu-linux-tools-summary,
as created by the lyxtox invocation
lyxtox gnu-linux-tools-summary
Note
Notice that you are supposed to have an "images" directory inside your
working directory. Mine is /home/chris/myLinuxCommands/images. When
you run lyxtox with "gnu-linux-tools-summary" as parameter, you get
another one:
/home/chris/myLinuxCommands/gnu-linux-tools-summary/images. This is
perfectly OK: it is a copy of the original images directory. It is
done this way, so that you only need to copy the
gnu-linux-tools-summary to your website and be up and running without
needing anything else.
_________________________________________________________________
Chapter 6. Errors and warnings
There will be some errors and warnings. However, many of them are not
crucial (or even avoidable) and can be safely ignored. Some day, in a
perfect world, where all involved programs and languages will work
perfectly with each other, these errors will disappear. Until then,
you must learn to live with them.
Here are some examples of possible errors:
_________________________________________________________________
6.1. LyX errors
text class not available:
If you get:
The document uses an unknown textclass "docbook-book". LyX wil not be able to f
ormat output correctly
do "Layout-->Document" on any LyX document you have and then,
in the window that will appear, check the classes available
under "Class". You should see all the above classes you listed,
especially the "DocBook book (SGML)" class I use. You should
see something like:
+checking for docbook class docbook-algo... yes
+checking for docbook class docbook-book... yes
+checking for docbook class docbook-chapter... yes
+checking for docbook class docbook... yes
+checking for docbook class docbook-section... yes
If not, then somehow the reconfigure command above (see Section
4.1) did not find all your classes.
_________________________________________________________________
6.2. Openjade errors
DTDDECL catalog entries are not supported:
Jade does not support the DTDDECL catalog directive and it
complains loudly if it encounters one. You may safely ignore
this warning. See here for more details.
xref to ANCHOR unsupported:
This seems to be a Jade/Docbook problem and not a LyX one. LyX
is capable of inserting cross-references to arbitrary positions
in a text. For this purpose, it creates an anchor with the id
tag aproppriately set in the SGML file:
The cross-reference itself is placed with the xref element:
The error means that this mechanism of cross-referencing is
unsupported. This is why I change
to
with sed (see Section 4.10). This way, at least
cross-references to sections created by LyX will work in SGML.
value of attribute "LINKEND" must be a single token:
the label you used for a section contains spaces. Change spaces
to, say, underscores or dashes.
value of attribute "ID" must be a single token:
you used a cross-reference to a label that contains spaces. Do
not change the cross-reference. Change the label: change spaces
to, say, underscores or dashes.
end tag for "SECT3" which is not finished:
You probably have an empty subsubsection, e.g. you just
outlined your documents and some subsubsections have a title
but no content (yet). I consider this warning to be a bug. Or
is it a feature???
end tag for element "LISTITEM" which is not open:
this may be a bug of LyX' SGML generation. It happens when in
an itemize environment you use a higher depth, possibly with
nested item lists and subsequent paragraphs that you want to be
on the same identation level as the outer item. Not critical.
"keep-with-next:" is not a valid keyword in a make expression for flow
object class "paragraph":
Didn't track it down, but seems harmless.
value of attribute "FORMAT" cannot be "PDF":
Openjade tell us:
must be one of "BMP", "CGM-CHAR", "CGM-BINARY", "CGM-CLEAR",
"DITROFF", "DVI", "EPS", "EQN", "FAX", "GIF", "GIF87A", "GIF89A",
"JPG", "JPEG", "IGES", "PCX", "PIC", "PNG", "PS", "SGML", "TBL",
"TEX", "TIFF", "WMF", "WPG", "LINESPECIFIC"
this means that the list of accepted formats does not contain
"PDF". Such a list appears in the following files:
+ /usr/share/sgml/db3xml/dbnotnx.mod
+ /usr/share/sgml/docbk30/docbook.dtd
+ /usr/share/sgml/docbook_3/dbnotn.mod
+ /usr/share/sgml/sdb/sdocbook.dtd
+ /usr/share/sgml/db41xml/dbnotnx.mod
+ /usr/share/sgml/docbook_4/dbnotn.mod
Given that LyX produces a SGML file containing
If you still use LyX v.1.1.x, you should change
/usr/share/sgml/docbook_3/dbnotn.mod to include "PDF" in the
list of accepted file extensions:
Also, in the dbparam.dsl file for the print formats (located in
/usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/print/db
param.dsl on my system), zou would need to add "pdf" to the
list of allowed graphic extensions:
(define %graphic-extensions%
;; REFENTRY graphic-extensions
;; PURP List of graphic filename extensions
;; DESC
;; The list of extensions which may appear on a 'fileref'
;; on a 'Graphic' which are indicative of graphic formats.
;;
;; Filenames that end in one of these extensions will not have
;; the '%graphic-default-extension%' added to them.
;; /DESC
;; AUTHOR N/A
;; /REFENTRY
'("eps" "epsf" "gif" "tif" "tiff" "jpg" "jpeg" "png" "pdf" "tex"))
However, this is not necessary, since we use the technique of "
customization layers" (see Section 7.1.5) and define
%graphic-extensions% in lyxtox-print.dsl as shown above. Due to
the nature of the DSSSL language (which bears similarities to
Scheme), our change takes precedence over the definition in the
standard files and we don't need to change standard code.
Reference `4' on page 1 undefined on input line 180:
Some cross-refernce you use is probably misspelled. But this is
somewhat difficult to achieve with LyX, since LyX provides you
with a list of all the labels currently available for
cross-referencing. The other occasion where you will see this
error is in the first (or even second?) invocation of LaTeX for
a particular format. You need at least 3 LaTeX passes for the
table of contents and the cross-references to be worked out and
if you are currently on the first pass, you will see this error
for every cross-reference.
LaTeX_Font_Warning: Some font shapes were not available, defaults subs
tituted:
If you installed the Computern Modern fonts, you probably don't
need to worry about this error. If you check the fonts used in
the PDF file (File-->Documet Info-->Fonts-->List all fonts),
you will probably find out that only some seldomly used
characters were not rendered with CM fonts. That's O.K. for me.
Overfull \hbox (30.17416pt too wide) in paragraph at lines 5425--5425:
You will get dozens of this. It is a typical LaTeX warning
informing you that a line got some points too wide (mostly
because there was some word that LaTeX could not hyphenate).
Read the LaTeX documentation for this (but only if you want to
produce a really perfect PDF document).
/usr/share/sgml/stylesheets/sgmltools/print.dsl:53:6:E: 3rd argument f
or primitive "string-append" of wrong type: "#f" not a string:
This is probably caused because %graphic-default-extension% is
set to "false" ("#f"), while in lyxtox-print.dsl we try to
concatenate the %admon-graphics-path%, the name of the
admonition and %graphic-default-extension% to a full name of
the admonition graphic. It is harmless, due to the way we use
the graphics (see Section 7.2.2).
Warning: Version of thumbpdf.tex' does not match with perl script!:
thumbpdf complains even if the version is a newer one:
*** make `thumbpdf.pdf' / run pdfTeX ***
!!! Warning: Version of `thumbpdf.tex' does not match with perl script!
Current `thumbpdf.tex': 2002/05/26 v3.2
Please install version: 2001/01/12 v2.8
But if you have the newest version, as in the above case, there
is no need to worry about this error.
end tag for "SECT1" which is not finished:
You may see this openjade error also for "SECT2", "SECT3" and
so forth. This may come up if you have written just the title
of the section, subsection or subsubsection respectively, but
you did not enter any text there. Just enter something, even a
single word like "FIXME" (author's note to himself: this is a
literal FIXME, not a meta-FIXME!), to remind you of the missing
text, and the error should go away.
document type does not allow element "SECT2" here:
This is a similar error to the previous one. You most probably
created a subsection which is not contained in a section, but
is dircetly contained in a chapter. Similar errors will occur
if you ommit environment levels that are "in between" the
current one and its parent.
length of name token must not exceed NAMELEN (44):
You have an ID on the line where this error comes up - and this
ID is too long, longer than NAMELEN, which is 44 in my case.
Use a shorter ID. What in SGL comes as the ID of a chapter,
section, figure or table, in LyX it is a label. Thus you should
check your labels and make sure they are not longer than 44
characters.
Alternatively, change the value of NAMELEN in the file pointed
to by the SGMDCL directive in your catalog files: The lyxtox
script uses, among others, the following catalog:
/usr/share/sgml/CATALOG.docbook-dsssl-stylesheets. You can see
this in the line:
SGML_CATALOG_FILES="$SGML_CATALOG_FILES: /usr/share/sgml/CATALOG.docbook-dsssl-
stylesheets"
In this catalog, I have changed the SGMLDECL line from:
-- SGMLDECL "dtds/decls/docbook.dcl" --
to
SGMLDECL "/usr/share/sgml/docbook/docbook-dsssl-stylesheets/dtds/decls/docbook.
dcl"
to reflect the correct path to the DocBook declaration file in
my system. You must thus change the value of the NAMELEN
variable in the file where the SGMLDECL points to, i.e.[8]
docbook/docbook-dsssl-stylesheets/dtds/decls/docbook.dcl.
There, change
QUANTITY SGMLREF
ATTCNT 256
GRPCNT 253
GRPGTCNT 253
LITLEN 8092
NAMELEN 44
TAGLVL 100
to, for example:
QUANTITY SGMLREF
ATTCNT 256
GRPCNT 253
GRPGTCNT 253
LITLEN 8092
NAMELEN 64
TAGLVL 100
See the error
'character "_" is_not allowed in the value of attribute "ID"'
below for more changes you might need to make in the DocBook
declaration file.
character ":" is_not allowed in the value of attribute "ID":
You have a LyX label that contains ":". Delete the ":" , as the
label of a chapter, section, figure, table etc. is going to be
the ID of that element and ":" is not allowed in IDs. However,
this only the short answer. For an in-depth explanation, see
the next item.
character "_" is_not allowed in the value of attribute "ID":
You have a LyX label that contains "_". Delete the "_" , as the
label of a chapter, section, figure, table etc. is going to be
the ID of that element and "_" is not allowed in IDs. However,
as said in the previous item, this is only the tip of the
iceberg. A tip of the hat to Tony Graham for the following
detailed information in Allowed characters in element id's!
The characters allowed in an ID are those allowed in an SGML
"NAME". The characters that are allowed to appear in "names" in
SGML (the id attribute is defined in SGML as such a "NAME") are
set in what is known as the " SGML declarationSGML declaration"
of your document. By default, the first character must be a
letter, and any other characters may be a letter or a digit.
You can add to this by specifying the additional characters in
your SGML Declaration (and you can't take any characters away).
The convention in widest use is that of the "Reference concrete
syntax" included in the SGML standard itself that adds "." and
"-" as "name" characters (but not as "name start" characters).
This is what's used in the DocBook SGML Declaration,
docbook.dcl.
The specific portion of the SGML Declaration of interest here
is the "naming rules". Jade's default inferred SGML Declaration
uses the same naming rules as SGML's "Reference Concrete
Syntax". To allow underscores in entity names (and other SGML
names), you need to supply an SGML Declaration that includes
the underscore character. Using the DocBook SGML Declaration as
an example, you need to add "_" to the LCNMSTRT and UCNMSTRT
parameters:
NAMING
LCNMSTRT ""
UCNMSTRT ""
LCNMCHAR ".-"
UCNMCHAR ".-"
NAMECASE
GENERAL YES
ENTITY NO
The NAMING portion specifies both uppercase and lowercase forms
of the additional "name start" and "name" characters (since
names are folded to uppercase when the "GENERAL" parameter has
the value YES"). You need to add it in two places because you
are declaring the uppercase and lowercase forms, which just
happen to be the same.
You can reference your SGML Declaration by including it in the
Jade command line before the filename for your SGML file (or
before your DTD if also including the DTD filename in the
command line). You can also reference an SGML Declaration to
infer by using the "SGMLDECL" keyword in your catalog file.
(See "charset.htm" from the nsgmls distribution for more
information on the catalog format. FIXME: URL!)
Now, what does all that mean for our specific situation?
The lyxtox script uses, among others, the following catalog:
/usr/share/sgml/CATALOG.docbook-dsssl-stylesheets. You can see
this in the line:
SGML_CATALOG_FILES="$SGML_CATALOG_FILES: /usr/share/sgml/CATALOG.docbook-dsssl-
stylesheets"
In this catalog, change the SGMLDECL line from:
-- SGMLDECL "dtds/decls/docbook.dcl" --
to
SGMLDECL "/usr/share/sgml/docbook/docbook-dsssl-stylesheets/dtds/decls/docbook.
dcl"
Note that we have taken away the comments and corrected the
path to the declaration.
But that's NOT enough!
You must also change the file where the SGMLDECL points to,
i.e.[9]
docbook/docbook-dsssl-stylesheets/dtds/decls/docbook.dcl.
There, change
NAMING
LCNMSTRT ""
UCNMSTRT ""
LCNMCHAR ".-"
UCNMCHAR ".-"
NAMECASE
GENERAL YES
ENTITY NO
to:
NAMING
LCNMSTRT ""
UCNMSTRT ""
LCNMCHAR ".-_"
UCNMCHAR ".-_"
NAMECASE
GENERAL YES
ENTITY NO
i.e. add the underscore to LCNMCHAR and UCNMCHAR.
This solves the problem at its root! See also character "_" not
allowed in value of attribute ID.
general_entity_"d_op"_not_defined_and_no_default_entity:
When you enter an URL in LyX, you are asked to enter the URL
and the Name of the link in a window that pops up. Whatever you
enter in the URL field, will be automatically taken care by
LyX: if it contains special characters, like ampersands, they
are replaced with their SGML equivalent (see SGML entities).
But whatever you enter in the Name field, it will passed "as
is" to SGML. If you feel lazy and just copy the URL in the Name
field, you must take care to replace special characters with
their SGML entities yourself. Dynamic URLs are a classic
example and are going to flood you with this error, if you do
not do your homework. For example, if you feel you have to
write something like
http://www.karakas-online.de/forum/viewtopic.php?t=14&f=3
instead of
Welcome to the Linux Forum of Chris
then you should write it as
http://www.karakas-online.de/forum/viewtopic.php?t=14&f=3
i.e. replace "&" with its SGML entity "&".
element "BODY" undefined:
BODY? Which body? You don't remember to have entered anything
like this in you text? Well, check for "" somewhere in
the text (not the code environments, as those have been taken
care already by LyX). You have to replace the "<" and ">" with
their SGML entities "<" and ">" respectively. When you
correct it, the other two errors
end tag for "BODY" omitted, but OMITTAG NO was specified
start tag was here
will disappear too, since they are just follow-ups of the first
one.
character data is not allowed here:
This simply means that you did not replace some special
character with its SGML entity. Have a look at the tables in
SGML entities, try to guess which character is meant in the
error (the SGML lines produced by LyX can become longer than
Proust's), and replace it.
But the reason for this error may also lie in the fact that you
forgot to change the LyX environment (see Section 5.1) from
SGML to Standard and the text contains some special characters,
like dashes. In this case, the text is interpreted in the SGML
context and the special characters give rise to
misunderstandings and errors in th parser. Just change the
environment from SGML back to Standard (or whatever else it
should be) and the error will disappear.
document type does not allow element "MEDIAOBJECT" here:
This error happens because sed (more precisely, the sed
commands in sedscr) did not manage to change the SGML that LyX
produced for a figure. The reason sedscr failed lies probably
in some strange arrangement of the starting SGML tags for the
figure. The best cure is to enter a "forced new line" by
pressing Strg+Enter at the end of the line that precedes the
offending figure. This will force the whole SGML code to start
on a new line and will make identification by sedscr easier.
The next time you run lyxtox, the correct SGML commands for the
figure will be generated and the error will disappear.
an attribute value must be a literal unless it contains only name char
acters:
How on earth could this happen? Well, if you are like me and
always try new possibilities with LyX and SGML, then you will
encounter this error if you enter an URL while in the SGML
environment. There, of course, you cannot just use LyX' menu
Insert->URL - you have to write the SGML code for an URL
<ulink url="http://www.somesite.com">. Now, if you forget
to enclose the URL (the " attribute value", as the error says,
of the "url" attribute in the ulink element) in double quotes,
then you will get that error.
document type does not allow element (after in a table)
:
You shouldn't get this error when you use the scripts desribed
here - simply because the sedscr_tidy2 script takes care that
it does not occur. However, if you do get it, it is nice to
know why:
Due to the way the SGML parser works, the following piece of
code describing an informal table will produce a " document
type does not allow element " error:
EAN
9783898112338
The reason is the so-called "Pernicious Mixed Content Problem".
From the Definitive Guide to DocBook on the element:
The content model of the Entry element exhibits a nasty peculiarity
that we call pernicious mixed content.[18]
Every other element in DocBook contains either block elements or
inline elements (including #PCDATA) unambiguously. In these cases,
the meaning of line breaks and spaces are well understood; they are
insignificant between block elements and significant (to the SGML
parser, anyway) where inline markup can occur.
Table entries are different; they can contain either block or
inline elements, but not both at the same time. In other words, one
Entry in a table might contain a paragraph or a list while another
contains simply #PCDATA or another inline markup, but no single
Entry can contain both.
Because the content model of an Entry allows both kinds of markup,
each time the SGML parser encounters an Entry, it has to decide
what variety of markup it contains. SGML parsers are forbidden to
use more than a single token of lookahead to reach this decision.
In practical terms, what this means is that a line feed or space
after an Entry start tag causes the parser to decide that the cell
contains inline markup. Subsequent discovery of a paragraph or
another block element causes a parsing error.
All of these are legal:
3.1415927General #PCDATA
A paragraph of text
However, each of these is an error:
Error, cannot have a line break before a block element
A paragraph of text.
A paragraph of text.
Error, cannot have a line break between block elements
A paragraph of text.
A paragraph of text.
Error, cannot have a line break after a block element
Thus, the informal table example above must be corrected to:
EAN
9783898112338
This is done in lyxtox with a call to runsed using sedscr_tidy2
as the sed script. See also Openjade error: not allowed
after .
_________________________________________________________________
6.3. TeX errors
The material in this section (up to Section 6.3.1) is taken from the
TeX FAQ item on How to approach errors.
Since TeX is a macroprocessor, its error messages are often difficult
to understand; this is a (seemingly invariant) property of
macroprocessors. Knuth makes light of the problem in the TeXbook,
suggesting that you acquire the sleuthing skills of a latter-day
Sherlock Holmes; while this approach has a certain romantic charm to
it, it's not good for the 'production' user of (La)TeX. The following
(derived, in part, from an article by Sebastian Rahtz in TUGboat
16(4)) offers some general guidance in dealing with TeX error reports,
and other answers in this section deal with common (but perplexing)
errors that you may encounter. There's a long list of "hints" in
Sebastian's article, including the following:
* Look at TeX errors; those messages may seem cryptic at first, but
they often contain a straightforward clue to the problem. See
Section 6.3.1 for further details.
* Read the .log file; it contains hints to things you may not
understand, often things that have not even presented as error
messages.
* Be aware of the amount of context that TeX gives you. The error
messages gives you some bits of TeX code (or of the document
itself), that show where the error "actually happened"; it's
possible to control how much of this 'context' TeX actually gives
you. LaTeX (nowadays) instructs TeX only to give you one line of
context, but you may tell it otherwise by saying
\setcounter{errorcontextlines}{999}
in the preamble of your document. (If you're not a confident macro
programmer, don't be ashamed of cutting that 999 down a bit; some
errors will go on and on, and spotting the differences between
those lines can be a significant challenge.)
* As a last resort, tracing can be a useful tool; reading a full
(La)TeX trace takes a strong constitution, but once you know how,
the trace can lead you quickly to the source of a problem. You
need to have read the TeXbook (see books about TeX) in some
detail, fully to understand the trace.
The command
\tracingall
sets up maximum tracing. it also sets the output to come to the
interactive terminal, which is somewhat of a mixed blessing (since
the output tends to be so vast - all but the simplest traces are
best examined in a text editor after the event).
The LaTeX trace package (first distributed with the 2001 release
of LaTeX) provides more manageable tracing. Its \ traceon command
gives you what \tracingall offers, but suppresses tracing around
some of the truly verbose parts of LaTeX itself. The package also
provides a \traceoff command (there's no "off" command for
\tracingall), and a package option (logonly) allows you to
suppress output to the terminal.
The best advice to those faced with TeX errors is not to panic: most
of the common errors are plain to the eye when you go back to the
source line that TeX tells you of. If that approach doesn't work, the
remaining answers in this section deal with some of the most common
error messages you may encounter using LyX and a TeX system provided
by a common Linux distribution as your starting point. For more on TeX
errors, consult the "Joy of TeX errors" section of the TeX FAQ. You
should not ordinarily need to appeal to the wider public for
assistance (see TeX mailing lists), but if you do, be sure to report
full backtraces (see errorcontextlines above) and so on.
_________________________________________________________________
6.3.1. The structure of TeX errors
The material in this section is taken from the structure of TeX
errors.
TeX's error messages are reminiscent of the time when TeX itself was
conceived (the 1970s): they're not terribly user-friendly, though they
do contain all the information that TeX can offer, usually in a pretty
concise way.
TeX's error reports all have the same structure:
* An error message
* Some 'context'
* An error prompt
The error message will relate to the TeX condition that is causing a
problem. Sadly, in the case of complex macro packages such as LaTeX,
the underlying TeX problem may be superficially difficult to relate to
the actual problem in the "higher-level" macros. Many LaTeX-detected
problems manifest themselves as 'generic' errors, with error text
provided by LaTeX itself (or by a LaTeX class or package).
The context of the error is a stylised representation of what TeX was
doing at the point that it detected the error. As noted in approaching
errors, a macro package can tell TeX how much context to display, and
the user may need to undo what the package has done. Each line of
context is split at the point of the error; if the error actually
occurred in a macro called from the present line, the break is at the
point of the call. (If the called object is defined with arguments,
the "point of call" is after all the arguments have been scanned.) For
example:
\blah and so on
produces the error report
! Undefined control sequence.
l.4 \blah
and so on
while:
\newcommand{\blah}[1]{\bleah #1}
\blah{to you}, folks
produces the error report
! Undefined control sequence.
\blah #1->\bleah
#1
l.5 \blah{to you}
, folks
If the argument itself is in error, we will see things such as
\newcommand{\blah}[1]{#1 to you}
\blah{\bleah}, folks
producing
! Undefined control sequence.
\bleah
l.5 \blah{\bleah}
, folks
The prompt accepts single-character commands: the list of what's
available may be had by typing ?. One immediately valuable command is
h, which gives you an expansion of TeXs original prcis message,
sometimes accompanied by a hint on what to do to work round the
problem in the short term. If you simply type 'return' (or whatever
else your system uses to signal the end of a line) at the prompt, TeX
will attempt to carry on (often with rather little success).
_________________________________________________________________
6.3.2. LaTeX errors
LaTeX output can be very verbose. Just for your reference, here is a
(rather long) example of output (taken from the .log file that is
created each time anew from every program involved in the process that
uses TeX in the background)[10]:
This is TeX, Version 3.14159 (Web2C 7.3.1) (format=jadetex 2001.10.25) 7 JAN 2
004 07:26
**EN-Book.tex
(EN-Book.tex
JadeTeX 2001/07/19: 3.11
LaTeX Font Info: Try loading font information for T1+ptm on input line 1.
(/usr/share/texmf/tex/latex/psnfss/t1ptm.fd
File: t1ptm.fd 2000/01/12 PSNFSS-v8.1 font definitions for T1/ptm.
)
(jadetex.cfg (/usr/share/texmf/tex/generic/babel/babel.sty
Package: babel 2001/03/01 v3.7h The Babel package
(/usr/share/texmf/tex/generic/babel/english.ldf
Language: english 2001/02/07 v3.3k English support from the babel system
(/usr/share/texmf/tex/generic/babel/babel.def
File: babel.def 2001/03/01 v3.7h Babel common definitions
\babel@savecnt=\count114
\U@D=\dimen131
)
\l@canadian = a dialect from \language\l@english
))
(/usr/share/texmf/tex/generic/thumbpdf/thumbpdf.sty
Package: thumbpdf 2001/04/02 v2.10 Inclusion of thumbnails (HO)
Package thumbpdf Warning: You need pdfTeX in PDF mode for driver `pdftex'.
) (/usr/share/texmf/tex/latex/ae/ae.sty
Package: ae 1998/11/17 1.0 Almost European Computer Modern
(/usr/share/texmf/tex/latex/base/fontenc.sty
Package: fontenc 2000/08/30 v1.91 Standard LaTeX pac
kage
(/usr/share/texmf/tex/latex/base/t1enc.def
File: t1enc.def 2000/08/30 v1.91 Standard LaTeX file
LaTeX Font Info: Redeclaring font encoding T1 on input line 38.
)
LaTeX Font Info: Try loading font information for T1+aer on input line 96.
(/usr/share/texmf/tex/latex/ae/t1aer.fd
File: t1aer.fd 1997/11/16 Font definitions for T1/aer.
)))
(/usr/share/texmf/tex/latex/ae/aecompl.sty
Package: aecompl 1998/07/23 0.9 T1 Complements for AE fonts (D. Roegel)
)
Package hyperref Info: Option `plainpages' set `false' on input line 128.
Package hyperref Info: Option `colorlinks' set `true' on input line 128.
Package hyperref Info: Option `bookmarksopen' set `true' on input line 128.
Package hyperref Info: Option `colorlinks' set `true' on input line 128.
Package hyperref Info: Option `breaklinks' set `true' on input line 128.
Package hyperref Warning: Option `pagebackref' has already been used,
(hyperref) setting the option has no effect on input line 128.
)
Elements will be labelled
Jade begin document sequence at 19
As you can see from the last line, Jade just started its work.
[icon_smile.png]
It goes on with font checking as follows:
(EN-Book.aux)
\openout1 = `EN-Book.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for T2A/cmr/m/n on input line 19.
LaTeX Font Info: Try loading font information for T2A+cmr on input line 19.
(/usr/share/texmf/tex/latex/cyrillic/t2acmr.fd
File: t2acmr.fd 1999/01/07 v1.0 Computer Modern Cyrillic font definitions
)
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 19.
LaTeX Font Info: Try loading font information for TS1+cmr on input line 19.
(/usr/share/texmf/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 1999/05/25 v2.5h Standard LaTeX font
definitions
)
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LECO/omseco/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LECX/omsecx/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LECY/omsecy/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LEGR/omsegr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LEHA/omseha/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LEIP/omseip/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LELA/omsela/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for LETI/omseti/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
Package hyperref Info: Link coloring ON on input line 19.
(/usr/share/texmf/tex/latex/hyperref/nameref.sty
Package: nameref 2000/05/08 v2.18 Cross-referencing by name of section
\c@section@level=\count115
)
LaTeX Info: Redefining \ref on input line 19.
LaTeX Info: Redefining \pageref on input line 19.
LaTeX Font Info: Try loading font information for T1+aess on input line 99.
(/usr/share/texmf/tex/latex/ae/t1aess.fd
File: t1aess.fd 1997/11/16 Font definitions for T1/aess.
) [1.0.37]
File: logo1.eps Graphic file (type eps)
File: logo2.eps Graphic file (type eps)
Overfull \hbox (2655.0092pt too wide) in alignment at lines 610--899
Somewhere from this point on, you will start seeing LaTeX processing
the pages of your document one after the other - and outputting errors
and warnings like the " Overfull \hbox" above.
There are some fairly common error messages and warnings. I'll cover
those here using material from the chapter on " LyX and LaTeX errors"
of the Extended Features manual for LyX, available from LyX' Help
menu. You should look at a good LaTeX book for a complete listing.
* " LaTeX Warning:"
Anything beginning with these word is a warning message for the
purpose of "debugging" the LaTeX code itself. You'll get messages
like this if you added or changed cross-references or bibliography
entries, in which case, LaTeX is trying to tell you that you need
to make another run.
You can by-and-large ignore these.
* " LaTeX Font Warning:"
Another warning message, this time about fonts which LaTeX
couldn't find. The rest of the message will often say something
about a replacement font that LaTeX used.
You can safely ignore these.
* " Overfull \hbox"
LaTeX absolutely loves to spew these out. They are warning you
about lines that were too long and run past the right margin.
Almost always, this is unnoticeable in the final output. Or, only
one or two characters extend past the margin. LaTeX seems to
generate at least one of these messages for just about any
document you write.
You can ignore these stupid messages. Your eyes will tell you if
there's a problem with something that's too wide; just look at the
output.
* " Underfull \hbox"
Not quite as common as its cousin. LaTeX seems to like to print
lines that are a bit too wide as opposed to ones that are a bit
too narrow. We have no idea why.
You can ignore these, too.
* " Overfull \vbox" and " Underfull \vbox"
Warnings about troubles breaking the page. Once again, just look
at the output. Your eyes will tell you where something has gone
wrong.
* " LaTeX Error: File `Xxxx' not found"
The file "Xxxx" isn't installed on this system. This usually
appears because some package your document needs isn't installed.
If you didn't touch the preamble or didn't use the \usepackage{}
command, then one of the packages LyX tried to load is missing.
Use Help->La TeX Configuration, to get a list of packages that LyX
knows about. This file is updated whenever you reconfigure LyX
(using Edit->Reconfigure) and tells you which packages have been
detected and what they do.
If you did use the \usepackage{} command, and the package in
question isn't installed, you'll need to install it yourself.
* " LaTeX Error: Unknown option"
Error messages beginning with this are trying to tell you that you
specified a bad or undefined option to a package. Check the
package's documentation.
* "Undefined control sequence"
If you've inserted LaTeX code into your document, but made a typo,
you'll get one of these. You may have forgotten to load a package.
In any case, this error message usually means that you used an
undefined command.
* LaTeX Error: Undefined color `rtlred'
Theoretically, you can define your own colours in jadetex.cfg. For
example, the following block of code defines three new colours,
rtlred, rtlblue and rtlgreen (the green being a bit darker than
usual):
\usepackage{color}
\definecolor{rltred}{rgb}{0.75,0,0}
\definecolor{rltgreen}{rgb}{0,0.5,0}
\definecolor{rltblue}{rgb}{0,0,0.75}
However, no matter where I position this code in jadetex.cfg (i.e.
either before or after the call to hypersetup), I get the above
error. For the time being, my remedy is to stick to the standard
colours. Please inform me if you find a better solution.
Andreas Ekenbäck (private communication) has found that by having
double declarations of a colour:
\newcmykcolor{abstractYellow}{0.02 0.02 0.35 0.0}
\definecolor{abstractYellow}{cmyk}{0.02,0.02,0.35,0.0}
in jadetex.cfg, it works. On his Fedora Core 4 workstation, he
says, it is even enough to have the first declaration.
Further reading: see the chapter on " LyX and LaTeX errors" of the
Extended Features manual for LyX for tips on how to handle LaTeX
errors and warnings.
_________________________________________________________________
6.3.3. TeX capacity exceeded
If you encounter TeX errors, especially
TeX capacity exceeded, sorry [main memory size=384000]
you may have to set in texmf.cnf (usually located in /etc/texmf, or
where the TEXMFCNF environment variable (seeSection 7.1.3) shows):
main_memory = 3839999
main_memory.jadetex = 4999999
hash_extra.jadetex = 25000
pool_size.jadetex = 500000
save_size.jadetex = 15000
save_size = 8000
FYI, here's how much memory TeX used for this document (you may see
such information in the .log file created by pdfjadetex which is
deleted by default in lyxtox):
Here is how much of TeX's memory you used:
4847 strings out of 15997
36267 string characters out of 99016
163640 words of memory out of 384000
15827 multiletter control sequences out of 10000+15000
68666 words of font info for 129 fonts, out of 400000 for 1000
14 hyphenation exceptions out of 1000
31i,12n,40p,1588b,3161s stack positions out of 300i,100n,500p,50000b,8000s
See my Jade Odyssey for more details and ideas on this and other
related errors.
_________________________________________________________________
6.3.4. Fatal format file error; I'm stymied
Well...me too. [icon_frown.png]
This what the TeX FAQ says about this error:
(La)TeX applications often fail with this error when you've been
playing with the configuration, or have just installed a new version.
The format file contains the macros that define the system you want to
use: anything from the simplest (Plain TeX) all the way to the most
complicated, such as LaTeX or ConTeXt. From the command you issue, TeX
knows which format you want.
The error message
Fatal format file error; I'm stymied
means that TeX itself can't understand the format you want. Obviously,
this could happen if the format file had got corrupted, but it usually
doesn't. The commonest cause of the message, is that a new binary has
been installed in the system: no two TeX binaries on the same machine
can understand each other's formats. So the new version of TeX you
have just installed, won't understand the format generated by the one
you installed last year.
Resolve the problem by regenerating the format; of course, this
depends on which system you are using. On a teTeX-based system, run
fmtutil --all
or
fmtutil --byfmt=
to build only the format that you are interested in.
I got this error during the PDF processing (Section 7.1.4.7). Since
pdftex is the program that was running at this stage, I tried both
fmtutil --all
or
fmtutil --byfmt=pdftex
but the problem remained.I had NOT upgraded to any new version for any
of the programs involved. What I had done, was to add hundreds of
cross-references (probably more than 500) in just one section (see it
in Credits for version 2.0 of the PHP-Nuke HOWTO).
The solution was to upgrade pdftex from 0.13d to 1.11b (pdfTeX (Web2C
7.5.2) 3.141592-1.11b) and jadetex from 1.3 to 3.13. Note that
upgrading pdftex was not enough, jadetex had to be upgraded too. Of
course, you would still have to use fmtutil as above. After the
upgrades, the error disappeared. As a nice by-product, document
processing seems to be much faster now, although I didn't conduct any
benchmarks.
_________________________________________________________________
6.3.5. Corrupted NFSS tables
(/usr/share/texmf/tex/latex/base/ts1cmr.fd)
! Corrupted NFSS tables.
wrong@fontshape ...message {Corrupted NFSS tables}
error@fontshape else let f...
I got this error after I used the RefDB (Section 3.11, Section 5.19,
Section 7.1.10) DSSSL stylesheet modifications in the local DSSSL
stylesheets (Section 4.2, Section 7.1.5) that control the output.
_________________________________________________________________
6.3.6. Missing $ inserted
You will probably get tons warnings like this one:
! Missing $ inserted.
$
l.17245 ...b/a/bsd/2000/09/06/FreeBSD_Basics.html}
\endNode{}\endSeq{}\endNod...
I've inserted something that you may have forgotten.
(See the above.)
You can see them in the standard output, as well as in the .log file
that is created automatically (if you don't see any .log file, maybe
lyxtox currently deletes it - check the code). They mean that TeX
tried to correct you , because it saw some character that is used in
the mathematics mode and thought you might have forgotten to switch.
So it inserts a $, which toggles math mode. If this is not what you
intended (it will most probably not, if your .tex file is created
through the procedure described here), then your only salvation is to
escape the character that triggered this behaviour. This means that
you may have to escape
* Slashes (/) in URLs, at least when they separate two numbers (not
tested)
* Underscores (_)
* Carets (^)
* and generally everything that may have a math interpretation in
TeX/LaTeX/LyX
FIXME: This needs testing! Till now, I didn't resort to escaping - and
stil things work remarkably well...
_________________________________________________________________
6.3.7. Unprintable characters
Inevitably, sooner or later, you will hit a very nasty problem in
document processing: some characters in your file will be unprintable!
They may appear in the PDF as black boxes (for example [16508.png] ,
in the OT1 font encoding), or simply wrong. Here is what you can do to
solve this problem:
If you are using the OT1 font encoding[11], i.e. if your jadetex.cfg
file contains the line
\usepackage[OT1]{fontenc}
then you have to enter the following characters in math mode:
* [16426.png] (backslash)
* FIXME
If you are using the T1 font encoding, i.e. if your jadetex.cfg file
contains the line
\usepackage[T1]{fontenc}
then you can use the ae and aecompl packages in order to be able to
write almost every european character:
\usepackage{ae,aecompl}
You will not, however, manage to get the two [14090.png] symbols,
[11935.png] , printed correctly. If your purpose was to get the french
quote characters (the "guillemets"), then you could replace the ae and
aecompl packages with the aeguill package, i.e. replace the above line
in jadetex.cfg with:
\usepackage{aeguill}
If your purpose was to get two [10612.png] signs, one after another,
just as if you were describing the effect of the "append" operator in
cat file1 >> file2
then you must enter the [18770.png] in math mode.
Note
Note that the above holds for the standard LyX environment (see
Section 5.1) and probably all other environments where you use the
same font as in the body text. You don't need to worry about
characters in the code environment, probably because programming code
is usually written in the ASCII encoding and LyX uses CDATA in
or environments, where ASCII (or, maybe the
value of the SP_ENCODING environment variable) is the expected input
encoding for Openjade.
For more information on fonts and their encodings, see FIXME.
_________________________________________________________________
6.4. Other errors
6.4.1. Keywords not present in HTML
If you don't see the keywords in the HTML file, then this may be a bug
in your stylesheets. There seems to be a bug in dbcommon.dsl (DocBook
DSSSL stylesheets 1.73) that prevents this from happening for an
article, where the in within . The
definition of "info-element" in dbcommon.dsl contains
((equal? (gi nd) (normalize "article"))
(select-elements (children nd) (normalize "artheader")))
but no reference to "articleinfo".
In dbcommon.dsl, which in my system resides in
/usr/share/sgml/docbook/docbook-dsssl-stylesheets-1.72/common/dbcommon
.dsl and belongs to packet docbook-dsssl-stylesheets-1.72-34, replace
the definition of info-element with:
;; ======================================================================
(define (info-element #!optional (nd (current-node)))
;; Returns the *INFO element for the nd or (empty-node-list) if no
;; such node exists...
(cond
((equal? (gi nd) (normalize "set"))
(select-elements (children nd) (normalize "setinfo")))
((equal? (gi nd) (normalize "book"))
(select-elements (children nd) (normalize "bookinfo")))
((equal? (gi nd) (normalize "section"))
(select-elements (children nd) (normalize "sectioninfo")))
((equal? (gi nd) (normalize "sect1"))
(select-elements (children nd) (normalize "sect1info")))
((equal? (gi nd) (normalize "sect2"))
(select-elements (children nd) (normalize "sect2info")))
((equal? (gi nd) (normalize "sect3"))
(select-elements (children nd) (normalize "sect3info")))
((equal? (gi nd) (normalize "sect4"))
(select-elements (children nd) (normalize "sect4info")))
((equal? (gi nd) (normalize "sect5"))
(select-elements (children nd) (normalize "sect5info")))
((equal? (gi nd) (normalize "refsect1"))
(select-elements (children nd) (normalize "refsect1info")))
((equal? (gi nd) (normalize "refsect2"))
(select-elements (children nd) (normalize "refsect2info")))
((equal? (gi nd) (normalize "refsect3"))
(select-elements (children nd) (normalize "refsect3info")))
((equal? (gi nd) (normalize "refsynopsisdiv"))
(select-elements (children nd) (normalize "refsynopsisdivinfo")))
((equal? (gi nd) (normalize "article"))
;; Changed by root.
;; node-list-filter-by-gi and articleinfo inserted.
;; Otherwise no keywords are created in articles.
(node-list-filter-by-gi (children nd) (list
(normalize "artheader")
(normalize "articleinfo"))))
(else ;; BIBLIODIV, GLOSSDIV, INDEXDIV, PARTINTRO, SIMPLESECT
(select-elements (children nd) (normalize "docinfo")))))
;; ======================================================================
_________________________________________________________________
6.4.2. thumbpdf fails
Perhaps the most accurate indicator of a serious error in your
document or settings is the failing of thumbpdf:
THUMBPDF 2.8, 2001/01/12 - Copyright (c) 1999-2001 by Heiko Oberdiek.
*** make png files / run Ghostscript ***
**** This file has a corrupted %%EOF marker, or garbage after the %%EOF.
GNU Ghostscript 6.51: Unrecoverable error, exit code 1
!!! Error: Closing Ghostscript (exit status: 1)!
Although document processing will continue (and you might even get a
quite usable document), I strongly recommend you to investigate the
source of this failing and to either eliminate it, or revert to a
configuration that is known to work.
However, there is an exception to this rule of thumb: if you see the
error
Ghostscript internal error
the very first time you run lyxtox, don't panic. Let it finish. It is
probably missing the pk fonts for the resolution of your standard
printer and must generate them on the fly. This will be done later,
while creating the postscript (PS) version of the document. After this
is done once, you will never see this error again. [icon_wink.png]
_________________________________________________________________
6.4.3. sed segmentation fault
On one occasion, I got the following very disturbing error:
/usr/local/bin/runsed: line 54: 27611 Segmentation fault sed -f $SEDSCR $x >/tm
p/$y$$
Output of the corrected SGML file broke at a line for no apparent
reason. Openjade complained (of course) with some errors, but
processed the file. I noticed that something went wrong from the
output of thumbpdf (see Section 6.4.2): thumbpdf prints the page
number for each page it processes - and this time it only printed half
that many. I was not able to find the reason for the segmentation
fault. I guess it has to do with the exceptionally long line that sed
had to process: LyX produces very long SGML lines. It does not break
the lines at SGML tags and clutters them on one line for reasons
unknown to me. That particular line was thus more than 3400
characters[12] long when it was output without the error. As soon as I
added some innocent text that made it a little longer, it would cause
the segmentation fault above. I guess this breaks some input line
length limitation in sed. However, this is denied to be the case in
the sed manual on the (non-)limitations on line length:
For those who want to write portable SED scripts, be aware that
some implementations have been known to limit line lengths (for the
pattern and hold spaces) to be no more than 4000 bytes. The POSIX.2
standard specifies that conforming SED implementations shall
support at least 8192 byte line lengths. GNU SED has no built-in
limit on line length; as long as SED can malloc() more (virtual)
memory, it will allow lines as long as you care to feed it (or
construct within it).
The only remedy if this limit does exist (as it seems to be in my
case), is to shorten your text, or introduce a paragraph, admonition
(see Section 4.7, Section 5.8), code or other environment (Section
5.1) that may persuade LyX to start a new SGML line in the exported
SGML text.
_________________________________________________________________
6.4.4. Acrobat Reader 5 does not show thumbnails in Linux
The thumbpdf script creates thumbnails for the PDF document just fine
(see Section 7.2.11). Things work fine even with a thumbpdf.tex of
version 3.2 and a thumbpdf of version 2.8, i.e. even if the versions
of these two files differ (in which case thumbpdf will issue a
warning, see Section 6.2).
Yet, one day, I recomputed the PDF version of a document, only to
discover that the thumbnails were appearing intermittently in the
document: some (few) appeared, the rest showed just a blank thumbnail.
After an extensive Internet search (with very few results on the
subject...) and a check with both Acrobat Reader 5 for Linux and
Acrobat Reader 7 for Windows, it became clear that this is a problem
of Acrobat Reader 5 for Linux and large thumbnails (small thumbnails
are displayed fine).
I guess there is nothing you can do about this problem, other than
switch to small thumbnails (right-click on the thumbnail area to see
the context menu that will allow you to choose this), or upgrade to a
version of Acrobat Reader that does not suffer from this bug.
_________________________________________________________________
6.4.5. URLs with underscore display '_' instead of '_'
Any URL that has an underscore in it (like the link to
awkscr_insert_index_items) shows '&lowbar' in place of '_'. To correct
this, you must check the checkbox " HTML type" when you insert the URL
in LyX, see Figure 6-1.
Figure 6-1. Insert URL with underscores in LyX.
[insert-url.png]
Insert URL with underscores in LyX.
When you do this, you should NOT write underscores as '_'. You
should write an underscore as is, i.e. as '_', in both the URL and the
Name fields Figure 6-1.
FIXME: This still does not solve the problem in PDFs: there, the
underscore is interpreted mathematically, making the character
following the underscore to appear as a subscript. Moreover, if the
link does not have an ending, it gets the standard ending for PDFs,
namely ".pdf" attached to it, which is definitely wrong. Try this
link: awkscr_insert_index_items, in HTML and in PDF to see the
difference!
_________________________________________________________________
6.4.6. sed: file sedscr_img line 2: Unknown option to `s'
You get the error:
editing mySGML.html
sed: file sedscr_img line 2: Unknown option to `s'
Output written to /tmp/mySGML.html_1402221460
Sed produced an empty file
- check your sedscript.
all done
When you check the offending line 2 of sedscr_img (remember that
sedscr_img is dynamically generated each time you run lyxtox), you
see:
s///g
Now it's clear what the error is: the caption to a figure contains a
backslash (in "ISO/DIN"), which is used by sed as a regular expression
delimiter.
The easiest solution to this seems to be: just avoid using backslash
in figure captions! You cannot have everything in this world, it
seems... [icon_smile.png]
See Figure 4-2 for the corrected caption of this specific example.
_________________________________________________________________
Chapter 7. Explaining the magic: the details
Knowing how things work is the basis for appreciation, and is thus a
source of civilized delight.
William Safire
What makes the procedure described here appear to be "magic" is not
only the "high-tecness" of the tools involved, but also the highly
frustrating fact that each one of the tools involved expects its input
in different directories and/or formats, making it really difficult
for interfaces or pipes to match the output of one tool to the
expected input of another. In this chapter I will explain the inner
working of the involved scripts that, ultimately, do one thing: ensure
that what is expected will be found in its expected place, in the
expected format.
Tip Tip:
You don't need to read this chapter if you are not interested in the
gory details. For getting things to work, the Chapter 3, Chapter 4,
Chapter 5 and Section 5.21 should suffice. But if you want to
understand how things work, then go on!
_________________________________________________________________
7.1. Document processing
What happens when you type " lyxtox myTemplate"? A lot! Let's inspect
it step by step:
The name of the parameter given to the lyxtox script, myTemplate,
becomes $1. Whenever you see $1 in the code examples below, just
replace it mentally with the name you supplied to lyxtox.
_________________________________________________________________
7.1.1. Check number of parameters
As in every good script, a rudimentary parameter number check is the
very first thing to do:
# Check arguments and issue a help statement, if wrong
#
if [ $# -eq 0 -o $# -gt 1 ]; then
help
exit 1
elif [ $1 = "-h" -o $1 = "--help" ]; then
help
exit 0
fi
If the number of parameters is not exactly 1, the output of the help()
function is printed, which looks like this:
Usage: lyxtox [-h] [FILENAME_WITHOUT_.lyx_ENDING]
Creates HTML, PDF, RTF, TXT and PS output
from a single LYX source.
Needs: lyx, runsed, sed, sedscr, jadetex.cfg, perl, openjade,
pdfjadetex, DocBook, TeX, LaTeX, thumbpdf, gzip, tar
and all packages required from these.
See http://www.karakas-online.de/mySGML/ for a detailed
description.
EXAMPLE
=======
If your file is myfile.lyx, then do
lyxtox myfile
go get a cup of coffee and be happy :-)
-h, --help Display this help text
_________________________________________________________________
7.1.2. Set program locations
If the parameter number check is passed, some program locations are
set (adapt them to our situation!):
# Program locations
# Adapt to your situation.
LYX="/usr/X11R6/bin/lyx"
SED="/usr/bin/sed"
AWK="/usr/bin/awk"
RUNSED="/usr/local/bin/runsed"
SEDSCR="sedscr"
SEDSCRMATH="sedscr_math"
SEDSCRABI="sedscr_abi"
SEDSCRAPP="sedscr_app"
SEDSCRBIB="sedscr_bib"
AWKSCRMATH="awkscr_math"
PERL="/usr/bin/perl"
COLLATEINDEX="/usr/share/sgml/docbook/docbook-dsssl-stylesheets/bin/collateinde
x.pl"
UNESCAPEMATH="/usr/local/bin/unescape_math.pl"
TEXMATH2PNGBMP="/usr/local/bin/texmath2pngbmp.pl"
THUMB_PDF="/usr/local/bin/thumbpdf"
OPENJADE="/usr/bin/openjade"
PDFJADETEX="/usr/bin/pdfjadetex"
JADETEX="/usr/bin/jadetex"
DVIPS="/usr/bin/dvips"
GZIP="/usr/bin/gzip"
TAR="/bin/tar"
TIDY="/usr/bin/tidy"
HTMLSPLIT="/usr/local/bin/htmlsplit.awk"
REFDBXP="/usr/bin/refdbxp"
RUNBIB="/usr/bin/runbib"
DATADIR="../"
DOMAIN="www.karakas-online.de"
Further, the stylesheet locations are set (adapt them to your
situation too):
HTML_CHUNKS_DSL="lyxtox-html.dsl"
HTML_NOCHUNKS_DSL="lyxtox-onehtml.dsl"
PRINT_PDF_DSL="lyxtox-print-pdf.dsl"
PRINT_PS_DSL="lyxtox-print-ps.dsl"
PRINT_RTF_DSL="lyxtox-print-rtf.dsl"
PRINT_TXT_DSL="lyxtox-print-txt.dsl"
You only need to change this part, if at all. The RefDB part:
HTML_DSL="refdb-html.dsl"
HTML_CHUNKS_DSL="$HTML_DSL#html"
HTML_NOCHUNKS_DSL="$HTML_DSL#onehtml"
PRINT_DSL="refdb-print.dsl"
PRINT_PDF_DSL="$PRINT_DSL#print-pdf"
PRINT_PS_DSL="$PRINT_DSL#print-ps"
PRINT_RTF_DSL="$PRINT_DSL#print-rtf"
PRINT_TXT_DSL="$PRINT_DSL#print-txt"
works automatically and it is does not play any role how you name (or
where you place) the HTML_DSL and PRINT_DSL files in this case - they
will be automatically created through awkscr_refdb_html and
awkscr_refdb_print with whatever filename you pass to them for their
output respectively, see the source code of lyxtox.
_________________________________________________________________
7.1.3. Set environment variables
It's time to set some environment variables. This is where quite a lot
of the "magic" is hidden! Although they are mentioned somewhere in the
respective manpages, a newcomer will have probably never heard of
them. The result: images cannot be found, no matter how "right" you
did it, as well as some other annoyances regarding font mappings. This
is because different tools read different environment variables for
the same information, ignoring all the others! There is probably no
way to accomodate this - other than write all relevant variables down
correctly - since TeX/LaTeX were created in a different time, for
different needs than SGML parsers or PDF software.
Since we entered the names of images without any path information in
LyX, openjade needs to be informed of their location with the
environment variable SGML_SEARCH_PATH:
# Environment variables
# openjade needs this!
# Both absolute and relative paths work!
# SGML_SEARCH_PATH="$PWD/images"
SGML_SEARCH_PATH="./images"
export SGML_SEARCH_PATH
pdftex (and pdfjadetex) will look at a different environment variable
for the location of the image files: TEXPSHEADERS. For some reason
which I don't fully understand, \ includegraphics with pdftex uses the
TEXPSHEADERS environment variable for the additional paths to search.
Also: TEXPSHEADERS contains the search path where pdftex looks up for
font mapping file (pdftex.map) and encoding files (*.enc):
# pdftex (and pdfjadetex) need this.
# In my system pdftex.map is located in /var/lib/texmf/dvips/config/,
# while the .enc files are under /usr/share/texmf/dvips/base/.
# TEXPSHEADERS=":${PWD}/images//:/var/lib/texmf/dvips/config/:/usr/share/texmf/
dvips/base/"
TEXPSHEADERS=":${PWD}/images//"
export TEXPSHEADERS
LaTeX, on the other side, will look at still another variable for the
path to images: TEXINPUTS (TEXINPUTS is also defined in the texmf.cnf
file, usually located in the directory pointed to by the TEXMFCNF
environment variable):
# LaTeX & Co. need this!
# A relative path does NOT work!
# TEXINPUTS="$PWD/images:$TEXINPUTS"
TEXINPUTS=":${PWD}/images//"
export TEXINPUTS
The TEXMFCNF environment variable points to the directory that
contains the configuration files for TeX:
TEXMFCNF="/etc/texmf/"
export TEXMFCNF
In /etc/texmf/texmf.cnf we read:
% pdfjadetex: Search path for font metric (.tfm) files.
TEXFONTS = .;$TEXMF/fonts/tfm//
The next environment variable we will have to set, is the one that
passes options to thumbpdf (see Section 3.7), for the case that you
wish to do so:
# You can pass options to thumbpdf through this environment variable
THUMBPDF=""
export THUMBPDF
Last but not least, openjade needs to know the locations of the SGML
catalog files (see Section 4.5):
SGML_CATALOG_FILES="$SGML_CATALOG_FILES:/usr/share/sgml/CATALOG.iso_ent"
SGML_CATALOG_FILES="$SGML_CATALOG_FILES:/usr/share/sgml/CATALOG.docbook-dsssl-s
tylesheets"
SGML_CATALOG_FILES="$SGML_CATALOG_FILES:/usr/share/sgml/CATALOG.mathml-2.0"
SGML_CATALOG_FILES="$SGML_CATALOG_FILES:/usr/share/sgml/CATALOG.svg-1.1"
SGML_CATALOG_FILES="$SGML_CATALOG_FILES:/usr/share/sgml/CATALOG.docbook_4"
SGML_CATALOG_FILES="$SGML_CATALOG_FILES:/usr/share/sgml/openjade/catalog"
SGML_CATALOG_FILES="$SGML_CATALOG_FILES:/usr/share/refdb/refdb.cat"
export SGML_CATALOG_FILES
The SP_ENCODING environment variable tells Openjade in which encoding
the input file is written in:
SP_ENCODING="ISO-8859-1"
export SP_ENCODING
Encoding names are case insensitive. The following named encodings are
available (see Handling of character sets in OpenSP):
utf-8
Each character is represented by a variable number of bytes
according to UCS Transformation Format 8 defined in Annex P to
be added by the first proposed drafted amendment (PDAM 1) to
ISO/IEC 10646-1:1993.
utf-16
Each character is represented by a variable number of bytes
according to UCS Transformation Format 16 defined in Annex O to
be added by the first proposed drafted amendment (PDAM 1) to
ISO/IEC 10646-1:1993.
ucs-2
iso-10646-ucs-2 This is ISO/IEC 10646 with the UCS-2
transformation format. Each character is represented by 2
bytes. No special treatment is given to the byte order mark
character.
ucs-4 iso-10646-ucs-4
utf-32 This is ISO/IEC 10646 with the UCS-4 transformation
format. Each character is represented by 4 bytes.
unicode
Each character is represented according to the utf-16 encoding.
The bytes representing the entire storage object may be
preceded by a pair of bytes representing the byte order mark
character (0xFEFF). The bytes representing each character are
in the system byte order, unless the byte order mark character
is present, in which case the order of its bytes determines the
byte order. When the storage object is read, any byte order
mark character is discarded.
euc-jp
This is equivalent to the
Extended_UNIX_Code_Packed_Format_for_Japanese Internet charset.
Each character is encoded by a variable length sequence of
octets.
euc-kr
This is ASCII and KSC 5601 encoded with the EUC encoding as
defined by KS C 5861-1992.
euc-cn cn-gb
gb2312 This is ASCII and GB 2312-80 encoded with the EUC
encoding. It is equivalent to the CN-GB MIME charset defined in
RFC 1922.
sjis
shift_jis This is equivalent to the Shift_JIS Internet charset.
Each character is encoded by a variable length sequence of
octets. This is Microsoft's standard encoding for Japanese.
big5 cn-big5
This is equivalent to the CN-Big5 MIME charset defined in RFC
1922.
is8859-n iso-8859-n
n can be any single digit other than 0. Each character in the
repertoire of ISO 8859-n is represented by a single byte.
koi8-r
koi8 The koi8-r encoding as defined in RFC 1489.
xml
On input, this uses XML's rules to determine the encoding. On
output, this uses UTF-8.
windows
Specify this encoding when a storage object is encoded using
your system's default Windows character set. This uses the
so-called ANSI code page.
wunicode
This uses the unicode encoding if the storage object starts
with a byte order mark and otherwise the windows encoding. If
you are working with Unicode, this is probably the best value
for SP_ENCODING.
ms-dos
Specify this encoding when a storage object (file) uses the OEM
code page. The OEM code-page for a particular machine is the
code-page used by FAT file-systems on that machine and is the
default code-page for MS-DOS consoles.
For OpenSP, a suite of SGML/XML processing tools related to Openjade,
there are two other environment variables that are related to
SP_ENCODING (see Handling of character sets in OpenSP):
SP_CHARSET_FIXED
If this variable is 1 or YES, then OpenSP will operate in fixed
character set mode.
SP_SYSTEM_CHARSET
This identifies the system character set. When in fixed
character set mode, this character set is used as the internal
character set. When not in fixed character set mode this
character set is used as the internal character set until the
document character set has been read, at which point the
document character set is used as the internal character set.
The only currently recognized value for this is JIS. This
refers to a character set which combines JIS X 0201, JIS X 0208
and JIS X 0212 by adding 0x8080 to the codes of characters in
JIS X 0208 and 0x8000 to the codes of characters in JIS X 0212.
The default system character set is Unicode 2.0.
But since lyxtox does not use OpenSP, we don't need to care about
these two, as the manual page of Openjade asserts:
Note Openjade does not use SP_CHARSET_FIXED and SP_SYSTEM_CHARSET
OpenJade ignores the SP_CHARSET_FIXED and SP_SYSTEM_CHARSET
environment variables and always uses Unicode as its internal
character set, as if SP_CHARSET_FIXED was 1 and SP_SYSTEM_CHARSET was
unset. Thus only the SP_ENCODING environment variable is relevant to
OpenJades handling of character sets.
_________________________________________________________________
7.1.4. Main part
In the main part, the hard work (for your computer) begins:
The document is exported from LyX to DocBook SGML:
$LYX -e docbook $1.lyx
The SGML that is produced by LyX has several shortcomings. They have
to be corrected. This is done by calling runsed:
$RUNSED $SEDSCR $1.sgml
which is the subject of the next subsection.
Note Alternative commands
There are quite a few alternative invocations of the various tools at
appropriate places in the lyxtox script, in the form of comments.
These are there in order to show you how you can achieve an equivalent
result through other tools.
_________________________________________________________________
7.1.4.1. Runsed, sed and sedscr
Runsed takes as argument the sedscript to run and the file against
which to run it. It calls sed with sedscr as the "sed command file".
In the sedscr file itself there is another bunch of "magic" going on:
Important Important note:
The changes in LyX' SGML code presented here pertain strictly to LyX
version 1.2.0! The 1.1.x versions needed slightly (and subtly)
different changes and the same may be true for future versions of LyX.
Examples of sed commands for previous LyX versions are presented in
the sedscr file in comments. Use (or construct) the right sed commands
for the right changes for your LyX version! The success of this method
depends crucially on this.
The code
s/<\(sect[^>]*\)>\([^<]*\)]*\)>/<\1 \3>\2/g
s/<\(chapter\)>\([^<]*\)]*\)>/<\1 \3>\2/g
tells sed to substitute[13]
< sect1 >< title > some title < anchor id="some label" >
with
some title
and
< chapter >< title > some title < anchor id="some label" >
with
some title
The code
/^.*
\
\3<\/para>\
<\/caption>\
<\/mediaobject>\
<\/figure>\
/g
}
tells sed to substitute[14]
< figure >< title >< graphic fileref="imagename" > some blanks < anchor id="som
e id" >some title< /title >
with the more elaborate combination of figure and mediaobject
elements:
some title
]]>
]]>
]]>
]]>
some title
some title
There are some remarks due here:
* The title of the original SGML appears in three places of the new
SGML: the title, the phrase for the alternative text and the
caption. LyX uses the figure caption for the title and there is no
way we can derive three different texts for the three different
uses in the new SGML. That is why in the output document the
figure title, the alternative text and the figure caption are
identical.
* For the PNG format we must prefix the image file name,
imagename.png, with the relative path (./images) to it, even
though we set all environment variables correctly (see Section
7.1.3). This is not necesary for the other formats.
* We scale the PDF images to 100%. I used to scale them down to 65%,
but this is no longer necessary, after some experimentation with
various scale factors that seem to compensate for this need in the
addd utility. See also Section 4.9.
* We make use of external SGML entities like %output.print.png; This
is a topic of its own which is explained in detail in Section
7.2.2.
A mediaobject similar to the above (but without figure id and caption)
is inserted whenever a "simple" image, i.e. one without the float
element with caption, is encountered in LyX' SGML. It substitutes a
line like[15]
< graphic fileref="imagename" >
with a mediaobject like
]]>
]]>
]]>
]]>
Notice that the text is now simply "Figure", since there was no
caption. You may change it to something else. There is also no id
available for this mediaobject, therefore you cannot cross-reference
it. That's why I suggested floats in Section 5.7.
The following sed code
/^.*[^<]*]*\)>//g
/^.*[^<]*<\/programlisting>/s/<\/programlisting\([^>]*\)>/<\/screen\1>/g
will substitute with , while this one:
# Delete the before the tag.
s/ after the tag.
s/<\/tgroup><\/para>/<\/tgroup>/g
will delete before and before .
For table captions and titles to be output correctly, you have to
eliminate the from any sequence AND you
have to write a table float (see Section 5.10, in the inside of which
you will have to set the title and the caption environment on one
line, then press , set the environment to "Standard" (this will
produce the element we eliminate here) and continue with the
table normally. A warning about an "end tag for element "TABLE" which
is not open" is the less evil we can get and is harmless (a LyX bug in
1.2.0, not openjade's):
/<\/title>< title >< anchor id="some id" >
with
and, as you can easily see, is a customized footer. Now we proceed to
intermix all the above files in the following order into one HTML
document:
1. part1
2. title
3. part2
4. body
5. part3
At the end we get a HTML document that is customized to the design of
our site and can easily be checked for compliance to the HTML
standards!
Tip HTML Parameters and Chunking
You can achieve a similar result by setting the html-header-tags
parameter accordingly in the HTML DSSSL stylesheet (Section 4.2,
Section 7.1.5). The html-header-tags parameter should contain a list
of the the HTML HEAD tags that should be generated. The format is a
list of lists, each interior list consists of a tag name and a set of
attribute/value pairs: '(("META" ("NAME" "name") ("CONTENT"
"content"))).
(define %html-header-tags%
;; What additional HEAD tags should be generated?
'())
Of course, you would have to change the html-header-tags parameter in
the .dsl file each time before processing a new document. You would
thus need some kind of placeholders that could be identified and
changed with sed to the actually needed values. However, this amounts
to the same effort that we are currently investing with our method,
which also substitutes various placeholders in parts 1-3. Obviously,
such a flexibility must come at some cost. Feel free to experiment
with the other HTML Parameters for Chunking too!
The footer file, part3, deserves some extra attention, since it
illustrates the kind of customization and control over your HTML
output that you can achieve with this method: it contains the HTML
code that prints three icons in a row - a W3C HTML validation icon, a
Linux Counter icon and an icon from the "any browser" campaign. There
are three placeholders in the link for the HTML validation icon:
_DOMAIN_, _DIRNAME_ and _FILENAME_. These are substituted on-the-fly
(using sed one-line commands) with the domain, directory and filename
respectively of the file whose footer we are currently processing:
$SED -e "s/_DOMAIN_/$DOMAIN/g" ${DATADIR}/part3 > part3_1.tmp
$SED -e "s/_DIRNAME_/$1/g" part3_1.tmp > part3_2.tmp
$SED -e "s/_FILENAME_/${BASENAME}/g" part3_2.tmp > part3.tmp
The result is an icon that, when clicked, will automatically pass the
URI of the current file to The W3C Validator for HTML validation!
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
In fact, any HTML standard after 2.0 explicitly forbids from
occuring anywhere inside the parse tree of a
element - and
that's where exactly the graphical callouts most often happen to
occur! For example, the HTML 3.2 reference specification states: "PRE
has the same content model as paragraphs, excluding images and
elements that produce changes in font size, e.g. IMG, BIG, SMALL, SUB,
SUP and FONT". If you want your document to be fully compliant, you
will have to suppress the use of graphics for the callouts by setting
%callout-graphics% to false in you stylesheet:
(define %callout-graphics%
;; Use graphics in callouts?
#f)
Also note that admonitions (see Section 4.7 and Section 5.8) will be
positioned using valign="center", instead of the right one
valign="middle", thus leading again to non validation. But this is
easily corrected by the sed script sedscr_val that is run near the end
of the lyxtox script.
_________________________________________________________________
Chapter 9. Accessibility
A broad definition of accessibility covers people operating under
situational limitations as well as functional limitations:
Functional limitations pertain to disabilities, such as blindness
or limited use of the hands. Functional limitations can be visual,
auditory, physical, or cognitive (which includes language and
learning disabilities).
Situational limitations relate to the prevailing circumstatnces,
environment, or device. These limitations can affect anybody, not
just people with disabilities. Examples include mobile devices and
device limitations, such as having no mouse, or constraining
circumstances, such as interacting with a web site through a
computer integrated into a car's dashboard, wher the use of the
hands and eyes is limited.
Shawn Lawton Henry, Constructing Accessible Web Sites.
Something is accessible if it is able to be used by persons with
disabilities. In the context of computing, this generally means that
the software or device should be compatible with access aids, and
should be able to transform itself into a needed format (see the
Glossary of Bobby). The efficiency with which information can be
accessed by people with various abilities and disabilities ultimately
determines the degree of accessibility - it is clear that this is a
highly subjective matter. Nevertheless, various criteria have been
developed to help determine how accessible a web page is. I will
follow the priorisation of accessibility errors as suggested by Bobby
in http://bobby.watchfire.com:80/bobby/html/en/readreport.jsp:
Priority 1 Accessibility problems
seriously affect a page's usability by people with
disabilities. A Bobby Approved rating can only be granted to a
site in which none of the pages contain accessibility errors.
Bobby Approved status is equivalent to Conformance Level A for
the Web Content Guidelines.
Priority 2 Accessibility problems
are those which you should try to fix. Although not as vital as
Priority 1 access errors, the items in this section are
considered important for access. If you can pass all items in
this section in addition to the Priority 1 section, including
relevant User Checks, your page meets Conformance Level AA for
the Web Content Guidelines. This is the preferred minimum
conformance level for an accessible site.
Priority 3 Accessibility problems
are third-tier access problems which you should also consider.
If you can pass all items in this section in addition to the
Priority 1 and 2 sections, including relevant User Checks, your
page meets Conformance Level AAA for the Web Content
Guidelines.
If you think this is "fine print" that does not have to bother you,
you are wrong: no lesser than the Sydney Organizing Committee for the
Olympic Games (SOCOG) thought the same and was fined to pay A$20000 in
a case that was brought to an australian court - see the Reader's
guide to Sydney Olympics accessibility complaint for the whole story
and an explanation of the court's decision, as well as Olympic
Failure: A Case for Making the Web Accessible for the web designer's
point of view.
You also cannot argue that this has happened "too far away" from you,
perhaps on another continent. The world grows together and all western
nations have passed legislation that is more or less similar on this
point, based on the same legal principles of unequal treatment
("discrimination"; "unfavourable" treatment) and unjustifiable
hardship ("undue" hardship or "burden"). It is a matter of time until
similar cases appear to the courts. I hope you understand by now the
following
Important Important fact:
Accessibility is NOT optional!
So what can you do to improve the HTML pages created by the tools I
presented, from the accessibility point of view? You can pass any of
your generated HTML pages to Bobby for an accessibilty test[29]. You
will be presented with a list of errors, sorted according to priority
as above. I will discuss them for a typical page that was generated
with the tools I presented in the previous chapters.
Tip Mean tip:
Not all of the accessibility errors presented in the following
sections can be reproduced when testing a page that was generated with
the method presented here. To get the full idea, pass the the Linux
Accessibility HOWTO pages for a test at Bobby. [icon_eek.png]
For more information on accessibility, see the Bobby Accessibility FAQ
and the the Linux Accessibility HOWTO.
_________________________________________________________________
9.1. Priority 1 accessibility errors
No priority 1 accessibility errors seem to be there for a page that
was generated with lyxtox. This is good news, as it means that the
pages generated this way do not pose serious obstacles to people with
disabilities. Provided that we didn't miss anything, we can say that
the pages have " Bobby Approved status", or that they conform to Level
A of the Web Content Guidelines.
_________________________________________________________________
9.2. Priority 2 accessibility errors
The explanation texts are from Bobby. Clicking on any of the problems
that Bobby reports will produce a more detailed description of how to
fix the problem. In addition to items that Bobby can examine
automatically, a number of items that require manual examination are
presented in the User Checks section of the Bobby report.
Nest headings properly.
This comes from incorrect nesting of the H elements in the
authors environment. I could not correct this, as it seems to
me a stylesheet/Jade problem. Of course, you could correct it
manually, or with a script, but I think it is better to correct
it before it happens.
Important Why it is bad:
Some users skim through a document by navigating its headings (the H1,
H2, H3, H4, H5, and H6 elements). Some access aids extract the
headings to create an outline of the page, allowing users to get an
overview and jump quickly to a desired part. Incorrect nesting of
headings will result in an incorrect outline structure which may
disorient users. Screen readers rely on these tags to interpret the
structure of your pages. See also "Using real headers" by Mark
Pilgrim.
Use a public text identifier in a DOCTYPE statement.
We have corrected this already in Chapter 8.
Important Why it is bad:
Include a document type declaration at the beginning of a document
that refers to a published DTD (e.g., the HTML 4.01 transitional DTD).
The document type declaration should be appropriate to the markup
language you are using.
_________________________________________________________________
9.3. Priority 3 accessibility errors
Provide a summary for tables.
This refers to the revision history table. Again, it seems to
be a stylesheet/Jade problem.
Identify the language of the text.
This helps the computer or assistive device present information
in a way that is appropriate to the language and also helps
automatic translation software that translates text from one
language into another. This should already have been fixed with
the techniques of Chapter 8.
_________________________________________________________________
Chapter 10. Mathematics
Since LyX is a frontend for LaTeX, it is no secret that it has
exceptional capabilities when it comes to typesetting mathematics.
However, when it comes to transforming the .lyx document to different
format, the possibilities are rather limited[30]:
* For HTML, export to LaTeX and then use latex2html. This has some
disadvantages:
+ Excessive memory usage: latex2html will consume a lot of
memory (FIXME: is this still the case?)
+ Most important: We are talking about an SGML document here
and all the DocBook markup will be lost if you transform it
back to LaTeX - just think about the admonitions (see Section
4.7), callouts (see Section 4.8) and all the other SGML stuff
that will be impossible to transform back!
* For PostScript®, export to LaTeX, then create the .dvi file (by
calling LaTeX) and then the PS file using dvips. That's O.K.,
since it directly uses TeX and the mathematics will be as
accurately typeset as possible.
* For PDF, transform the above PostScript® file to PDF using ps2pdf,
or some commercial program like the Acrobat® Distiller®. Taking
the roundtrip to PS in order to arrive at PDF has some serious
drawbacks, though (FIXME: which ones?) After all, pdfjadetex was
developed to avoid exactly these drawbacks, so it would be nice if
we could use it.
* For RTF, no way seems to exist to get mathematics from LyX in this
format.
The above is not a satisfactory situation. Even if we can get
mathematics in some formats, we would have to abandon the SGML
framework we have been using so far. It would be nice if we could
continue to write in a DocBook SGML document in LyX, using all the
excellent math typestting capabilities of TeX/LaTeX and then export to
whichever of the above formats through our usual scripts and tools
like openjade, pdfjadetex etc. In fact, as the following example
already shows, we can:
Equation 10-1. (eq2)
[11182.png]
Let's see what is going on, from the SGML point of view, when you type
an equation like Equation 10-1[31] in LyX: when exported to SGML, this
equation yelds the following MathML code:
\begin{equation}
{\displaystyle }\int _{a}^{b}x^{2}dx=\frac{1}{3}(b-a)^{3}\label{eq2}\end{equati
on}
There are some remarks due here:
* The TeX code that typesets the equation is enclosed between the
tags. We will make heavy use of this fact later.
* The equation is again output, this time between the