]> granicus.if.org Git - docbook-dsssl/commitdiff
Improved support for TeX math inside equations.
authorJirka Kosek <jirka@kosek.cz>
Sat, 15 Dec 2001 15:48:33 +0000 (15:48 +0000)
committerJirka Kosek <jirka@kosek.cz>
Sat, 15 Dec 2001 15:48:33 +0000 (15:48 +0000)
xsl/common/common.xsl
xsl/fo/math.xsl
xsl/html/graphics.xsl
xsl/html/math.xsl
xsl/params/tex.math.in.alt.xml

index bbcda48e6cf38228bb1a056535fa8068bee4e57d..c487e0f94736c28c5aede8f9cbba89ab1a6d33e2 100644 (file)
@@ -785,7 +785,7 @@ of media objects is that the first acceptable graphic should be used.
           <xsl:text>0</xsl:text>
         </xsl:when>
        <!-- The first textobject is a reasonable fallback -->
-        <xsl:when test="name($object)='textobject'">
+        <xsl:when test="name($object)='textobject' and $object[not(@role) or @role!='tex']">
           <xsl:text>1</xsl:text>
         </xsl:when>
        <!-- If there's only one object, use it -->
index 9ea86c3d84d8139c00a54e2a5b17b1a0549a0377..a1af70d4007aeb126a9d0499da9ffe96d56da65f 100644 (file)
@@ -17,7 +17,7 @@
 <xsl:template match="inlineequation">
   <xsl:choose>
     <xsl:when test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
-      <xsl:apply-templates select="alt"/>
+      <xsl:apply-templates select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
     </xsl:when>
     <xsl:otherwise>
       <xsl:apply-templates/>
@@ -42,7 +42,8 @@
   </xsl:if>
 </xsl:template>
 
-<xsl:template match="inlineequation/alt">
+<xsl:template match="inlineequation/alt[@role='tex'] | 
+                     inlineequation/inlinemediaobject/textobject[@role='tex']" priority="1">
   <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
     <xsl:processing-instruction name="xmltex">
       <xsl:text>$</xsl:text>
@@ -52,7 +53,9 @@
   </xsl:if>
 </xsl:template>
 
-<xsl:template match="equation/alt | informalequation/alt">
+<xsl:template match="equation/alt[@role='tex'] | informalequation/alt[@role='tex'] |
+                     equation/mediaobject/textobject[@role='tex'] |
+                     informalequation/mediaobject/textobject[@role='tex']" priority="1">
   <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
     <xsl:processing-instruction name="xmltex">
       <xsl:text>$$</xsl:text>
@@ -62,7 +65,7 @@
   </xsl:if>
 </xsl:template>
 
-<xsl:template match="alt">
+<xsl:template match="alt[@role='tex']">
   <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
     <xsl:message>
       Your equation is misplaced. It should be in inlineequation, equation or informalequation.
index dc95c33a3aa55f14c1ebaaf68a767ee877b4b43f..b9b64538ec116e584298e50f5f6a01188d0b06d4 100644 (file)
 
       <xsl:call-template name="process.image">
         <xsl:with-param name="alt">
-          <xsl:apply-templates select="(../../textobject/phrase)[1]"/>
+          <xsl:apply-templates select="(../../textobject[not(@role) or @role!='tex']/phrase)[1]"/>
         </xsl:with-param>
         <xsl:with-param name="longdesc">
           <xsl:call-template name="write.longdesc">
index c13fb8e7384f2edfbf0e916809cba3a742c95b43..d640d5c30b924b62f351bf57e45b20372ae9259b 100644 (file)
@@ -62,9 +62,9 @@
 <xsl:template match="inlineequation" mode="collect.tex.math.plain">
   <xsl:variable name="filename">
     <xsl:choose>
-      <xsl:when test="inlinegraphic">
+      <xsl:when test="graphic">
         <xsl:call-template name="mediaobject.filename">
-          <xsl:with-param name="object" select="inlinegraphic"/>
+          <xsl:with-param name="object" select="graphic"/>
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
@@ -78,7 +78,7 @@
   <xsl:value-of select="$filename"/>
   <xsl:text>} &#xA;</xsl:text>
   <xsl:text>$</xsl:text>
-  <xsl:value-of select="alt"/>
+  <xsl:value-of select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
   <xsl:text>$ &#xA;</xsl:text>
   <xsl:text>\vfill\eject &#xA;</xsl:text>
 </xsl:template>
   <xsl:value-of select="$filename"/>
   <xsl:text>} &#xA;</xsl:text>
   <xsl:text>$$</xsl:text>
-  <xsl:value-of select="alt"/>
+  <xsl:value-of select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
   <xsl:text>$$ &#xA;</xsl:text>
   <xsl:text>\vfill\eject &#xA;</xsl:text>
 </xsl:template>
 <xsl:template match="inlineequation" mode="collect.tex.math.latex">
   <xsl:variable name="filename">
     <xsl:choose>
-      <xsl:when test="inlinegraphic">
+      <xsl:when test="graphic">
         <xsl:call-template name="mediaobject.filename">
-          <xsl:with-param name="object" select="inlinegraphic"/>
+          <xsl:with-param name="object" select="graphic"/>
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
   <xsl:value-of select="$filename"/>
   <xsl:text>} &#xA;</xsl:text>
   <xsl:text>$</xsl:text>
-  <xsl:value-of select="alt"/>
+  <xsl:value-of select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
   <xsl:text>$ &#xA;</xsl:text>
   <xsl:text>\newpage &#xA;</xsl:text>
 </xsl:template>
   <xsl:value-of select="$filename"/>
   <xsl:text>} &#xA;</xsl:text>
   <xsl:text>$$</xsl:text>
-  <xsl:value-of select="alt"/>
+  <xsl:value-of select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
   <xsl:text>$$ &#xA;</xsl:text>
   <xsl:text>\newpage &#xA;</xsl:text>
 </xsl:template>
index 8b2baa5d45c3398d15b376e532c103b281cb2c26..9bfd7e642d220eebc27102cf24d2f097f6c45fd6 100644 (file)
 
 <refsect1><title>Description</title>
 
-<para>If you want type math directly in TeX notation into
-<sgmltag>alt</sgmltag> element, this parameter specifies notation
-used. Currently are supported two values --
-<literal>plain</literal> and <literal>latex</literal>. Empty value
-means that you are not using TeX math.</para>
+<para>If you want type math directly in TeX notation in equations,
+this parameter specifies notation used. Currently are supported two
+values -- <literal>plain</literal> and <literal>latex</literal>. Empty
+value means that you are not using TeX math at all.</para>
+
+<para>Preferred way for including TeX alternative of math is inside of
+<sgmltag>textobject</sgmltag> element. Eg.:</para>
+
+<programlisting><![CDATA[<inlineequation>
+<inlinemediaobject>
+<imageobject>
+<imagedata fileref="eq1.gif"/>
+</imageobject>
+<textobject><phrase>E=mc squared</phrase></textobject>
+<textobject role="tex"><phrase>E=mc^2</phrase></textobject>
+</inlinemediaobject>
+</inlineequation>]]></programlisting>
+
+<para>If you are using <sgmltag>graphic</sgmltag> element, you can
+store TeX inside <sgmltag>alt</sgmltag> element:</para>
+
+<programlisting><![CDATA[<inlineequation>
+<alt role="tex">a^2+b^2=c^2</alt>
+<graphic fileref="a2b2c2.gif"/>  
+</inlineequation>]]></programlisting>
 
 <para>If you want use this feature, you should process your FO with
 PassiveTeX, which only supports TeX math notation. When calling