From d91f19016adadcafacec78ca98f45537ac145891 Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Wed, 30 Jul 2008 12:24:52 +0000 Subject: xltxtra update v0.4 git-svn-id: svn://tug.org/texlive/trunk@9907 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/xelatex/xltxtra/README | 22 +-- Master/texmf-dist/doc/xelatex/xltxtra/xltxtra.pdf | Bin 177043 -> 191995 bytes .../texmf-dist/source/xelatex/xltxtra/xltxtra.dtx | 154 +++++++++++++++++++-- .../texmf-dist/source/xelatex/xltxtra/xltxtra.ins | 8 +- Master/texmf-dist/tex/xelatex/xltxtra/xltxtra.sty | 56 +++++++- 5 files changed, 214 insertions(+), 26 deletions(-) diff --git a/Master/texmf-dist/doc/xelatex/xltxtra/README b/Master/texmf-dist/doc/xelatex/xltxtra/README index fb2c1fd80be..27e32a6d1f9 100644 --- a/Master/texmf-dist/doc/xelatex/xltxtra/README +++ b/Master/texmf-dist/doc/xelatex/xltxtra/README @@ -1,19 +1,25 @@ ------------------------- -THE XLTXTRA PACKAGE v0.3c +THE XLTXTRA PACKAGE v0.4 -This package provides a few small features that -are useful for XeLaTeX. +This package provides an ever increasing number of +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 + \-: for discretionary hyphenation with variable hyphenation characters, and - \textsuperscript & \textsubscript: + \textsuperscript & \textsubscript: now use fontspec to access real superior/inferior characters, - \emph: uses NFSS information to determine + \emph: uses NFSS information to determine when to enter \eminnershape, - \showhyphens: now works. + \showhyphens: now works, + \verb*: now displays visible spaces correctly + \begin{verbatim*}: ditto + +The following packages are patched to correctly +display visible space within various verbatims: + verbatim, moreverb, fancyvrb, listings Defines logos \XeTeX and \XeLaTeX. @@ -25,5 +31,5 @@ For more info see the documentation xltxtra.pdf. -------------- Will Robertson -2006/2007 +2006-2008 Distributed under the LaTeX Project Public License diff --git a/Master/texmf-dist/doc/xelatex/xltxtra/xltxtra.pdf b/Master/texmf-dist/doc/xelatex/xltxtra/xltxtra.pdf index 4cfd96a53bf..6c76f774834 100644 Binary files a/Master/texmf-dist/doc/xelatex/xltxtra/xltxtra.pdf and b/Master/texmf-dist/doc/xelatex/xltxtra/xltxtra.pdf differ diff --git a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx index c4163f4e813..0b5955fc801 100644 --- a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx +++ b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.dtx @@ -4,21 +4,27 @@ % %<*readme> ------------------------- -THE XLTXTRA PACKAGE v0.3c +THE XLTXTRA PACKAGE v0.4 -This package provides a few small features that -are useful for XeLaTeX. +This package provides an ever increasing number of +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 + \-: for discretionary hyphenation with variable hyphenation characters, and - \textsuperscript & \textsubscript: + \textsuperscript & \textsubscript: now use fontspec to access real superior/inferior characters, - \emph: uses NFSS information to determine + \emph: uses NFSS information to determine when to enter \eminnershape, - \showhyphens: now works. + \showhyphens: now works, + \verb*: now displays visible spaces correctly + \begin{verbatim*}: ditto + +The following packages are patched to correctly +display visible space within various verbatims: + verbatim, moreverb, fancyvrb, listings Defines logos \XeTeX and \XeLaTeX. @@ -30,7 +36,7 @@ For more info see the documentation xltxtra.pdf. -------------- Will Robertson -2006/2007 +2006-2008 Distributed under the LaTeX Project Public License % %<*internal> @@ -47,14 +53,14 @@ Distributed under the LaTeX Project Public License ____________________________ The xltxtra package - (C) 2006/2007 Will Robertson + (C) 2006-2008 Will Robertson License information appended \endpreamble \postamble -Copyright (C) 2006/2007 by Will Robertson +Copyright (C) 2006-2008 by Will Robertson Distributable under the LaTeX Project Public License, version 1.3c or higher (your choice). The latest version of @@ -124,6 +130,7 @@ This work consists of the file xltxtra.dtx % \item[no-emph] Disables the redefinition of \cmd\emph\ and \cmd\em\ described in \secref{emph}. % \item[no-logos] Disables the redefinition of \cmd\TeX, etc. described in \secref{logos}, but \emph{does} still define the \cmd\XeTeX\ and \cmd\XeLaTeX\ logo commands. % \item[no-hyphen] Disables the redefinition of \cmd\-\ (probably harmless anyway) described in \secref{hyphen}. +% \item[no-verb] Disables the redefinition of \cmd{\verb*} and |\begin{verbatim*}|, and the patching of various verbatim packages, as described in \secref{verb}. % \end{description} % % \section{Features} @@ -189,6 +196,18 @@ This work consists of the file xltxtra.dtx % This problem has been solved by loading the % \pkg{fixltx2e} and \pkg{xunicode} packages in \pkg{xltxtra}. % +% \subsection{Verbatim} +% \seclabel{verb} +% +% Many verbatim mechanisms assume the existence of a `visible space' character that exists in the \textsc{ascii} space slot of the typewriter font. This character is known in unicode as \unichar{2434}{box open}, which looks like this: `\verb*| |'. +% +% When a unicode typewriter font is used, \LaTeX\ no longer prints visible spaces for the |verbatim*| environment and |\verb*| command. \pkg{xltxtra} fixes this problem by using the correct unicode glyph, and patches the following packages to do the same: +% \pkg{listings}, \pkg{fancyvrb}, \pkg{moreverb}, and \pkg{verbatim}. +% +% In the case that the typewriter font does not contain `\verb*| |', the Latin Modern Mono font is used as a fallback. +% +% +% % \subsection{Logos} % \seclabel{logos} % @@ -241,6 +260,7 @@ This work consists of the file xltxtra.dtx % A new version, written by Jonathan Kew, is included in this package that \emph{does} work. Minor differences with the original: the showing of hyphens in the console output will be marked with explanatory text. Also, multiple words, separated by commas, will end up in separate instances of `showing hyphens'. % \showhyphens{discomedusoid, discommodiousness} % +% \newpage % \part{The \textsf{xltxtra} package} %\iffalse %<*package> @@ -249,11 +269,12 @@ This work consists of the file xltxtra.dtx % % \begin{macrocode} \ProvidesPackage{xltxtra} - [2008/03/11 v0.3c Improvements for the "XeLaTeX" format] + [2008/07/29 v0.4 Improvements for the "XeLaTeX" format] % \end{macrocode} % % \changes{v0.3}{2007/05/29}{Added proper documentation.} % \changes{v0.3}{2007/05/29}{Added \texttt{no-} package options to restrict functionality.} +% \changes{v0.4}{2008/07/29}{Added support for verbatim \& visible spaces.} % \PrintChanges % % \paragraph{Option processing} @@ -262,10 +283,12 @@ This work consists of the file xltxtra.dtx \newif\if@xxt@nologos@ \newif\if@xxt@nohyphen@ \newif\if@xxt@noemph@ +\newif\if@xxt@noverb@ \DeclareOption{no-sscript}{\@xxt@nosscript@true} \DeclareOption{no-logos}{\@xxt@nologos@true} \DeclareOption{no-hyphen}{\@xxt@nohyphen@true} \DeclareOption{no-emph}{\@xxt@noemph@true} +\DeclareOption{no-verb}{\@xxt@noverb@true} \ProcessOptions* % \end{macrocode} % @@ -690,6 +713,112 @@ This work consists of the file xltxtra.dtx % \changes{v0.3}{2007/05/30}{Implemented.} % \end{macro} % +% \subsection{Verbatims} +% +% Many thanks to Apostolos Syropoulos for discovering this problem and writing the redefinion of \LaTeX's |verbatim| environment and \cs{verb*} command. +% +% \begin{macrocode} +\unless\if@xxt@noverb@ +% \end{macrocode} +% +% \begin{macro}{\xxt@visiblespace} +% Print \unichar{2434}{Open box}, which is used to visibly display a space character. +% \begin{macrocode} +\def\xxt@visiblespace{% + \iffontchar\font"2423 + \expandafter\textvisiblespace + \else + \expandafter\xxt@visiblespace@fallback + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\xxt@visiblespace@fallback} +% If the current font doesn't have u2434, use Latin Modern Mono instead. +% \begin{macrocode} +\def\xxt@visiblespace@fallback{{% + \usefont{EU1}{lmtt}{\f@series}{\f@shape}% + \textvisiblespace}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\xxt@vprintspaces} +% Helper macro to turn spaces active and print visible space instead. +% \begin{macrocode} +\begingroup + \catcode`\ =\active% + \gdef\xxt@vprintspaces{\catcode`\ \active\let \xxt@visiblespace}% +\endgroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\verb} +% \begin{macro}{\verb*} +% Redefine \cmd\verb\ to use \cmd\xxt@vprintspaces. +% \begin{macrocode} +\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\@@sverb\@verb} +\def\@@sverb{\xxt@vprintspaces\@sverb} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% It's better to put small things into \cmd\AtBeginDocument, so here we go: +% \begin{macrocode} +\AtBeginDocument{% + \xxt@patch@verbatim + \xxt@patch@moreverb + \xxt@patch@fancyvrb + \xxt@patch@listings} +% \end{macrocode} +% +% \begin{environment}{verbatim*} +% \begin{macrocode} +\def\xxt@patch@verbatim{% + \@ifpackageloaded{verbatim}{% + \@namedef{verbatim*}{\begingroup\@verbatim\xxt@vprintspaces\verbatim@start}% + }{% +% \end{macrocode} +% This is for vanilla LaTeX. +% \begin{macrocode} + \@namedef{verbatim*}{\@verbatim\xxt@vprintspaces\@sxverbatim}% + }} +% \end{macrocode} +% \end{environment} +% +% This is for moreverb. +% \begin{macrocode} +\def\xxt@patch@moreverb{% + \@ifpackageloaded{moreverb}{% + \@namedef{listingcont*}{% + \def\verbatim@processline{% + \thelisting@line \global\advance\listing@line1 + \the\verbatim@line\par}% + \@verbatim\xxt@vprintspaces\verbatim@start}% + }{}} +% \end{macrocode} +% +% \begin{macrocode} +\def\xxt@patch@fancyvrb{% + \@ifpackageloaded{fancyvrb}{% + \let\FancyVerbSpace\xxt@visiblespace + }{}} +% \end{macrocode} +% +% \begin{macrocode} +\def\xxt@patch@listings{% + \@ifpackageloaded{listings}{% + \let\lst@visiblespace\xxt@visiblespace + }{}} +% \end{macrocode} +% Finish verbatim features: +% \begin{macrocode} +\fi +% \end{macrocode} +% %\iffalse % %\fi @@ -800,6 +929,9 @@ This work consists of the file xltxtra.dtx \newcommand*\doarg[1]{% \stepcounter{argument}% \noindent{\ttfamily\makebox[0pt][r]{[}\#\theargument]}:~#1\par\nobreak} + +\newcommand\unichar[2]{\textsc{\MakeLowercase{u+#1: #2}}} + % \end{macrocode} % %\fi diff --git a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins index a7c8ae1344e..6f3f5c03716 100644 --- a/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins +++ b/Master/texmf-dist/source/xelatex/xltxtra/xltxtra.ins @@ -8,7 +8,7 @@ %% %% ____________________________ %% The xltxtra package -%% (C) 2006/2007 Will Robertson +%% (C) 2006-2008 Will Robertson %% License information appended %% %% @@ -18,13 +18,13 @@ ____________________________ The xltxtra package - (C) 2006/2007 Will Robertson + (C) 2006-2008 Will Robertson License information appended \endpreamble \postamble -Copyright (C) 2006/2007 by Will Robertson +Copyright (C) 2006-2008 by Will Robertson Distributable under the LaTeX Project Public License, version 1.3c or higher (your choice). The latest version of @@ -43,7 +43,7 @@ This work consists of the file xltxtra.dtx \generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} \endbatchfile %% -%% Copyright (C) 2006/2007 by Will Robertson +%% Copyright (C) 2006-2008 by Will Robertson %% %% Distributable under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of diff --git a/Master/texmf-dist/tex/xelatex/xltxtra/xltxtra.sty b/Master/texmf-dist/tex/xelatex/xltxtra/xltxtra.sty index 893d6d76609..8f4c06c1bbe 100644 --- a/Master/texmf-dist/tex/xelatex/xltxtra/xltxtra.sty +++ b/Master/texmf-dist/tex/xelatex/xltxtra/xltxtra.sty @@ -8,20 +8,22 @@ %% %% ____________________________ %% The xltxtra package -%% (C) 2006/2007 Will Robertson +%% (C) 2006-2008 Will Robertson %% License information appended %% %% \ProvidesPackage{xltxtra} - [2008/03/11 v0.3c Improvements for the "XeLaTeX" format] + [2008/07/29 v0.4 Improvements for the "XeLaTeX" format] \newif\if@xxt@nosscript@ \newif\if@xxt@nologos@ \newif\if@xxt@nohyphen@ \newif\if@xxt@noemph@ +\newif\if@xxt@noverb@ \DeclareOption{no-sscript}{\@xxt@nosscript@true} \DeclareOption{no-logos}{\@xxt@nologos@true} \DeclareOption{no-hyphen}{\@xxt@nohyphen@true} \DeclareOption{no-emph}{\@xxt@noemph@true} +\DeclareOption{no-verb}{\@xxt@noverb@true} \ProcessOptions* \RequirePackage{ifxetex} \RequireXeTeX @@ -254,8 +256,56 @@ \unhbox\xxt@tempbox}% \expandafter\xxt@sh@cat \fi} +\unless\if@xxt@noverb@ +\def\xxt@visiblespace{% + \iffontchar\font"2423 + \expandafter\textvisiblespace + \else + \expandafter\xxt@visiblespace@fallback + \fi} +\def\xxt@visiblespace@fallback{{% + \usefont{EU1}{lmtt}{\f@series}{\f@shape}% + \textvisiblespace}} +\begingroup + \catcode`\ =\active% + \gdef\xxt@vprintspaces{\catcode`\ \active\let \xxt@visiblespace}% +\endgroup +\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \verb@eol@error \let\do\@makeother \dospecials + \verbatim@font\@noligs + \@ifstar\@@sverb\@verb} +\def\@@sverb{\xxt@vprintspaces\@sverb} +\AtBeginDocument{% + \xxt@patch@verbatim + \xxt@patch@moreverb + \xxt@patch@fancyvrb + \xxt@patch@listings} +\def\xxt@patch@verbatim{% + \@ifpackageloaded{verbatim}{% + \@namedef{verbatim*}{\begingroup\@verbatim\xxt@vprintspaces\verbatim@start}% + }{% + \@namedef{verbatim*}{\@verbatim\xxt@vprintspaces\@sxverbatim}% + }} +\def\xxt@patch@moreverb{% + \@ifpackageloaded{moreverb}{% + \@namedef{listingcont*}{% + \def\verbatim@processline{% + \thelisting@line \global\advance\listing@line1 + \the\verbatim@line\par}% + \@verbatim\xxt@vprintspaces\verbatim@start}% + }{}} +\def\xxt@patch@fancyvrb{% + \@ifpackageloaded{fancyvrb}{% + \let\FancyVerbSpace\xxt@visiblespace + }{}} +\def\xxt@patch@listings{% + \@ifpackageloaded{listings}{% + \let\lst@visiblespace\xxt@visiblespace + }{}} +\fi %% -%% Copyright (C) 2006/2007 by Will Robertson +%% Copyright (C) 2006-2008 by Will Robertson %% %% Distributable under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of -- cgit v1.2.3