• Added support for vertical and horizontal positioning (@vertical-position, @horizontal-position).
• Added support for explicit and automatic vertical and horizontal sizing (@width, @height, @fit-width, @fit-height).
• Added ability to disable sideways printing.
1 parent aedebc6 commit d86569b78577847e715e156cef720c58b889efd0
Nigel Stanger authored on 13 Feb 2017
Showing 1 changed file
View
176
modules/paper-calendar.xml
<xsl:param name="num-columns" tunnel="yes" />
<xsl:param name="teaching-period" tunnel="yes" />
</common>
<common formats="/latex/xelatex/">
<xsl:text>\begin{center}</xsl:text>
<xsl:call-template name="newline-internal" />
<xsl:if test="@position-vertical = ('center', 'bottom')">
<xsl:text>\mbox{}\vfill</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
<xsl:if test="@position-horizontal">
<xsl:text>\begin{</xsl:text>
<xsl:value-of select="
if (@position-horizontal = ('left', 'right')) then 'flush{@position-horizontal}'
else if (@position-horizontal eq 'center') then @position-horizontal
else 'flushleft'" />
<xsl:text>}</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
<!--
An explicit @height always takes precedence over @fit-height.
-->
<xsl:variable name="table-height" select ="
if (@height) then @height
else if (@fit-height) then '\textheight'
else '!'" />
<!--
An explicit @width always takes precedence over @fit-width.
-->
<xsl:variable name="table-width" select ="
if (@width) then @width
else if (@fit-width) then '\textwidth'
else '!'" />
<!-- No point resizing if no height or width is specified. -->
<xsl:if test="($table-width ne '!') or ($table-height ne '!')">
<xsl:text>\resizebox*{</xsl:text>
<xsl:value-of select="$table-width" />
<xsl:text>}{</xsl:text>
<xsl:value-of select="$table-height" />
<xsl:text>}{%</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
<!-- TODO: Probably not if standalone! -->
<xsl:text>\begin{sideways}</xsl:text>
<xsl:call-template name="newline-internal" />
<xsl:text>\resizebox{24cm}{!}{%</xsl:text>
<xsl:call-template name="newline-internal" />
<!-- The default is to print sideways. -->
<xsl:if test="not(@sideways) or (@sideways = ('yes', 'y'))">
<xsl:text>\begin{sideways}</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
<xsl:text>\begin{tabular}{|c|c</xsl:text>
<xsl:if test="$section-column > $date-column">
<xsl:text>|c</xsl:text>
</xsl:if>
 
<xsl:text>\end{tabular}%</xsl:text>
<xsl:call-template name="newline-internal" />
<xsl:text>}</xsl:text>
<xsl:call-template name="newline-internal" />
<xsl:text>\end{sideways}</xsl:text>
<xsl:call-template name="newline-internal" />
<xsl:text>\end{center}</xsl:text>
<xsl:call-template name="newline-internal" />
<!--
An explicit @height always takes precedence over @fit-height.
-->
<xsl:variable name="table-height" select ="
if (@height) then @height
else if (@fit-height) then '\textheight'
else '!'" />
<!--
An explicit @width always takes precedence over @fit-width.
-->
<xsl:variable name="table-width" select ="
if (@width) then @width
else if (@fit-width) then '\textwidth'
else '!'" />
<!-- The default is to print sideways. -->
<xsl:if test="not(@sideways) or (@sideways = ('yes', 'y'))">
<xsl:text>\end{sideways}</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
<xsl:if test="($table-width ne '!') or ($table-height ne '!')">
<xsl:text>}</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
<xsl:if test="@position-horizontal">
<xsl:text>\end{</xsl:text>
<xsl:value-of select="
if (@position-horizontal = ('left', 'right')) then 'flush{@position-horizontal}'
else if (@position-horizontal eq 'center') then @position-horizontal
else 'flushleft'" />
<xsl:text>}</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
<xsl:if test="@position-vertical = ('top', 'center')">
<xsl:text>\vfill\mbox{}</xsl:text>
<xsl:call-template name="newline-internal" />
</xsl:if>
</common>
</template>