1 <?xml version='1.0' encoding='utf-8'?>
3 <!-- XHTML-to-Envelope converter by Fletcher Penney
5 specifically designed for use with MultiMarkdown created XHTML
7 Uses the LaTeX memoir class for output
9 Creates an envelope to go along with letterhead
11 *Requires that you use the mmd-envelope style package for LaTeX,
12 which is available at http://fletcherpenney.net/XSLT_Files*
14 MultiMarkdown Version 2.0.b5
16 $Id: envelope.xslt 470 2008-01-06 18:47:18Z fletcher $
20 # Copyright (C) 2005-2008 Fletcher T. Penney <fletcher@fletcherpenney.net>
22 # This program is free software; you can redistribute it and/or modify
23 # it under the terms of the GNU General Public License as published by
24 # the Free Software Foundation; either version 2 of the License, or
25 # (at your option) any later version.
27 # This program is distributed in the hope that it will be useful,
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 # GNU General Public License for more details.
32 # You should have received a copy of the GNU General Public License
33 # along with this program; if not, write to the
34 # Free Software Foundation, Inc.
35 # 59 Temple Place, Suite 330
36 # Boston, MA 02111-1307 USA
41 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
42 xmlns:html="http://www.w3.org/1999/xhtml"
45 <xsl:import href="memoir.xslt"/>
47 <xsl:output method='text' encoding='utf-8'/>
49 <xsl:strip-space elements="*" />
51 <xsl:template match="/">
52 <xsl:apply-templates select="html:html/html:head"/>
53 <xsl:call-template name="latex-footer"/>
56 <!-- rely on the mmd-envelope style to set up paper size -->
57 <xsl:template name="latex-paper-size">
60 <xsl:template name="latex-document-class">
61 <xsl:text>\documentclass[oneside,article]{memoir}
62 \usepackage{layouts}[2001/04/29]
68 <xsl:template name="latex-header">
69 <xsl:text>\usepackage{graphicx} % To include graphics in pdf's (jpg, gif, png, etc)
70 \usepackage[utf8]{inputenc} % For UTF-8 support
71 \usepackage{xcolor} % Allow for color (annotations)
73 \def\myauthor{Author} % In case these were not included in metadata
81 <xsl:template name="latex-intro">
88 %\ifpdf % Removed for XeLaTeX compatibility
89 % \pdfoutput=1 % Removed for XeLaTeX compatibility
95 pdfauthor={\myauthor},
96 pdfkeywords={\mykeywords}
99 %\fi % Removed for XeLaTeX compatibility
101 \ifx\recipient\undefined
103 \addtodef{\myrecipient}{}{\recipient \\}
106 \ifx\recipientaddress\undefined
108 \addtodef{\myrecipient}{}{\recipientaddress}
111 \ifx\mydate\undefined
118 <xsl:template name="return-address">
119 <xsl:call-template name="return-address-defaults"/>
120 <xsl:text>% Create return address
121 \def\returnaddress{\raggedright
123 \renewcommand{\baselinestretch}{1.1}
125 \textbf{\myauthor} \\}
127 \ifx\position\undefined
128 \addtodef{\returnaddress}{}{\textit{\defaultposition}}
130 \addtodef{\returnaddress}{}{\textit{\position} \\}
134 \ifx\department\undefined
135 \addtodef{\returnaddress}{}{\textbf{\defaultdepartment}}
137 \addtodef{\returnaddress}{}{\textbf{\department} \\}
140 \ifx\address\undefined
141 \addtodef{\returnaddress}{}{\defaultaddress}
143 \addtodef{\returnaddress}{}{\address \\}
149 <xsl:template name="return-address-defaults">
150 <xsl:text>% Default info for return address
151 % These should include '\\' where appropriate for line endings
154 \def\defaultposition{}
155 \def\defaultdepartment{}
156 \def\defaultaddress{}
161 % Define height for logo and return address
162 \def\logoheight{1.5in}
164 % Define Logo or something for upper left corner
171 <xsl:template name="latex-begin-body">
172 <xsl:call-template name="return-address"/>
173 <xsl:text>\usepackage{mmd-envelope}
177 \setlength{\parindent}{0pt}
180 \thispagestyle{envelope}
182 % Insert return address
184 {\renewcommand{\baselinestretch}{1.1}
185 \color{returnaddress}\returnaddress}
188 % Return to main settings
191 \renewcommand{\baselinestretch}{1.2}
192 \setlength{\parskip}{12pt}
195 \begin{adjustwidth}{3in}{0in}
202 <xsl:template name="latex-title">
205 <xsl:template name="latex-copyright">
208 <xsl:template name="latex-footer">