summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/xelatex/xltxtra
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2006-12-24 16:19:15 +0000
committerJonathan Kew <jfkthame@googlemail.com>2006-12-24 16:19:15 +0000
commit0835f73e7c7f6a0fd55c5205df5c3593162dfee6 (patch)
tree64ca99f1028bc1343de4c18bc51c2443abf66376 /Master/texmf-dist/source/xelatex/xltxtra
parent3aee4b67dd73b94834676e10b45fcce6fa95fa08 (diff)
euenc, source for fontspec etc
git-svn-id: svn://tug.org/texlive/trunk@2883 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xltxtra')
-rw-r--r--Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx286
-rw-r--r--Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins62
2 files changed, 211 insertions, 137 deletions
diff --git a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx
index 4c2f0f44b2e..0f55ecafe23 100644
--- a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx
+++ b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx
@@ -5,7 +5,7 @@
% 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
+% version 1.3c 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)
@@ -15,8 +15,10 @@
% and the derived files xltxtra.sty and xltxtra.pdf.
%
%
-%<*batchfile>
+%<*internalbatchfile>
\begingroup
+%</internalbatchfile>
+%<*batchfile>
\input docstrip.tex
\keepsilent
\preamble
@@ -33,7 +35,7 @@
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
+version 1.3c 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)
@@ -49,11 +51,14 @@ This work consists of the file \jobname.dtx
\nopreamble\nopostamble
\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
\generate{\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}}
-\endgroup
%</batchfile>
+%<batchfile>\endbatchfile
+%<*internalbatchfile>
+\endgroup
+%</internalbatchfile>
%
%<*driver>
-\documentclass{ltxdoc}
+\documentclass[12pt]{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -66,7 +71,7 @@ This work consists of the file \jobname.dtx
%
%<*readme>
------------------------
-THE XLTXTRA PACKAGE v0.1
+THE XLTXTRA PACKAGE v0.3
This package provides a few small features that
are useful for XeLaTeX.
@@ -105,7 +110,7 @@ Will Robertson
% improved functionality for broken or sub-standard \LaTeX\ methods when using the
% \XeTeX\ format.
%
-% Documentation is slim, since new features per se are slim.
+% Documentation is slim, and a bit ugly at this stage. I intend to improve it at some stage\dots Anyway, look through the sections to see what's contained within.
%
% \part{The \textsf{xltxtra} package}
%\iffalse
@@ -113,87 +118,158 @@ Will Robertson
%\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]
+ [2006/06/13 v0.2 Improvements for the XeTeX/LaTeX format]
+% \end{macrocode}
+%
+% \paragraph{Required packages}
+% \begin{macrocode}
+\RequirePackage{ifxetex}
+\RequireXeTeX
+\RequirePackage{graphicx}
+\RequirePackage{fontspec}
+\RequirePackage{xunicode}
% \end{macrocode}
%
% \section{Logos}
+% \DescribeMacro{\XeTeX}
+% \DescribeMacro{\XeLaTeX}
+% The \TeX-related logos people insist upon using need to be tuned
+% on a per-font basis. This package will (might!) eventually allow this,
+% but for now, it's baby steps. The \XeTeX\ and \XeLaTeX\ logos
+% are provided.
+%
% 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.
+% Actually, this problem doesn't happen anymore.
%
-% We also provide a \cmd\XeTeX\ logo for convenience. Thanks, Jonathan.
-%
+% Here're some examples. The default:
% \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
+% \TeX\ \XeTeX\ \LaTeX\ \XeLaTeX
+% \end{example}
+% Notice it's a bit tight when not using Computer Modern, as here:
+% \begin{example}
+% \usefont{OT1}{cmr}{m}{n}
+% \TeX\ \XeTeX\ \LaTeX\ \XeLaTeX
+% \end{example}
+% This package provides a \emph{non-stable} method of specifying
+% the spacings in these logos. In the future, it will hopefully adjust
+% somewhat automatically.
+%
+% \noindent To do:
+% \begin{itemize}[noitemsep]
+% \item adapt \cmd\LaTeX\ to use small caps if available\dots
+% \item \dots otherwise, need a scaling factor, and maybe a vertical nudge factor
+% \item add other logos
+% \item per-font parameters, with some defaults for common fonts
+% \item add `low contrast' small caps versions, et al.
+% \item probably break out the whole thing into its own package, if it works
+% \end{itemize}
+%
+% \begin{macro}{\TeX@logo@spacing}
+% \darg{Kern between T \& eX}
+% \darg{Kern between Te \& X}
+% \darg{Lowering amount for E in TeX}
+% \darg{Kerning between L \& aTeX}
+% \darg{Kerning between La \& TeX}
+% \darg{Kerning between Xe \& LaTeX}
+% This macro defines new \cmd\TeX\ and \cmd\XeTeX\ logos.
+% Parameters must be tuned on a per-font basis:
+% \begin{example}
+% \TeX@logo@spacing{-0.12em}{-0.12em}%
+% {0.5ex}{-0.3em}{-0.12em}{-0.1em}
+% \TeX\ \XeTeX\ \LaTeX\ \XeLaTeX
% \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.
+% \emph{Warning!} This macro will {\fontspec{Hoefler Text Black} definitely} change in the future.
+% If you care abouts backwards compatibility in your documents, copy+paste
+% the definitions below rather than using \cmd\TeX@logo@spacing.
%
-% \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
+\newlength\xxt@kern@Te
+\newlength\xxt@kern@eX
+\newlength\xxt@lower@e
+\newlength\xxt@kern@La
+\newlength\xxt@kern@aT
+\newlength\xxt@kern@eL
+\newcommand*\TeX@logo@spacing[6]{%
+ \setlength\xxt@kern@Te{#1}%
+ \setlength\xxt@kern@eX{#2}%
+ \setlength\xxt@lower@e{#3}%
+ \setlength\xxt@kern@La{#4}%
+ \setlength\xxt@kern@aT{#5}%
+ \setlength\xxt@kern@eL{#6}%
+}
+\DeclareRobustCommand\TeX{%
+ \leavevmode
+ \smash{%
+ T\kern\xxt@kern@Te
+ \lower\xxt@lower@e\hbox{E}\kern\xxt@kern@eX X}%
+ \spacefactor1000\relax}
+\DeclareRobustCommand{\LaTeX}{%
+ \leavevmode
+ \smash{%
+ L\kern\xxt@kern@La
+ {\sbox\z@ T%
+ \vbox to\ht\z@{\hbox{\check@mathfonts
+ \fontsize\sf@size\z@
+ \math@fontsfalse\selectfont
+ A}%
+ \vss}%
+ }%
+ \kern\xxt@kern@aT
+ \TeX}}
+\DeclareRobustCommand\XeTeX{%
+ \leavevmode
+ \smash{%
+ X\lower\xxt@lower@e
+ \hbox{\kern\xxt@kern@eX
+ \ifnum\XeTeXfonttype\font>0
+ \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}
+ \else
+ \ifdim\fontdimen1\font=0pt
+ \reflectbox{E}%
+ \else
+ \XeTeXuseglyphmetrics=1%
+ \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0%
+ \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
+ \fi
+ \fi
+ \else
+ \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0%
+ \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
+ \fi
+ }\kern\xxt@kern@Te\TeX}}%
+\DeclareRobustCommand\XeLaTeX{%
+ \leavevmode
+ \smash{%
+ X\lower\xxt@lower@e
+ \hbox{\kern\xxt@kern@eX
+ \ifnum\XeTeXfonttype\font>0\relax
+ \ifnum\XeTeXcharglyph"018E>0\relax
+ \char"018E\relax
+ \else
+ \ifdim\fontdimen1\font=0pt\relax
+ \reflectbox{E}%
+ \else
+ \XeTeXuseglyphmetrics=1\relax
+ \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0\relax
+ \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
+ \fi
+ \fi
+ \else
+ \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0\relax
+ \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
+ \fi}\kern\xxt@kern@eL\LaTeX}}
+\TeX@logo@spacing{-0.15em}{-0.15em}{0.5ex}{-0.36em}{-0.15em}{-0.1em}
% \end{macrocode}
% \changes{v0.1}{2006/05/03}{Implemented.}
+% \changes{v0.2}{2006/06/11}{Added \cmd\XeLaTeX\ logo. Thanks Herb!}
+% \changes{v0.2}{2006/06/11}{Added TFM font check.}
+% \changes{v0.2}{2006/08/12}{\cmd\TeX@logo@spacing made ``private'' and added an arg for \cmd\XeLaTeX.}
% \end{macro}
%
% \section{\eTeX\ functionality}
@@ -214,6 +290,37 @@ Will Robertson
\RequirePackage{fixltx2e}[2006/03/24]
% \end{macrocode}
%
+% \section{\cmd\eminnershape}
+% \begin{macro}{\em}
+% \begin{macro}{\emph}
+% \pkg{fixltx2e}'s method for checking for ``inner'' emphasis is a little fragile in \XeTeX, because
+% font slant information might be missing from the font. Therefore, we use \LaTeX's \acro{NFSS}
+% information, which is more likely to be correct.
+%
+% \begin{example}
+% \renewcommand\eminnershape{\scshape}
+% \fontspec{Didot}
+% Nested {\em emphasis is \emph{now} fixed.}
+% \end{example}
+%
+% \begin{macrocode}
+\DeclareRobustCommand\em
+ {\@nomath\em
+ \edef\@tempa{\f@shape}%
+ \edef\@tempb{\itdefault}%
+ \ifx\@tempa\@tempb
+ \eminnershape
+ \else
+ \emshape
+ \fi}
+\DeclareTextFontCommand{\emph}{\em}
+\let\emshape\itshape
+\let\eminnershape\upshape
+% \end{macrocode}
+% \changes{v0.2}{2006/08/12}{Migrated from \textsf{fontspec}.}
+% \end{macro} \end{macro}
+%
+%
% \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.
@@ -361,7 +468,7 @@ Will Robertson
%
% \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.
+% Not really recommended for many purposes, depending on your text, but it's a good example.
% \begin{example}
% \fontspec{Hoefler Text}
% AAT: \vfrac{123}{456}\par
@@ -394,6 +501,33 @@ Will Robertson
% \changes{v0.1}{2006/05/03}{Implemented.}
% \end{macro}
%
+% \section{Named glyphs}
+% Along the way somewhere, \XeTeX\ added support for selecting glyphs from a TrueType-based OpenType font based on their internal glyph name. Jonathan Kew posted the following definition as a nice interface to it.
+% \begin{example}
+% \fontspec{Charis SIL}
+% \namedglyph{yen}
+% \namedglyph{smile}
+% \end{example}
+% \begin{macro}{\namedglyph}
+% \darg{Name of the font glyph to be typeset}
+% \begin{macrocode}
+\newcommand\namedglyph[1]{%
+ \@tempcnta=\XeTeXglyphindex "#1"\relax
+ \ifnum\@tempcnta>0
+ \XeTeXglyph\@tempcnta
+ \else
+ \xxt@namedglyph@fallback{#1}%
+ \fi}
+% \end{macrocode}
+% \changes{v0.2}{2006/08/12}{Implemented.}
+% \end{macro}
+% \begin{macro}{\xxt@namedglyph@fallback}
+% Redefine this macro to change how glyph names that aren't found get typeset.
+% \begin{macrocode}
+\newcommand\xxt@namedglyph@fallback[1]{[#1]}
+% \end{macrocode}
+% \changes{v0.2}{2006/08/12}{Implemented.}
+% \end{macro}
%
%\iffalse
%</package>
@@ -429,8 +563,8 @@ Will Robertson
\def\pfill{\hspace*{\fill}}}
{\endlist}
-\usepackage{array,booktabs,calc,color,fancyvrb,graphicx,ifthen,longtable,refstyle,varioref}
-\usepackage{fontspec,xunicode,xltxtra}
+\usepackage{array,booktabs,calc,color,enumitem,fancyvrb,graphicx,ifthen,longtable,refstyle,varioref}
+\usepackage{fontspec,ifxetex,xunicode,xltxtra}
\setromanfont[WordSpace=0.9,Mapping=tex-text,
BoldFont=Hoefler Text,
ItalicFeatures={Contextuals={NoWordFinal,NoLineFinal}}]{Hoefler Text}
@@ -449,7 +583,7 @@ Will Robertson
\begingroup
\color{niceblue}
\typesetexample
- \endgroup\nobreak\par\nobreak\noindent\hrulefill}
+ \endgroup\nobreak\par\nobreak\noindent\hrulefill\nobreak\par}
\let\examplesize\normalsize
\let\auxwidth\relax
@@ -488,6 +622,8 @@ Will Robertson
\newcommand*\name[1]{{#1}}
\newcommand*\pkg[1]{\textsf{#1}}
+\newcommand*\acro[1]{\textsc{\MakeLowercase{#1}}}
+
\newcommand*\note[1]{\unskip\footnote{#1}}
\let\latin\textit
diff --git a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins
deleted file mode 100644
index 7527ed11083..00000000000
--- a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins
+++ /dev/null
@@ -1,62 +0,0 @@
-%%
-%% This is file `xltxtra.ins',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% xltxtra.dtx (with options: `batchfile')
-%%
-%% ____________________________
-%% The xltxtra package
-%% (C) 2006 Will Robertson
-%% License information appended
-%%
-%%
-\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
-%%
-%% 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.
-%%
-%%
-%% End of file `xltxtra.ins'.