Moving docs tree to docs-xml to make room for generated docs in the release tarball.
[Samba.git] / docs-xml / xslt / db2latex-xsl / xsl / texmath.mod.xsl
blobb17096a182083c0c6334ada240fe5ac2dcd0834f
1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--#############################################################################
4 | $Id: texmath.mod.xsl,v 1.12 2004/01/03 03:19:08 j-devenish Exp $
5 |- #############################################################################
6 | $Author: j-devenish $
7 + ############################################################################## -->
9 <xsl:stylesheet
10 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
12 exclude-result-prefixes="doc" version='1.0'>
14 <doc:reference id="texmath" xmlns="">
15 <referenceinfo>
16 <releaseinfo role="meta">
17 $Id: texmath.mod.xsl,v 1.12 2004/01/03 03:19:08 j-devenish Exp $
18 </releaseinfo>
19 <authorgroup>
20 &ramon;
21 &james;
22 </authorgroup>
23 <copyright>
24 <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
25 <holder>Ramon Casellas</holder>
26 </copyright>
27 <revhistory>
28 <doc:revision rcasver="1.11">&rev_2003_05;</doc:revision>
29 </revhistory>
30 </referenceinfo>
31 <title>&LaTeX;-only Commands <filename>texmath.mod.xsl</filename></title>
32 <partintro>
33 <para>
37 </para>
38 </partintro>
39 </doc:reference>
41 <doc:template xmlns="">
42 <refpurpose>Process <doc:db>alt</doc:db> elements</refpurpose>
43 <doc:description>
44 <para>
47 </para>
48 </doc:description>
49 <doc:variables>
50 <itemizedlist>
51 <listitem><simpara>
52 <xref linkend="param.tex.math.in.alt"/>
53 </simpara></listitem>
54 </itemizedlist>
55 </doc:variables>
56 <doc:notes>
57 <para>
59 This template will modify its behaviour based upon its context
60 within a &DocBook; document.
62 If it is within an <doc:db>inlineequation</doc:db> and it has a
63 <sgmltag class="attribute">role</sgmltag> with the value of
64 <quote>latex</quote> or <quote>tex</quote>, then it will
65 typeset its contents inline as raw &LaTeX; input in mathematics
66 mode (using <function condition="latex">ensuremath</function>
67 command) if the variable <xref
68 linkend="param.tex.math.in.alt"/> is set.
70 If it is within an <doc:db>equation</doc:db> or
71 <doc:db>informalequation</doc:db> and it has a <sgmltag
72 class="attribute">role</sgmltag> with the value of
73 <quote>latex</quote> or <quote>tex</quote>, then it will
74 typeset its contents as raw &LaTeX; input in a <function
75 condition="env">displaymath</function> block environment if the
76 variable <xref linkend="param.tex.math.in.alt"/> is set.
78 Otherwise, if <xref linkend="param.tex.math.in.alt"/> is
79 set, the contents will be typeset as raw &LaTeX; input inline
80 (not in maths mode).
82 Otherwise, templates will be applied normally (not as raw
83 &LaTeX; input).
85 </para>
86 </doc:notes>
87 <doc:samples>
88 <simplelist type='inline'>
89 &test_book;
90 &test_theorem;
91 </simplelist>
92 </doc:samples>
93 </doc:template>
94 <xsl:template match="alt">
95 <xsl:choose>
96 <xsl:when test="ancestor::inlineequation and (@role='tex' or @role='latex' or $tex.math.in.alt='plain' or $tex.math.in.alt='latex')">
97 <xsl:text>\ensuremath{</xsl:text>
98 <xsl:value-of select="."/>
99 <xsl:text>}</xsl:text>
100 </xsl:when>
101 <xsl:when test="(ancestor::equation|ancestor::informalequation) and (@role='tex' or @role='latex' or $tex.math.in.alt='plain' or $tex.math.in.alt='latex')">
102 <xsl:text>\begin{displaymath}</xsl:text>
103 <xsl:call-template name="label.id"/>
104 <xsl:value-of select="."/>
105 <xsl:text>\end{displaymath}&#10;</xsl:text>
106 </xsl:when>
107 <xsl:when test="$tex.math.in.alt='plain' or $tex.math.in.alt='latex'">
108 <xsl:value-of select="."/>
109 </xsl:when>
110 <xsl:otherwise>
111 <xsl:apply-templates/>
112 </xsl:otherwise>
113 </xsl:choose>
114 </xsl:template>
116 <doc:template xmlns="">
117 <refpurpose>Process <sgmltag>latex</sgmltag> and <sgmltag>tex</sgmltag> elements</refpurpose>
118 <doc:description>
119 <para>
120 Passes contents through as raw &LaTeX; text.
121 </para>
122 </doc:description>
123 <doc:variables>
124 &no_var;
125 </doc:variables>
126 <doc:notes>
127 <para>
128 The <sgmltag>latex</sgmltag> and <sgmltag>tex</sgmltag> elements are not
129 part of &DocBook;.
130 </para>
131 </doc:notes>
132 </doc:template>
133 <xsl:template match="latex|tex">
134 <xsl:value-of select="."/>
135 </xsl:template>
137 <doc:template xmlns="">
138 <refpurpose>Process <sgmltag class="attribute">fileref</sgmltag> elements</refpurpose>
139 <doc:description>
140 <para>
141 Inputs a &LaTeX; file.
142 </para>
143 </doc:description>
144 <doc:variables>
145 &no_var;
146 </doc:variables>
147 <doc:notes>
148 <para>
149 For <sgmltag>latex</sgmltag> and <sgmltag>tex</sgmltag> elements with
150 <sgmltag class="attribute">fileref</sgmltag> attributes, their contents
151 are ignored and their fileref attributes are used as file paths for
152 the <function condition="latex">input</function> command.
153 </para>
154 <para>
155 The <sgmltag>latex</sgmltag> and <sgmltag>tex</sgmltag> elements are not
156 part of &DocBook;.
157 </para>
158 </doc:notes>
159 </doc:template>
160 <xsl:template match="latex[@fileref]|tex[@fileref]">
161 <xsl:text>\input{</xsl:text><xsl:value-of select="@fileref"/><xsl:text>}&#10;</xsl:text>
162 </xsl:template>
164 <xsl:template match="tm[@fileref]">
165 <xsl:text>\input{</xsl:text><xsl:value-of select="@fileref"/><xsl:text>}&#10;</xsl:text>
166 </xsl:template>
168 <xsl:template match="tm[@tex]">
169 <xsl:value-of select="@tex"/>
170 </xsl:template>
172 <xsl:template match="inlinetm[@fileref]">
173 <xsl:text>\input{</xsl:text><xsl:value-of select="@fileref"/><xsl:text>}&#10;</xsl:text>
174 </xsl:template>
176 <xsl:template match="inlinetm[@tex]">
177 <xsl:value-of select="@tex"/>
178 </xsl:template>
180 <doc:template xmlns="">
181 <refpurpose>Process <doc:db>inlineequation</doc:db> elements</refpurpose>
182 <doc:description>
183 <para>
184 Process inline equations.
185 </para>
186 </doc:description>
187 <doc:variables>
188 <itemizedlist>
189 <listitem><simpara>
190 <xref linkend="param.latex.alt.is.preferred"/>
191 </simpara></listitem>
192 </itemizedlist>
193 </doc:variables>
194 <doc:notes>
195 <para>
197 This template can accommodate raw &LaTeX; mathematics.
199 If the element has a
200 <sgmltag class="attribute">role</sgmltag> with a value of
201 <quote>latex</quote> or <quote>tex</quote>, or contains
202 an <doc:db>inlinemediaobject</doc:db>/<doc:db>textobject</doc:db>
204 an <doc:db>inlinemediaobject</doc:db>/<doc:db>textobject</doc:db>/<doc:db>phrase</doc:db>
205 with such as attribute,
206 then it will
207 typeset then in preference to all other content.
209 </para>
210 <para>
212 If such elements were not found, the template will search for
213 generic <doc:db>inlinemediaobject</doc:db> or
214 <doc:db>alt</doc:db> children. If <xref
215 linkend="param.latex.alt.is.preferred"/> is set, <sgmltag
216 basename="alt">alts</sgmltag> will be preferred over <sgmltag
217 basename="inlinemediaobject">inlinemediaobjects</sgmltag>. If
218 none of these elements was found, the template will format any
219 <doc:db>graphic</doc:db> children.
221 </para>
222 </doc:notes>
223 <doc:samples>
224 <simplelist type='inline'>
225 &test_book;
226 <!--
227 &test_pavlov;
229 </simplelist>
230 </doc:samples>
231 <doc:seealso>
232 <itemizedlist>
233 <listitem><simpara><xref linkend="template.alt"/></simpara></listitem>
234 <listitem><simpara><xref linkend="template.phrase"/></simpara></listitem>
235 </itemizedlist>
236 </doc:seealso>
237 </doc:template>
238 <xsl:template match="inlineequation">
239 <xsl:variable name="tex" select="alt[@role='tex' or @role='latex']|inlinemediaobject/textobject[@role='tex' or @role='latex']|inlinemediaobject/textobject/phrase[@role='tex' or @role='latex']" />
240 <xsl:choose>
241 <xsl:when test="$tex">
242 <xsl:apply-templates select="$tex"/>
243 </xsl:when>
244 <xsl:when test="alt and $latex.alt.is.preferred='1'">
245 <xsl:apply-templates select="alt"/>
246 </xsl:when>
247 <xsl:when test="inlinemediaobject">
248 <xsl:apply-templates select="inlinemediaobject"/>
249 </xsl:when>
250 <xsl:when test="alt">
251 <xsl:apply-templates select="alt"/>
252 </xsl:when>
253 <xsl:otherwise>
254 <xsl:apply-templates select="graphic"/>
255 </xsl:otherwise>
256 </xsl:choose>
257 </xsl:template>
259 </xsl:stylesheet>