目次

概要

括弧の表示。 (a), {a}, <a>, [a], |a|, ||a|| など、全て bracket にまとめました。 (短縮形 bra) (type: paren (round), brace (curl), angle, square(sq), abs, norm, ceil, floor)

利用方法

<bracket size="括弧の大きさ" type="type">括弧内の式</bracket>

サンプル

<bracket>x</bracket> = <inv>N</inv><Sigma><sub>i</sub><sup>N</sup></Sigma>x<sub>i</sub>
x =
1
N
N
i
xi

XSL template

<xsl:template match="ufcpp:math//ufcpp:bracket|ufcpp:math//ufcpp:bra|ufcpp:Math//ufcpp:bracket|ufcpp:Math//ufcpp:bra">
<xsl:variable name="t"><xsl:choose><xsl:when test="@type != ''"><xsl:value-of select="@type"/></xsl:when><xsl:otherwise><xsl:value-of select="@t"/></xsl:otherwise></xsl:choose></xsl:variable>

<xsl:variable name="l">
 <xsl:choose>
  <xsl:when test="$t = 'p'">(</xsl:when>
  <xsl:when test="$t = 'paren'">(</xsl:when>
  <xsl:when test="$t = 'r'">(</xsl:when>
  <xsl:when test="$t = 'round'">(</xsl:when>
  <xsl:when test="$t = 'c'">{</xsl:when>
  <xsl:when test="$t = 'curl'">{</xsl:when>
  <xsl:when test="$t = 'b'">{</xsl:when>
  <xsl:when test="$t = 'brace'">{</xsl:when>
  <xsl:when test="$t = 'angle'">&#9001;</xsl:when>
  <xsl:when test="$t = 'square'">[</xsl:when>
  <xsl:when test="$t = 'sq'">[</xsl:when>
  <xsl:when test="$t = 'abs'">|</xsl:when>
  <xsl:when test="$t = 'norm'">||</xsl:when>
  <xsl:when test="$t = 'ceil'">&#8968;</xsl:when>
  <xsl:when test="$t = 'floor'">&#8970;</xsl:when>
  <xsl:otherwise>&#9001;</xsl:otherwise>
 </xsl:choose>
</xsl:variable>

<xsl:variable name="r">
 <xsl:choose>
  <xsl:when test="$t = 'p'">)</xsl:when>
  <xsl:when test="$t = 'paren'">)</xsl:when>
  <xsl:when test="$t = 'r'">)</xsl:when>
  <xsl:when test="$t = 'round'">)</xsl:when>
  <xsl:when test="$t = 'c'">}</xsl:when>
  <xsl:when test="$t = 'curl'">}</xsl:when>
  <xsl:when test="$t = 'b'">}</xsl:when>
  <xsl:when test="$t = 'brace'">}</xsl:when>
  <xsl:when test="$t = 'angle'">&#9002;</xsl:when>
  <xsl:when test="$t = 'square'">]</xsl:when>
  <xsl:when test="$t = 'sq'">]</xsl:when>
  <xsl:when test="$t = 'abs'">|</xsl:when>
  <xsl:when test="$t = 'norm'">||</xsl:when>
  <xsl:when test="$t = 'ceil'">&#8969;</xsl:when>
  <xsl:when test="$t = 'floor'">&#8971;</xsl:when>
  <xsl:otherwise>&#9002;</xsl:otherwise>
 </xsl:choose>
</xsl:variable>

  <span class="paren">
    <xsl:attribute name="style">font-size:<xsl:value-of select="@size"/>em;</xsl:attribute>
    <xsl:value-of select="$l"/>
  </span>
  <xsl:apply-templates/>
  <span class="paren">
    <xsl:attribute name="style">font-size:<xsl:value-of select="@size"/>em;</xsl:attribute>
    <xsl:value-of select="$r"/>
  </span>
</xsl:template>

style sheet

span.paren
{
  font-style:normal;
  vertical-align:middle;
}

更新履歴

ブログ