You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
4.5 KiB
161 lines
4.5 KiB
%%
|
|
%% This is file `realscripts.sty',
|
|
%% generated with the docstrip utility.
|
|
%%
|
|
%% The original source files were:
|
|
%%
|
|
%% realscripts.dtx (with options: `package')
|
|
%% _____________________________
|
|
%% The REALSCRIPTS package
|
|
%% (C) 2010--2016 Will Robertson
|
|
%% License information appended
|
|
%%
|
|
\ProvidesPackage{realscripts}
|
|
[2016/02/13 v0.3d Access OpenType subscripts and superscripts]
|
|
\RequirePackage{fontspec}
|
|
\ExplSyntaxOn
|
|
\DeclareDocumentCommand \fakesubscript {m} {
|
|
\@textsubscript{\selectfont#1}
|
|
}
|
|
\DeclareDocumentCommand \fakesuperscript {m} {
|
|
\@textsuperscript{\selectfont#1}
|
|
}
|
|
\RenewDocumentCommand \textsubscript {s} {
|
|
\IfBooleanTF #1 \fakesubscript \realsubscript
|
|
}
|
|
\RenewDocumentCommand \textsuperscript {s} {
|
|
\IfBooleanTF #1 \fakesuperscript \realsuperscript
|
|
}
|
|
\DeclareDocumentCommand \realsubscript {m} {
|
|
\fontspec_if_fontspec_font:TF {
|
|
\fontspec_if_opentype:TF
|
|
{ \fontspec_if_feature:nTF {+subs}
|
|
{ {\addfontfeature{VerticalPosition=Inferior}#1} }
|
|
{ \fontspec_if_feature:nTF {+sinf}
|
|
{ {\addfontfeature{VerticalPosition=ScientificInferior}#1} }
|
|
{ \fakesubscript{#1} }
|
|
}
|
|
}
|
|
{ \fontspec_if_aat_feature:nnTF {10} {2}
|
|
{ {\addfontfeature{VerticalPosition=Inferior}#1} }
|
|
{ \fakesubscript{#1} }
|
|
}
|
|
}
|
|
{ \fakesubscript{#1} }
|
|
}
|
|
\DeclareDocumentCommand \realsuperscript {m} {
|
|
\fontspec_if_fontspec_font:TF
|
|
{
|
|
\fontspec_if_opentype:TF
|
|
{ \fontspec_if_feature:nTF {+sups}
|
|
{ {\addfontfeature{VerticalPosition=Superior}#1} }
|
|
{ \fakesuperscript{#1} }
|
|
}
|
|
{ \fontspec_if_aat_feature:nnTF {10} {1}
|
|
{ {\addfontfeature{VerticalPosition=Superior}#1} }
|
|
{ \fakesuperscript{#1} }
|
|
}
|
|
}
|
|
{ \fakesuperscript{#1} }
|
|
}
|
|
\cs_set:Npn \@makefnmark {
|
|
\mbox{\footnotemarkfont\textsuperscript{\@thefnmark}}
|
|
}
|
|
\cs_if_exist:NTF \ftntm@font
|
|
{
|
|
\cs_new:Npn \footnotemarkfont {\ftntm@font}
|
|
}
|
|
{
|
|
\cs_new:Npn \footnotemarkfont {\normalfont}
|
|
}
|
|
\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
|
|
}
|
|
{
|
|
\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}
|
|
}
|
|
}
|
|
{
|
|
\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
|
|
}
|
|
}
|
|
{
|
|
\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} }
|
|
}
|
|
\dim_new:N \subsupersep
|
|
%%
|
|
%% Copyright (C) 2010--2016 by Will Robertson <will.robertson@latex-project.org>
|
|
%%
|
|
%% 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.sty'.
|
|
|