1 <?xml version='1.0' encoding='utf-8'?>
3 <!-- XHTML-to-Memoir converter by Fletcher Penney
4 specifically designed for use with MultiMarkdown created XHTML
6 Uses the LaTeX memoir class for output
8 The first page can include letterhead graphic elements (e.g. logo)
10 It is simplified from the full memoir version, removing items
11 not likely to be included in a letter or simple document
13 *Requires that you use the mmd-letterhead style package for LaTeX,
14 which is available at http://fletcherpenney.net/XSLT_Files*
16 MultiMarkdown Version 2.0.b5
18 $Id: letterhead.xslt 479 2008-01-12 23:04:13Z fletcher $
22 # Copyright (C) 2007-2008 Fletcher T. Penney <fletcher@fletcherpenney.net>
24 # This program is free software; you can redistribute it and/or modify
25 # it under the terms of the GNU General Public License as published by
26 # the Free Software Foundation; either version 2 of the License, or
27 # (at your option) any later version.
29 # This program is distributed in the hope that it will be useful,
30 # but WITHOUT ANY WARRANTY; without even the implied warranty of
31 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 # GNU General Public License for more details.
34 # You should have received a copy of the GNU General Public License
35 # along with this program; if not, write to the
36 # Free Software Foundation, Inc.
37 # 59 Temple Place, Suite 330
38 # Boston, MA 02111-1307 USA
43 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
44 xmlns:html="http://www.w3.org/1999/xhtml"
47 <xsl:import href="memoir.xslt"/>
49 <xsl:output method='text' encoding='utf-8'/>
51 <xsl:strip-space elements="*" />
53 <xsl:template match="/">
54 <xsl:apply-templates select="html:html/html:head"/>
55 <xsl:apply-templates select="html:html/html:body"/>
56 <xsl:call-template name="latex-footer"/>
59 <!-- rely on the mmd-letterhead style to set up paper size -->
60 <xsl:template name="latex-paper-size">
63 <xsl:template name="latex-document-class">
64 <xsl:text>\documentclass[oneside,article]{memoir}
65 \usepackage{layouts}[2001/04/29]
71 <xsl:template name="latex-header">
72 <xsl:text>\usepackage{fancyvrb} % Allow \verbatim et al. in footnotes
73 \usepackage{graphicx} % To include graphics in pdf's (jpg, gif, png, etc)
74 \usepackage{booktabs} % Better tables
75 \usepackage{tabulary} % Support longer table cells
76 \usepackage[utf8]{inputenc} % For UTF-8 support
77 \usepackage{xcolor} % Allow for color (annotations)
79 %\geometry{landscape} % Activate for rotated page geometry
81 %\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty
82 % line rather than an indent
85 \def\myauthor{Author} % In case these were not included in metadata
88 \def\mybibliostyle{plain}
96 <xsl:template name="latex-intro">
103 %\ifpdf % Removed for XeLaTeX compatibility
104 % \pdfoutput=1 % Removed for XeLaTeX compatibility
110 pdfauthor={\myauthor},
111 pdfkeywords={\mykeywords}
113 \usepackage{memhfixc}
114 %\fi % Removed for XeLaTeX compatibility
116 \ifx\recipient\undefined
118 \addtodef{\myrecipient}{}{\recipient \\}
121 \ifx\recipientaddress\undefined
123 \addtodef{\myrecipient}{}{\recipientaddress}
126 \ifx\mydate\undefined
133 <xsl:template name="return-address">
134 <xsl:call-template name="return-address-defaults"/>
135 <xsl:text>% Create return address
136 \def\returnaddress{\raggedleft
138 \renewcommand{\baselinestretch}{1.1}
140 \textbf{\myauthor} \\}
142 \ifx\position\undefined
143 \addtodef{\returnaddress}{}{\textit{\defaultposition}}
145 \addtodef{\returnaddress}{}{\textit{\position} \\}
149 \addtodef{\returnaddress}{}{\textit{\defaultemail}
155 \addtodef{\returnaddress}{}{\textit{\email}
162 \ifx\department\undefined
163 \addtodef{\returnaddress}{}{\textbf{\defaultdepartment}}
165 \addtodef{\returnaddress}{}{\textbf{\department} \\}
168 \ifx\address\undefined
169 \addtodef{\returnaddress}{}{\defaultaddress}
171 \addtodef{\returnaddress}{}{\address \\}
175 \addtodef{\returnaddress}{}{\defaultphone}
177 \addtodef{\returnaddress}{}{Tel \phone \\}
182 \addtodef{\returnaddress}{}{\defaultfax}
184 \addtodef{\returnaddress}{}{Fax \fax \\}
188 \addtodef{\returnaddress}{}{\defaultweb
191 \addtodef{\returnaddress}{}{ \web \\
197 <xsl:template name="return-address-defaults">
198 <xsl:text>% Default info for return address
199 % These should include '\\' where appropriate for line endings
202 \def\defaultposition{}
203 \def\defaultdepartment{}
204 \def\defaultaddress{}
209 % Define height for logo and return address
210 \def\logoheight{1.5in}
212 % Define Logo or something for upper left corner
216 \ifx\signature\undefined
217 \def\signature{~ \\ Sincerely, \\
226 <xsl:template name="latex-begin-body">
227 <xsl:call-template name="return-address"/>
228 <xsl:text>\usepackage{mmd-letterhead}
232 \setlength{\parindent}{0pt}
236 % Use coverpage style
237 \thispagestyle{letterhead-cover}
239 % Insert return address
242 \begin{adjustwidth}{-0.5in}{-0.5in}
243 \begin{minipage}[l][\logoheight]{4in}
248 \begin{minipage}[r][\logoheight]{2in}
249 {\renewcommand{\baselinestretch}{1.1}
250 \color{returnaddress}\returnaddress}
257 \pagestyle{letterhead}
259 % Return to main settings
261 \renewcommand{\baselinestretch}{1.2}
262 \setlength{\parskip}{12pt}
273 <xsl:template name="latex-title">
276 <xsl:template name="latex-copyright">
279 <xsl:template name="latex-footer">
290 \bibliographystyle{\mybibliostyle}