<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 -->
<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/>
</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>
</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>
</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.
<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">
<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>
<xsl:value-of select="$filename"/>
<xsl:text>} 
</xsl:text>
<xsl:text>$</xsl:text>
- <xsl:value-of select="alt"/>
+ <xsl:value-of select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
<xsl:text>$ 
</xsl:text>
<xsl:text>\vfill\eject 
</xsl:text>
</xsl:template>
<xsl:value-of select="$filename"/>
<xsl:text>} 
</xsl:text>
<xsl:text>$$</xsl:text>
- <xsl:value-of select="alt"/>
+ <xsl:value-of select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
<xsl:text>$$ 
</xsl:text>
<xsl:text>\vfill\eject 
</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>} 
</xsl:text>
<xsl:text>$</xsl:text>
- <xsl:value-of select="alt"/>
+ <xsl:value-of select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']"/>
<xsl:text>$ 
</xsl:text>
<xsl:text>\newpage 
</xsl:text>
</xsl:template>
<xsl:value-of select="$filename"/>
<xsl:text>} 
</xsl:text>
<xsl:text>$$</xsl:text>
- <xsl:value-of select="alt"/>
+ <xsl:value-of select="alt[@role='tex'] | mediaobject/textobject[@role='tex']"/>
<xsl:text>$$ 
</xsl:text>
<xsl:text>\newpage 
</xsl:text>
</xsl:template>
<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