From ac0ae0fcbd5ee121e6b9134cced71d961e30ed68 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 27 Sep 2020 03:01:57 +0000 Subject: CTAN sync 202009270301 --- macros/unicodetex/latex/realscripts/README.md | 77 +++ .../unicodetex/latex/realscripts/realscripts.dtx | 419 ++++++++++++++++ .../unicodetex/latex/realscripts/realscripts.ins | 58 +++ .../unicodetex/latex/realscripts/realscripts.pdf | Bin 0 -> 106569 bytes macros/unicodetex/latex/xltxtra/README.md | 64 +++ macros/unicodetex/latex/xltxtra/xltxtra.dtx | 534 +++++++++++++++++++++ macros/unicodetex/latex/xltxtra/xltxtra.ins | 34 ++ macros/unicodetex/latex/xltxtra/xltxtra.pdf | Bin 0 -> 101885 bytes 8 files changed, 1186 insertions(+) create mode 100644 macros/unicodetex/latex/realscripts/README.md create mode 100644 macros/unicodetex/latex/realscripts/realscripts.dtx create mode 100644 macros/unicodetex/latex/realscripts/realscripts.ins create mode 100644 macros/unicodetex/latex/realscripts/realscripts.pdf create mode 100644 macros/unicodetex/latex/xltxtra/README.md create mode 100644 macros/unicodetex/latex/xltxtra/xltxtra.dtx create mode 100644 macros/unicodetex/latex/xltxtra/xltxtra.ins create mode 100644 macros/unicodetex/latex/xltxtra/xltxtra.pdf (limited to 'macros/unicodetex') diff --git a/macros/unicodetex/latex/realscripts/README.md b/macros/unicodetex/latex/realscripts/README.md new file mode 100644 index 0000000000..a98194ad9a --- /dev/null +++ b/macros/unicodetex/latex/realscripts/README.md @@ -0,0 +1,77 @@ +The REALSCRIPTS package +======================= + +Small package to replace `\textsuperscript` & `\textsubscript` +by equivalent commands that use OpenType font features +to access the appropriate glyphs if possible. + +Provides `\textsubsuperscript` (and `\textsupersubscript`) for +setting subscripts and superscripts on top of each other. + +Also patches LaTeX's default footnote command to use this +new `\textsuperscript` for footnote symbols. + +Requires fontspec running on either XeLaTeX or LuaLaTeX. + +For more information see the documentation realscripts.pdf. + +Change History +-------------- + +v0.3d 2016/02/13 + + * Fix somewhat important typo in the documentation. + * Minor other updates to the docs. + * Fix old expl3 syntax change. + +v0.3c 2013/03/18 + + * Fix completely broken `\textsupersubscript`. + * Allow `\textsubsuperscript` at the start of a paragraph (!). + * Sync with expl3 updates. + +v0.3b 2013/02/27 + + * Remove internal definition of two functions that have since been defined + in expl3 (`\dim_min:nn` and `\dim_max:nn`). + +v0.3 2010/09/30 + + * New commands `\textsubsuperscript` and `\textsupersubscript` added. + * Fix an "infinite loop" bug added in the last version, triggered + when loading the `xltxtra` package with the `[no-sscript]` option. + + +v0.2 2010/09/20 + + * Add feature to specify the font of the patched footnotemark. + This behaves well with KOMA-Script's `\setkomafont`, as well. + +v0.1 + + * First release + * Extracted from the xltxtra package + +Maintenance +----------- + +The release version of this package is available from CTAN: + +* + +Development and historical versions are available from GitHub: + +* + +Please report bugs and feature suggestions to the issue tracker: + +* + +Licence +------- + +The realscripts package is released under the +[LaTeX Project Public License](http://www.latex-project.org/lppl/) +version 1.3c or greater. The current maintainer is Will Robertson. + +Copyright 2010 Will Robertson diff --git a/macros/unicodetex/latex/realscripts/realscripts.dtx b/macros/unicodetex/latex/realscripts/realscripts.dtx new file mode 100644 index 0000000000..e59103e55a --- /dev/null +++ b/macros/unicodetex/latex/realscripts/realscripts.dtx @@ -0,0 +1,419 @@ +% \iffalse +% +%<*internal> +\begingroup +% +%<*batchfile> +\input docstrip.tex +\keepsilent +\preamble + _____________________________ + The REALSCRIPTS package + (C) 2010--2016 Will Robertson + License information appended + +\endpreamble +\postamble + +Copyright (C) 2010--2016 by Will Robertson + +Distributable under the LaTeX Project Public License, +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) +by Will Robertson. + +This work consists of the file realscripts.dtx + and the derived files realscripts.sty, + realscripts.ins, and + realscripts.pdf. + +\endpostamble +\askforoverwritefalse +\generate{\file{realscripts.sty}{\from{realscripts.dtx}{package}}} +% +%\endbatchfile +%<*internal> +\generate{\file{realscripts.ins}{\from{realscripts.dtx}{batchfile}}} +\def\tmpa{plain} +\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi +\endgroup +% +% +% \begin{macrocode} +%<*driver> +\ProvidesFile{realscripts.dtx} +% +%\ProvidesPackage{realscripts} +%<*package> + [2016/02/13 v0.3d Access OpenType subscripts and superscripts] +% +% \end{macrocode} +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{color,graphicx,metalogo,hologo,fontspec,realscripts} +\linespread{1.05} % A bit more space between lines +\frenchspacing % Remove extra space after punctuation +\definecolor{niceblue}{rgb}{0.1,0.2,1} +\def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}} +\newcommand*\pkg[1]{\texttt{#1}} +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +% +% +% \fi +% +% \errorcontextlines=999 +% \makeatletter +% +% \GetFileInfo{\jobname.sty} +% +% \title{The \pkg{\jobname} package} +% \author{Will Robertson} +% \date{\filedate \qquad \fileversion} +% +% \maketitle +% +% \section{Introduction} +% +% OpenType fonts provide the possiblity of using specially-drawn glyphs for +% subscript and superscript text. \LaTeX\ by default simply uses a smaller +% font size, which is acceptable if the font has optical sizes. Most fonts +% don't, however. +% +% If you are using the \pkg{fontspec} package\footnote{The \pkg{fontspec} package requires \XeLaTeX\ or \hologo{LuaLaTeX}.} to select OpenType fonts +% (or other sorts of fonts with the necessary font features), then loading +% this package will redefine the \cmd\textsuperscript\ and +% \cmd\textsubscript\ commands that take advantage of the OpenType font +% features. +% +% The \cs{textsubsuperscript}\marg{sub}\marg{super} command is +% defined for typesetting superscripts above subscripts using the same +% approach. For symmetry, \cs{textsupersubscript}\marg{super}\marg{sub} +% is also provided. Options are available to specify the alignment of the sub- and super-scripts; see below. +% +% \section{Technical details} +% +% The old commands are defined in starred form (e.g., \cs{textsubscript*}) for cases where the new commands are not appropriate. +% The functionality of the starred and non-starred commands can +% also be accessed using the macros +% \cmd\realsubscript, +% \cmd\realsuperscript, +% \cmd\fakesubscript, and +% \cmd\fakesuperscript, in case another package (or you) +% redefine the original \cmd\text\dots\ commands. +% +% This package will also patch the default \LaTeX\ footnote mechanism to +% use \cs{textsuperscript} automatically. You may change the font used +% to typeset the footnote numbers (by default it is the \cs{normalfont}) +% by redefining \cs{footnotemarkfont}; e.g.: +% {\par\qquad\verb|\renewcommand\footnotemarkfont|\marg{font switch}\par} +% \noindent and users of \pkg{KOMA-Script} may use instead +% {\par\qquad\verb|\setkomafont{footnotelabel}|\marg{font switch}\par} +% \noindent where \meta{font switch} is a command such as \cs{sffamily} or a \pkg{fontspec} font defined with \cs{newfontfamily}. +% +% Beware of other packages, however, that change the footnote mechanism. (Usually by redefining \cs{@makefnmark}.) I can often work around or work with such packages so \pkg{realscripts} cooperates gracefully with them; please report any conflicts to me. +% +% \section{Examples} +% +% Here is an example using the `{\fontspec{Skia} Skia}' font of Mac\,OS\,X: (surrounded by `A' and `Z' for visual context) +% +% \begin{quotation}\color{niceblue} +% \fontspec{Skia} +% |\textsuperscript{…} | A \textsuperscript{abcdefghijklmnopqrstuvwxyz1234567890} Z\par +% |\textsubscript{…} | A \textsubscript{abcdefghijklmnopqrstuvwxyz1234567890} Z +% \end{quotation} +% The original definitions are available in starred verions of the commands: +% (compare this example to that above to see why using these features is often desirable) +% \begin{quotation}\color{niceblue} +% \fontspec{Skia} +% |\textsuperscript*{…} | A \textsuperscript*{abcdefghijklmnopqrstuvwxyz1234567890} Z\par +% |\textsubscript*{…} | A \textsubscript*{abcdefghijklmnopqrstuvwxyz1234567890} Z +% \end{quotation} +% When the font features are not available the commands will fall back on the standard technique of scaling down the text font: +% (this is Mac\,OS\,X's `{\fontspec{Didot} Didot}') +% \begin{quotation}\color{niceblue} +% \fontspec{Didot} +% |\textsuperscript{…} | A \textsuperscript{abcdefghijklmnopqrstuvwxyz1234567890} Z\par +% |\textsubscript{…} | A \textsubscript{abcdefghijklmnopqrstuvwxyz1234567890} Z +% \end{quotation} +% But beware fonts that contain the necessary font features but lack the full repertoire of glyphs: (this is `{\fontspec{Adobe Jenson Pro}Adobe Jenson Pro}') +% \begin{quotation}\color{niceblue} +% \fontspec{Adobe Jenson Pro} +% |\textsuperscript{…} | A {\textsuperscript{abcdefghijklmnopqrstuvwxyz1234567890}} Z\par +% |\textsubscript{…} | A {\textsubscript{abcdefghijklmnopqrstuvwxyz1234567890}} Z +% \end{quotation} +% Finally, the `combined' commands. Note the dimension available +% to add some extra space between the sub- and super-scripts, and +% the optional argument for specifying alignment. +% \begin{quotation}\color{niceblue} +% \fontspec{Skia} +% |\textsubsuperscript{…}{…} | +% A {\textsubsuperscript{123456}{789}} Z\par\smallskip +% |\setlength\subsupersep{2pt} | \subsupersep=2pt +% A {\textsubsuperscript{123456}{789}} Z\par\smallskip +% |\textsubsuperscript[c]{…}{…} | +% A {\textsubsuperscript[c]{123}{456789}} Z\par\smallskip +% |\textsubsuperscript[r]{…}{…} | +% A {\textsubsuperscript[r]{123456}{789}} Z\par\smallskip +% \end{quotation} +% +% \newpage +% \part{Implementation of \textsf{\jobname}} +%\iffalse +%<*package> +%\fi +% This is the package implementation. +% If you're only interested in the footnote redefinition, +% skip ahead to Section~\ref{sec:fn} on page~\pageref{sec:fn}. +% +% \begin{macrocode} +\RequirePackage{fontspec} +\ExplSyntaxOn +% \end{macrocode} +% +% \begin{macro}{\fakesubscript} +% \begin{macro}{\fakesuperscript} +% The old (`fake') methods. +% Because \cs{textsubscript} is not defined in \LaTeXe, +% we either define it from scratch along with \cs{textsuperscript} +% (for consistency). +% \begin{macrocode} +\DeclareDocumentCommand \fakesubscript {m} { + \@textsubscript{\selectfont#1} +} +\DeclareDocumentCommand \fakesuperscript {m} { + \@textsuperscript{\selectfont#1} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\textsubscript} +% \begin{macro}{\textsubscript*} +% \begin{macro}{\textsuperscript} +% \begin{macro}{\textsuperscript*} +% These commands are either defined to create fake or real sub-/super-scripts if they are starred or not, respectively. +% \begin{macrocode} +\RenewDocumentCommand \textsubscript {s} { + \IfBooleanTF #1 \fakesubscript \realsubscript +} +\RenewDocumentCommand \textsuperscript {s} { + \IfBooleanTF #1 \fakesuperscript \realsuperscript +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\realsubscript} +% The new subscript command to use rich font features if possible. +% \begin{macrocode} +\DeclareDocumentCommand \realsubscript {m} { + \fontspec_if_fontspec_font:TF { +% \end{macrocode} +% 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. +% \begin{macrocode} + \fontspec_if_opentype:TF + { \fontspec_if_feature:nTF {+subs} + { {\addfontfeature{VerticalPosition=Inferior}#1} } + { \fontspec_if_feature:nTF {+sinf} + { {\addfontfeature{VerticalPosition=ScientificInferior}#1} } + { \fakesubscript{#1} } + } + } +% \end{macrocode} +% ATSUI fonts: +% \begin{macrocode} + { \fontspec_if_aat_feature:nnTF {10} {2} + { {\addfontfeature{VerticalPosition=Inferior}#1} } + { \fakesubscript{#1} } + } + } +% \end{macrocode} +% Non-fontspec fonts: +% \begin{macrocode} + { \fakesubscript{#1} } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\realsuperscript} +% The new superscript command to use rich font features if possible. +% \begin{macrocode} +\DeclareDocumentCommand \realsuperscript {m} { + \fontspec_if_fontspec_font:TF + { +% \end{macrocode} +% OpenType fonts: +% \begin{macrocode} + \fontspec_if_opentype:TF + { \fontspec_if_feature:nTF {+sups} + { {\addfontfeature{VerticalPosition=Superior}#1} } + { \fakesuperscript{#1} } + } +% \end{macrocode} +% ATSUI fonts: +% \begin{macrocode} + { \fontspec_if_aat_feature:nnTF {10} {1} + { {\addfontfeature{VerticalPosition=Superior}#1} } + { \fakesuperscript{#1} } + } + } +% \end{macrocode} +% Non-fontspec fonts: +% \begin{macrocode} + { \fakesuperscript{#1} } +} +% \end{macrocode} +% \end{macro} +% +% \section{Patching footnotes} +% \label{sec:fn} +% +% \begin{macro}{\@makefnmark} +% This is the command used to typeset the `footnote mark'. +% Feel free to redefine it as necessary for your own purposes. +% \begin{macrocode} +\cs_set:Npn \@makefnmark { + \mbox{\footnotemarkfont\textsuperscript{\@thefnmark}} +} +% \end{macrocode} +% We define a \cs{footnotemarkfont} that is used to style +% the number used for the footnote, which by default is +% simply \cs{normalfont} (following \LaTeXe's default). +% If \pkg{KOMA-Script} is +% being used, we use their hook for the footnotemark font instead. +% \begin{macrocode} +\cs_if_exist:NTF \ftntm@font +{ + \cs_new:Npn \footnotemarkfont {\ftntm@font} +} +{ + \cs_new:Npn \footnotemarkfont {\normalfont} +} +% \end{macrocode} +% \end{macro} +% +% \section{sub+super} +% +% \begin{macro}{\textsubsuperscript} +% \begin{macro}{\textsupersubscript} +% Although the implementation below would be fine outside of this package too, +% no point writing yet another small package. +% \begin{macrocode} +\DeclareDocumentCommand \textsubsuperscript {s O{l} mm} { + \leavevmode + \group_begin: + \IfBooleanTF #1 + { + \hbox_set:Nn \l_tmpa_box {\textsubscript*{#3}} + \hbox_set:Nn \l_tmpb_box {\textsuperscript*{#4}} + } + { + \hbox_set:Nn \l_tmpa_box {\textsubscript{#3}} + \hbox_set:Nn \l_tmpb_box {\textsuperscript{#4}} + } + \hbox_set:Nn \l_tmpa_box + { \box_move_down:nn \subsupersep {\box_use:N \l_tmpa_box} } + \hbox_set:Nn \l_tmpb_box + { \box_move_up:nn \subsupersep {\box_use:N \l_tmpb_box} } + \str_case:nnF {#2} + { + {l}{\use_i:nnn} + {c}{\use_ii:nnn} + {r}{\use_iii:nnn} + } + { + \PackageWarning{realscripts}{ + Unknown~alignment~option~`#2'. \MessageBreak + One~ of~ `l',~ `c',~ `r',~ only + } + \use_i:nnn + } +% \end{macrocode} +% Left aligned: +% \begin{macrocode} + { + \hbox_overlap_right:n { \box_use:N \l_tmpa_box } + \hbox_overlap_right:n { \box_use:N \l_tmpb_box } + \skip_horizontal:n { + \dim_max:nn {\box_wd:N \l_tmpa_box} {\box_wd:N \l_tmpb_box} + } + } +% \end{macrocode} +% Center aligned: (for completeness) +% \begin{macrocode} + { + \dim_compare:nTF { \box_wd:N \l_tmpa_box > \box_wd:N \l_tmpb_box } + { + \skip_horizontal:n { + 0.5\box_wd:N \l_tmpa_box-0.5\box_wd:N \l_tmpb_box + } + \box_use:N \l_tmpb_box + \skip_horizontal:n { + -0.5\box_wd:N \l_tmpa_box-0.5\box_wd:N \l_tmpb_box + } + \box_use:N \l_tmpa_box + } + { + \skip_horizontal:n { + 0.5\box_wd:N \l_tmpb_box-0.5\box_wd:N \l_tmpa_box + } + \box_use:N \l_tmpa_box + \skip_horizontal:n { + -0.5\box_wd:N \l_tmpb_box-0.5\box_wd:N \l_tmpa_box + } + \box_use:N \l_tmpb_box + } + } +% \end{macrocode} +% Right aligned: +% \begin{macrocode} + { + \skip_horizontal:n { + \dim_max:nn {\box_wd:N \l_tmpa_box} {\box_wd:N \l_tmpb_box} + } + \hbox_overlap_left:n { \box_use:N \l_tmpa_box } + \hbox_overlap_left:n { \box_use:N \l_tmpb_box } + } + \group_end: +} +\DeclareDocumentCommand \textsupersubscript {s O{l} mm} { + \IfBooleanTF #1 + { \textsubsuperscript * [#2] {#4} {#3} } + { \textsubsuperscript [#2] {#4} {#3} } +} +% \end{macrocode} +% +% \begin{macrocode} +\dim_new:N \subsupersep +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Fin. +% +%\iffalse +% +%\fi +% +% \Finale +% +% \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 realscripts.sty} +% \typeout{*} +% \typeout{*************************************************************} +% +\endinput + diff --git a/macros/unicodetex/latex/realscripts/realscripts.ins b/macros/unicodetex/latex/realscripts/realscripts.ins new file mode 100644 index 0000000000..c68d0669cd --- /dev/null +++ b/macros/unicodetex/latex/realscripts/realscripts.ins @@ -0,0 +1,58 @@ +%% +%% This is file `realscripts.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% realscripts.dtx (with options: `batchfile') +%% _____________________________ +%% The REALSCRIPTS package +%% (C) 2010--2016 Will Robertson +%% License information appended +%% +\input docstrip.tex +\keepsilent +\preamble + _____________________________ + The REALSCRIPTS package + (C) 2010--2016 Will Robertson + License information appended + +\endpreamble +\postamble + +Copyright (C) 2010--2016 by Will Robertson + +Distributable under the LaTeX Project Public License, +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) +by Will Robertson. + +This work consists of the file realscripts.dtx + and the derived files realscripts.sty, + realscripts.ins, and + realscripts.pdf. + +\endpostamble +\askforoverwritefalse +\generate{\file{realscripts.sty}{\from{realscripts.dtx}{package}}} +\endbatchfile +%% +%% Copyright (C) 2010--2016 by Will Robertson +%% +%% Distributable under the LaTeX Project Public License, +%% 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) +%% by Will Robertson. +%% +%% This work consists of the file realscripts.dtx +%% and the derived files realscripts.sty, +%% realscripts.ins, and +%% realscripts.pdf. +%% +%% +%% End of file `realscripts.ins'. diff --git a/macros/unicodetex/latex/realscripts/realscripts.pdf b/macros/unicodetex/latex/realscripts/realscripts.pdf new file mode 100644 index 0000000000..dc2e2e8dc7 Binary files /dev/null and b/macros/unicodetex/latex/realscripts/realscripts.pdf differ diff --git a/macros/unicodetex/latex/xltxtra/README.md b/macros/unicodetex/latex/xltxtra/README.md new file mode 100644 index 0000000000..41dc9204b3 --- /dev/null +++ b/macros/unicodetex/latex/xltxtra/README.md @@ -0,0 +1,64 @@ + +THE XLTXTRA PACKAGE 2018/12/31 v0.7 +=================================== + +This package was previously used to provide a number of small +features that are useful for XeLaTeX. As of fontspec v2, many +of these have now been incorporated into that package. More +recently, other updates to LaTeX2e itself have eliminated some +of the workarounds previously included in this package. + +This package therefore no longer does as much as it used to, +but is still provided for backwards compatibility. A summary: + +- Loads fontspec. + +- Loads Andrew Moschou's metalogo package for customised + `\XeTeX` and `\XeLaTeX` logos. + +- Loads the realscripts package to obtain OpenType-feature + subscript and superscript glyphs in `\textsuperscript` etc., + including in footnotes. + +- `\showhyphens` is redefined so it now works. + +- Defines the dubiously useful commands: + - `\vfrac` - for vulgar fractions using OpenType features + - `\namedglyph` - to access font glyphs by name + +For more information see the documentation xltxtra.pdf. + + +Change History +-------------- + +v0.7: + - Change internals for `expl3` update. + - Remove deprecated internal command `\TeX@logo@spacing`. + - (No user-level changes.) + +v0.6: + - Replace definition of `\showhyphens` with one that properly + replicates the plain TeX definition in behaviour. + +v0.5e: + - Remove the code for subscripts/superscripts and load the + realscripts package instead. + - (No user-level changes.) + +v0.5d: + - Remove those parts that have been taken into fontspec v2.0. + - (No user-level changes.) + +v0.5c: + - Update internals for fontspec v2.0. + - (No user-level changes.) + +v0.5b: + - Bug fix for `\LaTeX` when `[no-logos]` is used. + Thanks to Enrico Gregorio for finding this. + +______________ +Will Robertson +2006-2016 +Released under the LaTeX Project Public License diff --git a/macros/unicodetex/latex/xltxtra/xltxtra.dtx b/macros/unicodetex/latex/xltxtra/xltxtra.dtx new file mode 100644 index 0000000000..efcb4e7b7a --- /dev/null +++ b/macros/unicodetex/latex/xltxtra/xltxtra.dtx @@ -0,0 +1,534 @@ +% \iffalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% THE XLTXTRA PACKAGE +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Copyright (C) 2006-2018 by Will Robertson +%% +%% Distributable under the LaTeX Project Public License, +%% 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) +%% by Will Robertson. +%% +%% This work consists of the files xltxtra.dtx and xltxtra.ins, +%% and the derived files xltxtra.sty and xltxtra.pdf. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%<*driver> +\documentclass{ltxdoc} + +\makeatletter + +\def\@dotsep{1000} +\setcounter{tocdepth}{2} + +\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,enumitem,fancyvrb,graphicx,ifthen,longtable,refstyle,varioref,xltxtra} +\usepackage[rm]{titlesec} +\setmainfont{texgyrepagella}[ + Extension = .otf , + UprightFont = *-regular , + ItalicFont = *-italic , + BoldFont = *-bold , + BoldItalicFont = *-bolditalic , +] +\setsansfont{texgyreheros}[ + Scale=MatchLowercase , + Extension = .otf , + UprightFont = *-regular , + ItalicFont = *-italic , + BoldFont = *-bold , + BoldItalicFont = *-bolditalic , +] +\setmonofont{lmmono10}[ + Extension = .otf , + UprightFont = *-regular , + ItalicFont = *-italic , +] + +\linespread{1.05} % A bit more space between lines +\frenchspacing % Remove space after punctuation + +\setlogokern{Xe}{-0.061em} +\setlogokern{eL}{-0.057em} +\setlogokern{La}{-0.28em} +\setlogokern{aT}{-0.10em} +\setlogokern{Te}{-0.0575em} +\setlogokern{eX}{-0.072em} +\setlogokern{eT}{-0.056em} +\setlogokern{X2}{0.1667em} +\setlogodrop{0.153em} +\setLaTeXa{\scshape a} +\setLaTeXee{\mbox{\fontspec{Times}\itshape ε}} +\def\eTeX{{\fontspec{Times}\textit{ε}{}}-\TeX} % The eTeX logo is not (yet) covered by metalogo + +\definecolor{niceblue}{rgb}{0.2,0.4,0.6} +\def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}} + +\newenvironment{example} + {\VerbatimEnvironment + \begin{trivlist}\item[] + \begin{minipage}{\linewidth} + \par\noindent\hrulefill\par + \begin{VerbatimOut}[gobble=4]{\examplefilename}} + {\end{VerbatimOut}\relax + \begingroup + \color{niceblue} + \typesetexample + \endgroup\par\noindent\hrulefill\par + \end{minipage}\end{trivlist}} + +\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{xltxtra.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]{\texttt{#1}} +\newcommand*\pkgopt[1]{\texttt{[#1]} package option} + +\newcommand*\acro[1]{\textsc{\MakeLowercase{#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.}\@}} + +\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} + +\newcommand\unichar[2]{\textsc{\MakeLowercase{u+#1: #2}}} + +\makeatother + +\EnableCrossrefs +\CodelineIndex +\begin{document} + \DocInput{xltxtra.dtx} +\end{document} +% +% \fi +% +% \errorcontextlines=999 +% \makeatletter +% +% \GetFileInfo{xltxtra.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 some odds-and-ends features when using the \XeLaTeX\ format. +% +% \subsection{Usage} +% Easy: |\usepackage{xltxtra}|. This package automatically loads the following packages: \pkg{fontspec}, \pkg{realscripts}, \pkg{metalogo}. +% +% There are some package options to disable various functionality that could clash with other things: +% \begin{description}[font=\ttfamily] +% \item[no-sscript] Swaps the definitions of \cmd\textsubscript\ and \cmd\textsuperscript\ with their respective starred versions, as described in \secref{sscript}. +% \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. +% \end{description} +% +% \section{Features} +% +% \subsection{\cmd\textsuperscript\ and \cmd\textsubscript} +% \seclabel{sscript} +% +% This functionality is achieved through loading the \pkg{realscripts} +% package. +% +% These two macros have been redefined to take advantage, if possible, of actual superior or inferior glyphs in the main document font. This is very important for high-quality typesetting — compare this first example to the third; yes, they are the same font. +% \begin{quotation}\color{niceblue} +% \fontspec{Skia} +% |\textsuperscript | \textsuperscript{abcdefghijklmnopqrstuvwxyz1234567890}\par +% |\textsubscript | \textsubscript{abcdefghijklmnopqrstuvwxyz1234567890} +% \end{quotation} +% But will fall back on `faked' ones if they don't exist: +% (this is {\fontspec{Didot} Didot}) +% \begin{quotation}\color{niceblue} +% \fontspec{Didot} +% |\textsuperscript | \textsuperscript{abcdefghijklmnopqrstuvwxyz1234567890}\par +% |\textsubscript | \textsubscript{abcdefghijklmnopqrstuvwxyz1234567890} +% \end{quotation} +% The original definitions are available in starred verions of the commands: +% \begin{quotation}\color{niceblue} +% \fontspec{Skia} +% |\textsuperscript* | \textsuperscript*{abcdefghijklmnopqrstuvwxyz1234567890}\par +% |\textsubscript* | \textsubscript*{abcdefghijklmnopqrstuvwxyz1234567890} +% \end{quotation} +% +% The \pkgopt{no-sscript} will swap the definitions of the starred and non-starred versions of the commands described above if the new definitions are undesirable. +% +% The macros +% \cmd\realsubscript, +% \cmd\realsuperscript, +% \cmd\fakesubscript, and +% \cmd\fakesuperscript\ +% may be used to access the `new' and `old' functionalities regardless of the \pkgopt{no-sscript}. +% +% +% +% +% \subsection{Logos} +% \seclabel{logos} +% +% This part of the package essentially exists to define the \cmd\XeTeX\ and \cmd\XeLaTeX\ logos, +% which need to be tuned according to the font that is used. Originally I had some hard-coded +% definitions in here, but Andrew Moschou’s |metalogo| package now provides a much more +% flexible and useful interface to a variety of \TeX-related logos. +% +% Here are some examples. The default: +% \begingroup +% \setlogokern{Xe}{default} +% \setlogokern{eL}{default} +% \setlogokern{La}{default} +% \setlogokern{aT}{default} +% \setlogokern{Te}{default} +% \setlogokern{eX}{default} +% \setlogokern{eT}{default} +% \setlogokern{X2}{default} +% \setlogodrop{default} +% \setLaTeXa{default} +% \setLaTeXee{default} +% \begin{example} +% \TeX\ \XeTeX\ \LaTeX\ \XeLaTeX +% \end{example} +% \noindent Notice that it's a bit tight when not using Computer Modern, for which the logos were designed: +% \begin{example} +% \usefont{OT1}{cmr}{m}{n} +% \TeX\ \XeTeX\ \LaTeX\ \XeLaTeX +% \end{example} +% \endgroup +% +% These logos, ideally, should be hand-tuned for each font that they're used in. Please refer to the |metalogo| documentation for more information. +% +% The \pkgopt{no-logos} will not redefine \cmd\TeX\ or \cmd\LaTeX\ but will still define \cmd\XeTeX\ and \cmd\XeLaTeX. +% +% +% \subsection{Vulgar fractions} +% The \cmd\vfrac\ command for setting `vulgar' fractions based on AAT or OpenType font features. Not really recommended for many purposes, depending on your text, but it's a good example of how to program such things using \pkg{fontspec}. +% \begin{example} +% \fontspec{LibreCaslonText-Regular.otf} +% \vfrac{123}{456} +% \end{example} +% \noindent (This can also be achieved in regular \LaTeX\ with either the \pkg{nicefrac} or \pkg{xfrac} package.) +% +% Only use it when you know it will work; no warnings are given if the font doesn't support the necessary features. +% +% \subsection{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} +% \namedglyph{yen} +% \namedglyph{smile} +% \end{example} +% +% \subsection{The \cmd\showhyphens\ command} +% The default definition doesn't work in \XeTeX. +% A new version, written by Enrico Gregorio, is included in this package that \emph{does} work; note that the syntax now matches plain \TeX's original rather than the comma-list approach taken by an earlier version of this package. +% \showhyphens{discomedusoid discommodiousness} +% +% \newpage +% \part{The \textsf{xltxtra} package} +%\iffalse +%<*package> +%\fi +% This is the package implementation. +% +% \begin{macrocode} +\ProvidesPackage{xltxtra} + [2018/12/31 v0.7 Improvements for the "XeLaTeX" format] +% \end{macrocode} +% +% \paragraph{Not for Lua\TeX} +% \begin{macrocode} +\RequirePackage{ifluatex} +\ifluatex + \PackageWarningNoLine {xltxtra} {^^J + XLTXTRA IS TO BE USED ONLY UNDER XETEX. + LOAD FONTSPEC DIRECTLY, INSTEAD.^^J + ABORTING LOADING% + } + \RequirePackage{fontspec} + \expandafter \endinput +\fi +% \end{macrocode} +% +% \paragraph{Required packages} +% \begin{macrocode} +\RequirePackage{ifxetex} +\RequireXeTeX +\RequirePackage{fontspec} +\RequirePackage{realscripts} +% \end{macrocode} +% +% \paragraph{Option processing} +% \begin{macrocode} +\newif\if@xxt@nosscript@ +\newif\if@xxt@nologos@ +\DeclareOption{no-sscript}{\@xxt@nosscript@true} +\DeclareOption{no-logos}{\@xxt@nologos@true} +\ProcessOptions* +% \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 calls upon Andrew Moschou's package +% |metalogo| for this purpose. To tune the logos to each font, +% use the commands \cmd\setlogokern, \cmd\setlogodrop, etc.\ Refer to +% |mathspec|’s documentation for further details. +% +% \begin{example} +% \setlogokern{Xe}{-0.061em} +% \setlogokern{eL}{-0.057em} +% \setlogokern{La}{-0.265em} +% \setlogokern{aT}{-0.0585em} +% \setlogokern{Te}{-0.0575em} +% \setlogokern{eX}{-0.072em} +% \setlogokern{eT}{-0.056em} +% \setlogokern{X2}{0.1667em} +% \setlogodrop{0.153em} +% \setLaTeXa{\scshape a} +% \setLaTeXee{\mbox{\fontspec{Times}\itshape ε}} +% \TeX\ \XeTeX\ \LaTeX\ \XeLaTeX\ \LaTeXe +% \end{example} +% +% \begin{macrocode} +\RequirePackage{metalogo} +% \end{macrocode} +% +% The \pkgopt{no-logos} might be in effect, in which case \cmd\TeX, \cmd\LaTeX\ and +% \cmd\LaTeXe\ should keep their original definitions (which were saved by |metalogo|). +% +% \begin{macrocode} +\if@xxt@nologos@ + \let\TeX\original@TeX + \let\LaTeX\original@LaTeX + \let\LaTeXe\original@LaTeXe +\fi +% \end{macrocode} +% +% +% +% \section{Subscript and superscript} +% +% \begin{macro}{\textsubscript} +% \begin{macro}{\textsubscript*} +% \begin{macro}{\textsuperscript} +% \begin{macro}{\textsuperscript*} +% These commands are either defined to create fake or real sub-/super-scripts if they are starred or not, respectively. This swaps if the \pkgopt{no-sscript} is in effect. +% Text subscripts: +% \begin{macrocode} +\if@xxt@nosscript@ + \DeclareRobustCommand*\textsubscript{% + \@ifstar{\realsubscript}{\fakesubscript}} + \DeclareRobustCommand*\textsuperscript{% + \@ifstar{\realsuperscript}{\fakesuperscript}} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \section{Assorted commands} +% +% \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} +\ExplSyntaxOn +\newcommand*\vfrac[2]{ + \fontspec_if_fontspec_font:TF + { + \fontspec_if_opentype:TF + { + {\addfontfeature{VerticalPosition=Numerator}#1} + \textfractionsolidus + {\addfontfeature{VerticalPosition=Denominator}#2} + } + { + {\addfontfeature{VerticalPosition=Superior}#1} + \textfractionsolidus + {\addfontfeature{VerticalPosition=Inferior}#2} + } + } + { + \PackageError {xltxtra} + { \string\vfrac\space~can~only~be~used~with~fontspec~fonts } + { Nothing~more~to~tell. } + } +} +\ExplSyntaxOff +% \end{macrocode} +% \end{macro} +% +% \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} +% \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} +% \end{macro} +% +% +% \begin{macro}{\showhyphens} +% Courtesy egreg. +% \begin{macrocode} +\ExplSyntaxOn +\seq_new:N \l__xetex_showhyphens_seq +\box_new:N \l__xetex_show_hyphens_wrapping_box +\box_new:N \l__xetex_show_hyphens_temp_box +\box_new:N \l__xetex_show_hyphens_final_box +\box_new:N \g__xetex_show_hyphens_word_box + +\cs_new_protected:Npn \xetex_show_hyphens:n #1 + { + \box_clear:N \l__xetex_show_hyphens_final_box + % split the input into items + \seq_set_split:Nnn \l__xetex_showhyphens_seq { ~ } { #1 } + % hyphenate all items + \seq_map_function:NN \l__xetex_showhyphens_seq \xetex_hyphenate_word:n + % set a box to the maximum dimension to force a Underfull \hbox warning + \hbox_set_to_wd:Nnn \l__xetex_show_hyphens_final_box { \c_max_dim } + { + \hbox_unpack_clear:N \l__xetex_show_hyphens_final_box + } + } + +\cs_new_protected:Npn \xetex_hyphenate_word:n #1 + { + \vbox_set:Nn \l__xetex_show_hyphens_wrapping_box + {% build a paragraph with the word with a very narrow line width + \dim_set:Nn \hsize { 1sp } + % disregard spurious messages + \hbadness = 10000\relax + \dim_set:Nn \hfuzz { \c_max_dim } + % clear possible values of \everypar and other parameters + \everypar={} + \skip_set:Nn \leftskip { 0pt } + \skip_set_eq:NN \rightskip \leftskip + % skip the first step + \pretolerance = -1\relax + % avoid the indentation and add a skip to allow hyphenation + \noindent + \skip_horizontal:n { 0pt } + #1 + \par + \hbox_gset:Nn \g__xetex_show_hyphens_word_box {} + % start a recursion to dismantle the paragraph just built + \xetex_show_hyphens_split: + % the result is put into \g__xetex_show_hyphens_word_box + } + % add the box to the final container + \hbox_set:Nn \l__xetex_show_hyphens_final_box + { + \hbox_unpack_clear:N \l__xetex_show_hyphens_final_box + \hbox_unpack_clear:N \g__xetex_show_hyphens_word_box + } + } + +\cs_new_protected:Npn \xetex_show_hyphens_split: + { + \unskip % remove the interline glue + \unpenalty % remove possible penalties + % get the last line + \box_set_to_last:N \l__xetex_show_hyphens_temp_box + \box_if_empty:NF \l__xetex_show_hyphens_temp_box + {% if there is a last line unpack it into a container + \hbox_gset:Nn \g__xetex_show_hyphens_word_box + {% the order is last to first + \hbox_unpack_clear:N \l__xetex_show_hyphens_temp_box + \unskip\unskip % remove spaces + \hbox_unpack_clear:N \g__xetex_show_hyphens_word_box + } + % restart the recursion + \xetex_show_hyphens_split: + } + } + +\cs_set_eq:NN \showhyphens \xetex_show_hyphens:n +\ExplSyntaxOff +% \end{macrocode} +% \end{macro} +% +%\iffalse +% +%\fi +% +% \Finale +% +\endinput + diff --git a/macros/unicodetex/latex/xltxtra/xltxtra.ins b/macros/unicodetex/latex/xltxtra/xltxtra.ins new file mode 100644 index 0000000000..f3cf3dc8a9 --- /dev/null +++ b/macros/unicodetex/latex/xltxtra/xltxtra.ins @@ -0,0 +1,34 @@ + +\input docstrip.tex +\keepsilent +\preamble + ____________________________ + The XLTXTRA package + (C) 2006-2017 Will Robertson + License information appended + +\endpreamble +\postamble + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +THE XLTXTRA PACKAGE +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Copyright (C) 2006-2018 by Will Robertson + +Distributable under the LaTeX Project Public License, +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) +by Will Robertson. + +This work consists of the files xltxtra.dtx and xltxtra.ins, + and the derived files xltxtra.sty and xltxtra.pdf. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\endpostamble +\askforoverwritefalse +\generate{\file{xltxtra.sty}{\from{xltxtra.dtx}{package}}} +\endbatchfile diff --git a/macros/unicodetex/latex/xltxtra/xltxtra.pdf b/macros/unicodetex/latex/xltxtra/xltxtra.pdf new file mode 100644 index 0000000000..954083b948 Binary files /dev/null and b/macros/unicodetex/latex/xltxtra/xltxtra.pdf differ -- cgit v1.2.3