alttex.xml

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<section output="manual">
<title>Writing LaTeX Mathematical Equations</title>

<section>
<title>Presentation</title>

<para>DocBook doesn't define elements for writing mathematical equations. Only
few elements exist that tell how equation should be displayed (inlined,
block):</para>

<itemizedlist>
<listitem>
<para><sgmltag>inlineequation</sgmltag> tells that the equation is
inlined,</para>
</listitem>

<listitem>
<para><sgmltag>informalequation</sgmltag> tells that the equation is displayed
as a block, without a title.</para>
</listitem>

<listitem>
<para><sgmltag>equation</sgmltag> tells that the equation is displayed as a
block, with or without a title.</para>
</listitem>
</itemizedlist>

<para>These tags include a graphic (<sgmltag>graphic</sgmltag> or
<sgmltag>mediaobject</sgmltag>) or an alternative text equation, as shown by
the example.</para>

<example>
<title>Equation taken from TDG</title>

<programlisting>
&lt;equation&gt;&lt;title&gt;Last Theorem of Fermat&lt;/title&gt; 
  &lt;alt&gt;x^n + y^n &amp;ne; z^n &amp;forall; n &amp;ne; 2&lt;/alt&gt;
  &lt;graphic fileref="figures/fermat"&gt;&lt;/graphic&gt;
&lt;/equation&gt;
   </programlisting>
</example>
</section>

<section>
<title>Implementation choice</title>

<para>The principle is to use only the <sgmltag>alt</sgmltag> element. If
initially <sgmltag>alt</sgmltag> contains actually the text to print, it is
chosen to use this element to embed LaTeX mathematical equations. This choice
has the following advantages:</para>

<itemizedlist>
<listitem>
<para>The translation done by dblatex is really easy, since the equation is
already written in LaTeX.</para>
</listitem>

<listitem>
<para>LaTeX is one of the best word processor to render mathematical
formulas.</para>
</listitem>

<listitem>
<para>One doesn't need to write the equations in MathML.</para>
</listitem>

<listitem>
<para>This method isn't specific to this tool (see the following
section).</para>
</listitem>
</itemizedlist>

</section>

<section id="sec-alttex-delimiters">
<title>Mathematical Delimiters</title>

<para>The dblatex implementation is as light as possible. This is why it is
up to the writer to properly use the mathematical delimiters ($, \(, \), \[,
\]). By this way the writer fully controls how he writes equations.</para>

<para id="pi-texmath-user">By default <command>dblatex</command> checks that
consistent mathematical
delimiters or environment are used in <sgmltag>alt</sgmltag> and it inserts the
default math mode delimiters if dblatex thinks they are missing, but
you can ask dblatex to write directly the <sgmltag>alt</sgmltag> content 
without any action. To do this, use the <literal>texmath</literal> Processing 
Instruction with <literal>delimiters</literal> set to 'user'.</para>

<para>For example, <xref linkend="eq-with-texmath-pi"/> has user specific
delimiters:</para>

<example id="eq-with-texmath-pi">
<title>Equation with user delimiters</title>
<xi:include href="equation-eg5.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<para>In the XML source this equation uses a specific <literal>align*</literal> environment and the <literal>texmath</literal> PI to let the equation as is:</para>
<programlisting>
<xi:include href="equation-eg5.xml" xmlns:xi="http://www.w3.org/2001/XInclude"
            parse="text"/> </programlisting>
</example>

</section>

<section>
<title>Compatibility</title>

<para>This implementation is not contradictory nor specific. In particular,
the <ulink
url="http://ricardo.ecn.wfu.edu/~cottrell/dbtexmath/">DBTeXMath</ulink>
proposal to extend the DSSSL stylesheets used by jade follows the same
approach, and is integrated in the Norman Walsh XSL stylesheets.</para>
</section>

<section>
<title>Examples</title>

<para>The following examples show how to write the equations.</para>

<example>
<title>Inlined Equation</title>

<xi:include href="equation-eg1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

<programlisting>
<xi:include href="equation-eg1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"
            parse="text"/>
</programlisting>
</example>

<example>
<title>Equation in a block</title>

<xi:include href="equation-eg2.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

<programlisting>
<xi:include href="equation-eg2.xml" xmlns:xi="http://www.w3.org/2001/XInclude"
            parse="text"/>
</programlisting>
</example>

<example>
<title>Equation in a float</title>

<xi:include href="equation-eg3.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

<programlisting>
<xi:include href="equation-eg3.xml" xmlns:xi="http://www.w3.org/2001/XInclude"
            parse="text"/>
</programlisting>
</example>

<example>
<title>Equation without a title</title>

<xi:include href="equation-eg4.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

<programlisting>
<xi:include href="equation-eg4.xml" xmlns:xi="http://www.w3.org/2001/XInclude"
            parse="text"/>
</programlisting>
</example>
</section>
</section>