summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-10-02 23:54:34 +0000
committerKarl Berry <karl@freefriends.org>2010-10-02 23:54:34 +0000
commit7aee0adc68902ce5076886cca4b68350f58c60b5 (patch)
treef065458621cd7881ca297a07723b0ebcb0928002 /Master/texmf-dist/tex/latex
parentb39fbb575801cea63e168e235a09fe362a157658 (diff)
realscripts 0.3 (30sep10)
git-svn-id: svn://tug.org/texlive/trunk@19976 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/realscripts/realscripts.sty100
1 files changed, 85 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/realscripts/realscripts.sty b/Master/texmf-dist/tex/latex/realscripts/realscripts.sty
index be557c70890..0b068db781c 100644
--- a/Master/texmf-dist/tex/latex/realscripts/realscripts.sty
+++ b/Master/texmf-dist/tex/latex/realscripts/realscripts.sty
@@ -11,26 +11,19 @@
%% License information appended
%%
\ProvidesPackage{realscripts}
- [2010/09/20 v0.2 Access OpenType subscripts and superscripts]
-\RequirePackage{fontspec}[2010/05/14 v2.0]
+ [2010/09/30 v0.3 Access OpenType subscripts and superscripts]
+\RequirePackage{fontspec}
\ExplSyntaxOn
-\cs_if_exist:NTF \textsubscript
-{
- \cs_set_eq:NN \fakesubscript \textsubscript
- \cs_set_eq:NN \fakesuperscript \textsuperscript
+\DeclareDocumentCommand \fakesubscript {m} {
+ \@textsubscript{\selectfont#1}
}
-{
- \DeclareDocumentCommand \fakesubscript {m} {
- \@textsubscript{\selectfont#1}
- }
- \DeclareDocumentCommand \fakesuperscript {m} {
- \@textsuperscript{\selectfont#1}
- }
+\DeclareDocumentCommand \fakesuperscript {m} {
+ \@textsuperscript{\selectfont#1}
}
-\DeclareDocumentCommand \textsubscript {s} {
+\RenewDocumentCommand \textsubscript {s} {
\IfBooleanTF #1 \fakesubscript \realsubscript
}
-\DeclareDocumentCommand \textsuperscript {s} {
+\RenewDocumentCommand \textsuperscript {s} {
\IfBooleanTF #1 \fakesuperscript \realsuperscript
}
\DeclareDocumentCommand \realsubscript {m} {
@@ -75,6 +68,83 @@
{
\cs_new:Npn \footnotemarkfont {\normalfont}
}
+\DeclareDocumentCommand \textsubsuperscript {s O{l} mm} {
+ \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} }
+ \prg_case_str:nnn {#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} {
+ \textsubsuperscript #1 [#2] {#3} {#2}
+}
+\dim_new:N \subsupersep
+\cs_set:Nn \dim_max:nn {
+ \dim_compare:nTF {#1>#2} {#1} {#2}
+}
+\cs_set:Nn \dim_min:nn {
+ \dim_compare:nTF {#2>#1} {#1} {#2}
+}
%%
%% Copyright (C) 2010 by Will Robertson <will.robertson@latex-project.org>
%%