From cbd09ffecddff833dd11ee5b0fc943648c19d978 Mon Sep 17 00:00:00 2001
From: Jonathan Kew <jfkthame@googlemail.com>
Date: Fri, 15 Sep 2006 16:15:38 +0000
Subject: moved source and doc for fontspec and xltxtra to xelatex directory

git-svn-id: svn://tug.org/texlive/trunk@2133 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/source/xelatex/xltxtra/xltxtra.dtx  | 523 +++++++++++++++++++++
 1 file changed, 523 insertions(+)
 create mode 100644 Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx

(limited to 'Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx')

diff --git a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx
new file mode 100644
index 00000000000..4c2f0f44b2e
--- /dev/null
+++ b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx
@@ -0,0 +1,523 @@
+% \iffalse
+%
+%!TEX encoding = UTF-8 Unicode
+%
+% Copyright (C) 2006 by Will Robertson <wspr81@gmail.com>
+% 
+% Distributable under the LaTeX Project Public License,
+% version 1.3b or higher (your choice). The latest version of
+% this license is at: http://www.latex-project.org/lppl.txt
+%
+% This work is "maintained" (as per LPPL maintenance status) 
+% by Will Robertson.
+% 
+% This work consists of the file  xltxtra.dtx
+%           and the derived files xltxtra.sty and xltxtra.pdf.
+%
+%
+%<*batchfile>
+\begingroup
+\input docstrip.tex
+\keepsilent
+\preamble
+
+  ____________________________
+  The xltxtra package         
+  (C) 2006  Will Robertson    
+  License information appended
+
+
+\endpreamble
+\postamble
+
+Copyright (C) 2006 by Will Robertson <wspr81@gmail.com>
+
+Distributable under the LaTeX Project Public License,
+version 1.3b or higher (your choice). The latest version of
+this license is at: http://www.latex-project.org/lppl.txt
+
+This work is "maintained" (as per LPPL maintenance status) 
+by Will Robertson.
+
+This work consists of the file  \jobname.dtx
+          and the derived files \jobname.sty and \jobname.pdf.
+
+\endpostamble
+\askforoverwritefalse
+\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
+\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
+\nopreamble\nopostamble
+\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
+\generate{\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}}
+\endgroup
+%</batchfile>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+%\OnlyDescription
+\usepackage{dtx-style}
+\begin{document}
+  \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+%
+%<*readme>
+------------------------
+THE XLTXTRA PACKAGE v0.1
+
+This package provides a few small features that 
+are useful for XeLaTeX.
+
+It loads the fixltx2e and etex packages, and
+patches a couple of other LaTeX commands: \-
+for discretionary hyphenation with variable
+hyphenation characters, and \textsuperscript/
+\textsubscript that use the fontspec to access
+real superior/inferior characters. It also
+provides a parameterised logos for \TeX, 
+\LaTeX and \XeTeX.
+
+--------------
+Will Robertson
+2006
+%</readme>
+%
+% \fi
+%
+% \errorcontextlines=999
+% \makeatletter
+%
+% \GetFileInfo{\jobname.sty}
+%
+% \title{The \pkg{xltxtra} package}
+% \author{Will Robertson}
+% \date{\filedate \qquad \fileversion}
+%
+% \maketitle
+% \tableofcontents
+%
+% \section{Introduction}
+%
+% This document describes the \pkg{xltxtra} package. It implements in general
+% improved functionality for broken or sub-standard \LaTeX\ methods when using the
+% \XeTeX\ format.
+%
+% Documentation is slim, since new features per se are slim.
+%
+% \part{The \textsf{xltxtra} package}
+%\iffalse
+%<*package>
+%\fi
+% This is the package.
+%    \begin{macrocode}
+\unless\ifdefined\XeTeXversion
+  \@latex@error{^^J
+   *************************************************^^J
+   *** The xltxtra package only works with XeTeX ***^^J
+   *************************************************}
+\fi
+\ProvidesPackage{xltxtra}
+  [2006/06/08 v0.1 Improvements for the XeTeX/LaTeX format]  
+%    \end{macrocode}
+%
+% \section{Logos}
+% The various \TeX-like logos that extend outside the regular
+% vertical alphabetic bounds of running text have the unfortunate
+% side-effects in \XeTeX\ of often overrunning the \cmd\baselineskip.
+% Putting the logos in zero-height boxes prevents this problem.
+%
+% We also provide a \cmd\XeTeX\ logo for convenience. Thanks, Jonathan.
+%
+% \begin{example}
+%   \TeX\ \XeTeX\ \LaTeX \\ % the default
+%   \TeXlogospacing{-0.1em}{-0.1em}{0.8ex}{-0.36em}{-0.15em}
+%   \TeX\ \XeTeX\ \LaTeX \\
+%   \TeXlogospacing{0em}{0em}{0ex}{-0.36em}{-0.15em}
+%   \TeX\ \XeTeX\ \LaTeX
+% \end{example}
+%
+% To do: adapt \cmd\LaTeX\ to
+% use small caps if possible.
+% Add other logos.
+%
+% To do: Provide for per-font parameters and define
+%  some font-specific parameters.
+%
+% \begin{macro}{\TeXlogospacing}
+% \darg{Kern between T \& E}
+% \darg{Kern between E \& X}
+% \darg{Lowering amount for E}
+% \darg{Kerning between L \& A}
+% \darg{Kerning between A \& TeX}
+% This macro defines new \cmd\TeX\ and \cmd\XeTeX\ logos.
+% Parameters must be tuned on a per-font basis.
+% \emph{Warning!} This macro will almost certainly change in the future.
+%    \begin{macrocode}
+\newcommand*\TeXlogospacing[5]{%
+  \DeclareRobustCommand\TeX{%
+    \leavevmode
+    \smash{%
+      T\kern#1
+      \lower#3\hbox{E}\kern#2 X}%
+    \spacefactor1000\relax}
+  \DeclareRobustCommand{\LaTeX}{%
+    \leavevmode
+    \smash{
+    L\kern#4% 
+    {\sbox\z@ T% 
+      \vbox to\ht\z@{\hbox{\check@mathfonts 
+        \fontsize\sf@size\z@ 
+        \math@fontsfalse\selectfont 
+        A}% 
+      \vss}% 
+    }% 
+    \kern#5% 
+    \TeX}}  
+  \DeclareRobustCommand\XeTeX{%
+    \leavevmode
+    \smash{%
+     X\lower #3
+     \hbox{\kern #2
+       \ifnum\XeTeXcharglyph"018E > 0
+         \char"018E\relax
+       \else\ifdim\fontdimen1\font=0pt
+         \reflectbox{E}%
+       \else % rotation is about the origin, so we need to adjust positioning
+         \XeTeXuseglyphmetrics=1%
+         \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0%
+         \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
+       \fi\fi
+     }\kern#1\TeX}}}
+\TeXlogospacing{-0.15em}{-0.15em}{0.5ex}{-0.36em}{-0.15em}
+%    \end{macrocode}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+%
+% \section{\eTeX\ functionality}
+% Because it's just sensible, we load the package that actually
+% allows \LaTeX\ to access the extra registers, etc., provided
+% by \eTeX.
+%    \begin{macrocode}
+\RequirePackage{etex}
+%    \end{macrocode}
+%
+% \section{Unicode footnote symbols}
+% \LaTeX\ defines footnote symbols with LICRs that don't resolve well 
+% with the \pkg{xunicode} package; better results can be achieved by
+% using specific unicode characters.
+%
+% This problem is solved by the \pkg{fixltx2e} package.
+%    \begin{macrocode}
+\RequirePackage{fixltx2e}[2006/03/24]
+%    \end{macrocode}
+%
+% \section{Programmming bits and pieces}
+%
+% Thanks to a long-ago c.t.t.\ post by Robin Fairbairns for the code how to \cmd\let\ a robust macro.
+%    \begin{macrocode}
+\newcommand*\robust@let@nc[2]{%
+  \expandafter\let\expandafter#1\csname #2 \endcsname}
+%    \end{macrocode}
+%
+% \section{\cmd\-}
+% \LaTeX\ defines the macro \cmd\-\ to insert discretionary hyphenation points.
+% However, it is hard-coded to use the hyphen |-| character. Since \pkg{fontspec}
+% makes it easy to change the hyphenation character on a per font basis, it would
+% be nice if \cmd\-\ adjusted automatically.
+%
+% \begin{macro}{\-}
+% This macro is courtesy of Frank Mittelbach and the \LaTeXe\ source code.
+%    \begin{macrocode}
+%\CheckCommand\-{\discretionary{-}{}{}}
+\DeclareRobustCommand{\-}{%
+  \discretionary{%
+    \char\ifnum\hyphenchar\font<\z@
+           \xlx@defaulthyphenchar
+         \else
+           \hyphenchar\font
+         \fi}{}{}}
+\def\xlx@defaulthyphenchar{`\-}
+%    \end{macrocode}
+% \changes{v0.1}{2006/05/03}{Implemented; from the \LaTeXe\ sources.}
+% \end{macro}
+%
+% \section{\cmd\textsuperscript\ and \cmd\textsubscript}
+%
+% The new macros now allow real text inferiors and superiors:
+% \begin{quotation}
+%	\fontspec{Hoefler Text}
+%	  |\textsuperscript     | \textsuperscript{abcdefghijklmnopqrstuvwxyz1234567890}\par
+%	  |\textsubscript       | \textsubscript{abcdefghijklmnopqrstuvwxyz1234567890}
+% \end{quotation}
+% As opposed to fake ones:
+% \begin{quotation}
+%	\fontspec{Hoefler Text}
+%	  |\textsuperscript*    | \textsuperscript*{abcdefghijklmnopqrstuvwxyz1234567890}\par
+%	  |\textsubscript*      | \textsubscript*{abcdefghijklmnopqrstuvwxyz1234567890}
+% \end{quotation}
+% Or:
+% \begin{quotation}
+%	\fontspec{Hoefler Text}
+%	  |\faketextsuperscript | \textsuperscript*{abcdefghijklmnopqrstuvwxyz1234567890}\par
+%	  |\faketextsubscript   | \textsubscript*{abcdefghijklmnopqrstuvwxyz1234567890}
+% \end{quotation}
+% But beware fonts lacking the full repertoire: (this is Adobe Jenson Pro)
+% \begin{quotation}
+%	\fontspec{Adobe Jenson Pro}
+%	  |\textsuperscript     | \textsuperscript{abcdefghijklmnopqrstuvwxyz1234567890}\par
+%	  |\textsubscript       | \textsubscript{abcdefghijklmnopqrstuvwxyz1234567890}
+% \end{quotation}
+%
+% For OpenType fonts, the subscript feature (|subs|) is used, but if that doesn't
+% exist then the scientific inferior feature (|sinf|) is used on the assumption
+% that something's better than nothing. This assumption may prove to be a poor one,
+% and the functionality of the package may change in the future.
+%
+% \begin{macro}{\faketextsubscript}
+% \begin{macro}{\faketextsuperscript}
+% The old (`fake') methods:
+%    \begin{macrocode}
+\robust@let@nc\faketextsubscript{textsubscript} 
+\robust@let@nc\faketextsuperscript{textsuperscript} 
+%    \end{macrocode}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+% \begin{macro}{\textsubscript}
+% \begin{macro}{\textsubscript*}
+% Text subscripts:
+%    \begin{macrocode}
+\DeclareRobustCommand*\textsubscript{%
+  \@ifstar{\faketextsubscript}{\@@textsubscript}}
+\newcommand\@@textsubscript[1]{%
+  \begingroup
+    \c@zf@script 1818326126\relax
+    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
+    \zf@set@font@type
+    \ifzf@atsui
+      \zf@make@aat@feature@string{10}{2}%
+      \unless\ifx\zf@thisfontfeature\@empty
+        {\addfontfeature{VerticalPosition=Inferior}#1}%
+      \else
+        \faketextsubscript{#1}%
+      \fi
+    \fi
+    \ifzf@icu
+      \zf@check@ot@feat{+subs}%
+      \if@tempswa
+        {\addfontfeature{VerticalPosition=Inferior}#1}%
+      \else
+        \zf@check@ot@feat{+sinf}%
+        \if@tempswa
+          {\addfontfeature{VerticalPosition=ScientificInferior}#1}%
+        \else
+          \faketextsubscript{#1}%
+        \fi
+      \fi
+    \fi
+  \endgroup}
+%    \end{macrocode}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+% \begin{macro}{\textsuperscript}
+% \begin{macro}{\textsuperscript*}
+% Text superscripts:
+%    \begin{macrocode}
+\DeclareRobustCommand*\textsuperscript{%
+  \@ifstar{\faketextsuperscript}{\@@textsuperscript}}
+\newcommand\@@textsuperscript[1]{%
+  \begingroup
+    \c@zf@script 1818326126\relax
+    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
+    \zf@set@font@type
+    \ifzf@atsui
+      \zf@make@aat@feature@string{10}{1}%
+      \unless\ifx\zf@thisfontfeature\@empty
+        {\addfontfeature{VerticalPosition=Superior}#1}%
+      \else
+        \faketextsuperscript{#1}%
+      \fi
+    \fi
+    \ifzf@icu
+      \zf@check@ot@feat{+sups}%
+      \if@tempswa
+        {\addfontfeature{VerticalPosition=Superior}#1}%
+      \else
+        \faketextsuperscript{#1}%
+      \fi
+    \fi
+  \endgroup}
+%    \end{macrocode}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+%
+% \section{\cmd\vfrac}
+% A command for setting vulgar fractions based on AAT or OpenType font features. 
+% Not really recommended for many purposes, but it's a good example.
+% \begin{example}
+%   \fontspec{Hoefler Text}
+%   AAT: \vfrac{123}{456}\par
+%   \fontspec{Warnock Pro}
+%   ICU: \vfrac{123}{456}
+% \end{example}
+% \begin{macro}{\vfrac}
+% \darg{Numerator}
+% \darg{Denominator}
+% No error checking is done to ensure that the font actually has the neceessary features.
+% Requires the \pkg{xunicode} package for \cmd\textfractionsolidus.
+%    \begin{macrocode}
+\newcommand*\vfrac[2]{%
+  \begingroup
+    \c@zf@script 1818326126\relax
+    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
+    \zf@set@font@type
+    \ifzf@atsui
+      {\addfontfeature{VerticalPosition=Superior}#1}%
+       \textfractionsolidus
+      {\addfontfeature{VerticalPosition=Inferior}#2}%
+    \fi
+    \ifzf@icu
+      {\addfontfeature{VerticalPosition=Numerator}#1}%
+       \textfractionsolidus
+      {\addfontfeature{VerticalPosition=Denominator}#2}%      
+    \fi
+  \endgroup}
+%    \end{macrocode}
+% \changes{v0.1}{2006/05/03}{Implemented.}
+% \end{macro}
+%
+%
+%\iffalse
+%</package>
+%\fi
+%
+% \clearpage
+% \PrintChanges
+%
+% \clearpage
+% \PrintIndex
+%
+% \Finale
+%
+%\iffalse
+%<*dtx-style>
+%    \begin{macrocode}
+\ProvidesPackage{dtx-style}
+
+\def\@dotsep{1000}
+\setcounter{tocdepth}{2}
+\setlength\columnseprule{0.4pt}
+\renewcommand\tableofcontents{\relax
+  \begin{multicols}{2}[\section*{\contentsname}]\relax
+    \@starttoc{toc}\relax
+  \end{multicols}}
+
+\setcounter{IndexColumns}{2}
+\renewenvironment{theglossary}
+  {\small\list{}{}
+     \item\relax
+     \glossary@prologue\GlossaryParms 
+     \let\item\@idxitem \ignorespaces 
+     \def\pfill{\hspace*{\fill}}}
+  {\endlist}
+
+\usepackage{array,booktabs,calc,color,fancyvrb,graphicx,ifthen,longtable,refstyle,varioref}
+\usepackage{fontspec,xunicode,xltxtra}
+\setromanfont[WordSpace=0.9,Mapping=tex-text,
+  BoldFont=Hoefler Text,
+  ItalicFeatures={Contextuals={NoWordFinal,NoLineFinal}}]{Hoefler Text}
+\setsansfont[Scale=MatchLowercase,Mapping=tex-text,BoldFont=Gill Sans]{Gill Sans}
+\setmonofont[Scale=MatchLowercase]{Andale Mono}
+
+\linespread{1.05}      % A bit more space between lines
+\frenchspacing         % Remove ugly extra space after punctuation
+  
+\definecolor{niceblue}{rgb}{0.2,0.4,0.6}
+\newenvironment{example}
+  {\VerbatimEnvironment
+   \par\noindent\hrulefill\nobreak\par\nobreak
+   \begin{VerbatimOut}[gobble=4]{\examplefilename}}
+  {\end{VerbatimOut}\relax
+   \begingroup
+     \color{niceblue}
+     \typesetexample
+   \endgroup\nobreak\par\nobreak\noindent\hrulefill}
+
+\let\examplesize\normalsize
+\let\auxwidth\relax
+
+\newlength\examplewidth\newlength\verbatimwidth
+\newlength\exoutdent   \newlength\exverbgap
+\setlength\exverbgap{0em}
+\setlength\exoutdent{-0\textwidth}
+\newsavebox\verbatimbox
+\edef\examplefilename{\jobname.example}
+
+\newcommand\typesetexample{\relax
+   \begin{lrbox}{\verbatimbox}\relax
+     \BVerbatimInput[fontsize=\small]{\examplefilename}\relax
+   \end{lrbox}
+   \begin{list}{}{\setlength\itemindent{0pt}
+                  \setlength\leftmargin\exoutdent
+                  \setlength\rightmargin{0pt}}\item
+   \ifx\auxwidth\relax
+     \setlength\verbatimwidth{\wd\verbatimbox}\relax
+   \else
+     \setlength\verbatimwidth{\auxwidth}\relax
+   \fi
+   \begin{minipage}[c]{\textwidth-\exoutdent-\verbatimwidth-\exverbgap}
+     \catcode`\%=14\centering\examplesize\input\examplefilename\relax
+   \end{minipage}\hfill
+   \begin{minipage}[c]{\verbatimwidth}
+     \usebox\verbatimbox
+   \end{minipage}
+   \end{list}
+   \global\let\examplesize\normalsize}
+
+\newcommand*\setexsize[1]{\let\examplesize#1}
+\newcommand*\setverbwidth[1]{\def\auxwidth{#1}}
+
+\newcommand*\name[1]{{#1}}
+\newcommand*\pkg[1]{\textsf{#1}}
+
+\newcommand*\note[1]{\unskip\footnote{#1}}
+
+\let\latin\textit
+\def\eg{\latin{e.g.}}
+\def\Eg{\latin{E.g.}}
+\def\ie{\latin{i.e.}}
+\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}}
+
+\def\OMEGA{Ω}
+
+\newcounter{argument}
+\g@addto@macro\endmacro{\setcounter{argument}{0}}
+\newcommand*\darg[1]{%
+  \stepcounter{argument}%
+  \noindent{\ttfamily\#\theargument}:~#1\par\nobreak}
+\newcommand*\doarg[1]{%
+  \stepcounter{argument}%
+  \noindent{\ttfamily\makebox[0pt][r]{[}\#\theargument]}:~#1\par\nobreak}
+%    \end{macrocode}
+%</dtx-style>
+%\fi
+%
+% \typeout{*************************************************************}
+% \typeout{*}
+% \typeout{* To finish the installation you have to move the following}
+% \typeout{* file into a directory searched by XeTeX:}
+% \typeout{*}
+% \typeout{* \space\space\space xltxtra.sty}
+% \typeout{*}
+% \typeout{*************************************************************}
+%
+\endinput
+ 
\ No newline at end of file
-- 
cgit v1.2.3

