| 1 |
%% |
| 2 |
%% This is file `xltxtra.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% xltxtra.dtx (with options: `package') |
| 8 |
%% ____________________________ |
| 9 |
%% The XLTXTRA package |
| 10 |
%% (C) 2006-2017 Will Robertson |
| 11 |
%% License information appended |
| 12 |
%% |
| 13 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 14 |
%% THE XLTXTRA PACKAGE |
| 15 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 16 |
%% |
| 17 |
%% Copyright (C) 2006-2018 by Will Robertson <[email protected]> |
| 18 |
%% |
| 19 |
%% Distributable under the LaTeX Project Public License, |
| 20 |
%% version 1.3c or higher (your choice). The latest version of |
| 21 |
%% this license is at: http://www.latex-project.org/lppl.txt |
| 22 |
%% |
| 23 |
%% This work is "maintained" (as per LPPL maintenance status) |
| 24 |
%% by Will Robertson. |
| 25 |
%% |
| 26 |
%% This work consists of the files xltxtra.dtx and xltxtra.ins, |
| 27 |
%% and the derived files xltxtra.sty and xltxtra.pdf. |
| 28 |
%% |
| 29 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 30 |
\ProvidesPackage{xltxtra} |
| 31 |
[2018/12/31 v0.7 Improvements for the "XeLaTeX" format] |
| 32 |
\RequirePackage{ifluatex} |
| 33 |
\ifluatex |
| 34 |
\PackageWarningNoLine {xltxtra} {^^J |
| 35 |
XLTXTRA IS TO BE USED ONLY UNDER XETEX. |
| 36 |
LOAD FONTSPEC DIRECTLY, INSTEAD.^^J |
| 37 |
ABORTING LOADING% |
| 38 |
} |
| 39 |
\RequirePackage{fontspec} |
| 40 |
\expandafter \endinput |
| 41 |
\fi |
| 42 |
\RequirePackage{ifxetex} |
| 43 |
\RequireXeTeX |
| 44 |
\RequirePackage{fontspec} |
| 45 |
\RequirePackage{realscripts} |
| 46 |
\newif\if@xxt@nosscript@ |
| 47 |
\newif\if@xxt@nologos@ |
| 48 |
\DeclareOption{no-sscript}{\@xxt@nosscript@true} |
| 49 |
\DeclareOption{no-logos}{\@xxt@nologos@true} |
| 50 |
\ProcessOptions* |
| 51 |
\RequirePackage{metalogo} |
| 52 |
\if@xxt@nologos@ |
| 53 |
\let\TeX\original@TeX |
| 54 |
\let\LaTeX\original@LaTeX |
| 55 |
\let\LaTeXe\original@LaTeXe |
| 56 |
\fi |
| 57 |
\if@xxt@nosscript@ |
| 58 |
\DeclareRobustCommand*\textsubscript{% |
| 59 |
\@ifstar{\realsubscript}{\fakesubscript}} |
| 60 |
\DeclareRobustCommand*\textsuperscript{% |
| 61 |
\@ifstar{\realsuperscript}{\fakesuperscript}} |
| 62 |
\fi |
| 63 |
\ExplSyntaxOn |
| 64 |
\newcommand*\vfrac[2]{ |
| 65 |
\fontspec_if_fontspec_font:TF |
| 66 |
{ |
| 67 |
\fontspec_if_opentype:TF |
| 68 |
{ |
| 69 |
{\addfontfeature{VerticalPosition=Numerator}#1} |
| 70 |
\textfractionsolidus |
| 71 |
{\addfontfeature{VerticalPosition=Denominator}#2} |
| 72 |
} |
| 73 |
{ |
| 74 |
{\addfontfeature{VerticalPosition=Superior}#1} |
| 75 |
\textfractionsolidus |
| 76 |
{\addfontfeature{VerticalPosition=Inferior}#2} |
| 77 |
} |
| 78 |
} |
| 79 |
{ |
| 80 |
\PackageError {xltxtra} |
| 81 |
{ \string\vfrac\space~can~only~be~used~with~fontspec~fonts } |
| 82 |
{ Nothing~more~to~tell. } |
| 83 |
} |
| 84 |
} |
| 85 |
\ExplSyntaxOff |
| 86 |
\newcommand\namedglyph[1]{% |
| 87 |
\@tempcnta=\XeTeXglyphindex "#1"\relax |
| 88 |
\ifnum\@tempcnta>0 |
| 89 |
\XeTeXglyph\@tempcnta |
| 90 |
\else |
| 91 |
\xxt@namedglyph@fallback{#1}% |
| 92 |
\fi} |
| 93 |
\newcommand\xxt@namedglyph@fallback[1]{[#1]} |
| 94 |
\ExplSyntaxOn |
| 95 |
\seq_new:N \l__xetex_showhyphens_seq |
| 96 |
\box_new:N \l__xetex_show_hyphens_wrapping_box |
| 97 |
\box_new:N \l__xetex_show_hyphens_temp_box |
| 98 |
\box_new:N \l__xetex_show_hyphens_final_box |
| 99 |
\box_new:N \g__xetex_show_hyphens_word_box |
| 100 |
|
| 101 |
\cs_new_protected:Npn \xetex_show_hyphens:n #1 |
| 102 |
{ |
| 103 |
\box_clear:N \l__xetex_show_hyphens_final_box |
| 104 |
% split the input into items |
| 105 |
\seq_set_split:Nnn \l__xetex_showhyphens_seq { ~ } { #1 } |
| 106 |
% hyphenate all items |
| 107 |
\seq_map_function:NN \l__xetex_showhyphens_seq \xetex_hyphenate_word:n |
| 108 |
% set a box to the maximum dimension to force a Underfull \hbox warning |
| 109 |
\hbox_set_to_wd:Nnn \l__xetex_show_hyphens_final_box { \c_max_dim } |
| 110 |
{ |
| 111 |
\hbox_unpack_clear:N \l__xetex_show_hyphens_final_box |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
\cs_new_protected:Npn \xetex_hyphenate_word:n #1 |
| 116 |
{ |
| 117 |
\vbox_set:Nn \l__xetex_show_hyphens_wrapping_box |
| 118 |
{% build a paragraph with the word with a very narrow line width |
| 119 |
\dim_set:Nn \hsize { 1sp } |
| 120 |
% disregard spurious messages |
| 121 |
\hbadness = 10000\relax |
| 122 |
\dim_set:Nn \hfuzz { \c_max_dim } |
| 123 |
% clear possible values of \everypar and other parameters |
| 124 |
\everypar={} |
| 125 |
\skip_set:Nn \leftskip { 0pt } |
| 126 |
\skip_set_eq:NN \rightskip \leftskip |
| 127 |
% skip the first step |
| 128 |
\pretolerance = -1\relax |
| 129 |
% avoid the indentation and add a skip to allow hyphenation |
| 130 |
\noindent |
| 131 |
\skip_horizontal:n { 0pt } |
| 132 |
#1 |
| 133 |
\par |
| 134 |
\hbox_gset:Nn \g__xetex_show_hyphens_word_box {} |
| 135 |
% start a recursion to dismantle the paragraph just built |
| 136 |
\xetex_show_hyphens_split: |
| 137 |
% the result is put into \g__xetex_show_hyphens_word_box |
| 138 |
} |
| 139 |
% add the box to the final container |
| 140 |
\hbox_set:Nn \l__xetex_show_hyphens_final_box |
| 141 |
{ |
| 142 |
\hbox_unpack_clear:N \l__xetex_show_hyphens_final_box |
| 143 |
\hbox_unpack_clear:N \g__xetex_show_hyphens_word_box |
| 144 |
} |
| 145 |
} |
| 146 |
|
| 147 |
\cs_new_protected:Npn \xetex_show_hyphens_split: |
| 148 |
{ |
| 149 |
\unskip % remove the interline glue |
| 150 |
\unpenalty % remove possible penalties |
| 151 |
% get the last line |
| 152 |
\box_set_to_last:N \l__xetex_show_hyphens_temp_box |
| 153 |
\box_if_empty:NF \l__xetex_show_hyphens_temp_box |
| 154 |
{% if there is a last line unpack it into a container |
| 155 |
\hbox_gset:Nn \g__xetex_show_hyphens_word_box |
| 156 |
{% the order is last to first |
| 157 |
\hbox_unpack_clear:N \l__xetex_show_hyphens_temp_box |
| 158 |
\unskip\unskip % remove spaces |
| 159 |
\hbox_unpack_clear:N \g__xetex_show_hyphens_word_box |
| 160 |
} |
| 161 |
% restart the recursion |
| 162 |
\xetex_show_hyphens_split: |
| 163 |
} |
| 164 |
} |
| 165 |
|
| 166 |
\cs_set_eq:NN \showhyphens \xetex_show_hyphens:n |
| 167 |
\ExplSyntaxOff |
| 168 |
%% |
| 169 |
%% THE XLTXTRA PACKAGE |
| 170 |
%% |
| 171 |
%% Copyright (C) 2006-2018 by Will Robertson <[email protected]> |
| 172 |
%% |
| 173 |
%% Distributable under the LaTeX Project Public License, |
| 174 |
%% version 1.3c or higher (your choice). The latest version of |
| 175 |
%% this license is at: http://www.latex-project.org/lppl.txt |
| 176 |
%% |
| 177 |
%% This work is "maintained" (as per LPPL maintenance status) |
| 178 |
%% by Will Robertson. |
| 179 |
%% |
| 180 |
%% This work consists of the files xltxtra.dtx and xltxtra.ins, |
| 181 |
%% and the derived files xltxtra.sty and xltxtra.pdf. |
| 182 |
%% |
| 183 |
%% |
| 184 |
%% |
| 185 |
%% End of file `xltxtra.sty'. |