Newer
Older
XML / modules / latex.xml
<?xml version="1.0" encoding="utf-8"?>

<!--
	LaTeX-specific items.
-->

<stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


	<!--
		Environment setup. This enables you to define environment settings (e.g., required LaTeX packages, etc.). We normally explicitly call the sub-elements within this, so this template is empty to prevent unwanted stuff accidentally being included in the output.
	-->
	<template name="environment" match="environment" />
	

	<!--
		Load a LaTeX package.
		
		@options: Any arguments to the package. [optional]
	-->
	<template name="latex-package" match="latex-packages/package">
		<common formats="/latex/xelatex/">
			<xsl:text>\usepackage</xsl:text>
			<xsl:if test="@options">
				<xsl:text>[</xsl:text>
				<xsl:value-of select="@options" />
				<xsl:text>]</xsl:text>
			</xsl:if>
			<xsl:text>{</xsl:text>
			<xsl:value-of select="." />
			<xsl:text>}</xsl:text>
			<xsl:call-template name="newline-internal" />
		</common>
	</template>
	
		
	<!--
		Execute a preamble LaTeX command. Use to set up things like counters, fonts, hyperref options, etc.
	-->
	<template name="latex-command" match="latex-commands/command">
		<common formats="/latex/xelatex/">
			<xsl:value-of select="." />
			<xsl:call-template name="newline-internal" />
		</common>
	</template>
	
	
	<!-- LaTeX hyphenation. A space-delimited list of hyphenated words. -->
	<template name="latex-hyphenation" match="latex-commands/hyphenation">
		<common formats="/latex/xelatex/">
			<xsl:text>\hyphenation{</xsl:text>
			<xsl:value-of select="." />
			<xsl:text>}</xsl:text>
			<xsl:call-template name="newline-internal" />
		</common>
	</template>
	

	<!--
		Specify LaTeX document class and options. The master stylesheet specifies \documentclass[a4paper,12pt]{article}. Anything you specify here will override that completely, so be sure to set a4paper and 12pt if that's what you want.
		
		@options: The required document class options. [optional]
	-->
	<!--
		Hmm, this may be more complex than I thought... External environment files sort of stuff it up. Perhaps LaTeX document class stuff should be in attributes of the document element?
	-->
	<template name="latex-documentclass" match="latex-documentclass|documentclass">
		<common formats="/latex/xelatex/">
			<xsl:text>\documentclass[</xsl:text>
			<xsl:value-of select="@options" />
			<xsl:text>]{</xsl:text>
			<xsl:value-of select="." />
			<xsl:text>}</xsl:text>
			<xsl:call-template name="newline-internal" />
		</common>
	</template>
	
	<!-- Durr, this is identical to the previous one??? -->
	<template name="latex-documentclass-options" match="latex-documentclass[@options]|documentclass[@options]">
		<common formats="/latex/xelatex/">
			<xsl:text>\documentclass[</xsl:text>
			<xsl:value-of select="@options" />
			<xsl:text>]{</xsl:text>
			<xsl:value-of select="." />
			<xsl:text>}</xsl:text>
			<xsl:call-template name="newline-internal" />
		</common>
	</template>
	
	<!--
		Specify additional LaTeX document class options (i.e., in addition to the defaults). These should be a comma-separated list of the required options. These will be appended to the standard defaults (a4paper, 12pt).
	-->
	<template name="latex-document-options" match="latex-document-options">
		<common formats="/latex/xelatex/">
			<xsl:apply-templates />
		</common>
	</template>


</stylesheet>