summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/letterswitharrows
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-02-07 21:49:38 +0000
committerKarl Berry <karl@freefriends.org>2020-02-07 21:49:38 +0000
commit0ef5174e5fc5ffea020725c2362527e573a095a1 (patch)
tree8ee4d1b603283a0beb2931a34a7471e5e9f7dbbf /Master/texmf-dist/source/latex/letterswitharrows
parent7c68bec29d52b5b541bc389005eb9da1506339be (diff)
letterswitharrows (7feb20)
git-svn-id: svn://tug.org/texlive/trunk@53709 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/letterswitharrows')
-rw-r--r--Master/texmf-dist/source/latex/letterswitharrows/letterswitharrows.dtx101
1 files changed, 78 insertions, 23 deletions
diff --git a/Master/texmf-dist/source/latex/letterswitharrows/letterswitharrows.dtx b/Master/texmf-dist/source/latex/letterswitharrows/letterswitharrows.dtx
index 43753176eba..8d54dd6294f 100644
--- a/Master/texmf-dist/source/latex/letterswitharrows/letterswitharrows.dtx
+++ b/Master/texmf-dist/source/latex/letterswitharrows/letterswitharrows.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
%% File: letterswitharrows.dtx
-%% Copyright 2019 J. Maximilian Teegen
+%% Copyright 2019-2020 J. Maximilian Teegen
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -54,15 +54,16 @@
% \title{The \pkg{letterswitharrows} package}
% \author{Max Teegen\\ \href{mailto:tex@jmteegen.eu}{tex@jmteegen.eu}}
-% \date{2019/11/21}
+% \date{Released 2020-02-04}
% \maketitle
% \begin{documentation}
-% This package does provides math-mode commands for setting left and right arrows over mathematical symbols, so that the arrows dynamically scale with the symbols.
+% This package provides math-mode commands for setting left and right arrows over mathematical symbols, so that the arrows dynamically scale with the symbols.
% Here is a sample: {\large\[
% \vs \le \tv \in \vec{U_{\mathrlap\vr}} \qquad \left\vert \vec{AB} \right\vert = \left\vert \cev{AB} \right\vert \qquad A \mathrel{\arrowoverset*[-2mu]{\between}} B
-% \]} % Somehow embellishments don't work in the documentation!?
+% \]}
+% \iffalse Somehow embellishments don't work in the documentation!? \fi
% While it is possible to set arrows over longer strings of symbols, the focus lies on single characters.
%
% Only \textsc{pdf} output is supported. Output to \textsc{ps} is implemented, but rarely tested.
@@ -132,7 +133,7 @@
% \subsection{Other package options}
% \DescribeOption{pgf}
-% If you specify the \verb|pgf| option, every arrow is drawn as a \verb|pgfpicture|. This requires the \pkg{pgf} package, and slow in its current implementation.
+% If you specify the \verb|pgf| option, every arrow is drawn as a \verb|pgfpicture|. This requires the \pkg{pgf} package.
% \begin{texnote}
% You can set up custom arrow drawing code by redefining \cs{__jmt_lwa_arrow_draw:nnn}.
% The command is expected to draw an arrow with its head at the current position. Its length should be \verb|#1| and it should be drawn at a font size of \verb|#2|pt.
@@ -141,7 +142,8 @@
% \DescribeOption{tweaks}
% Specifying the \verb|tweaks| option applies per-letter scaling adjustments to some of the single-letter shorthands. This is enabled by default.
-% These are specific to Latin Modern Math and subject to be changed on a whim. If you wish a more stable behaviour specify \verb|tweaks=false|
+% These are specific to Latin Modern Math and subject to be changed on a whim. If you wish a more stable behaviour specify \verb|tweaks=false|.
+% This documentation uses \verb|tweaks=false|.
% \end{documentation}
% \begin{implementation}
@@ -151,7 +153,7 @@
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
-\ProvidesExplPackage {letterswitharrows} {2019-11-21} {} {Draw arrows over math letters.}
+\ProvidesExplPackage {letterswitharrows} {2020-02-04} {} {Draw arrows over math letters.}
\RequirePackage{xparse,l3keys2e,mathtools}
% TODO: I just use mathtools for mathrlap; replace.
@@ -285,20 +287,27 @@
% \end{macro}
% \begin{macro}{\@@_arrow_overset:w,\arrowoverset}
+% \changes{2019/02/04}{2019/02/04}{Subscript spacing adjustments}
% \begin{macrocode}
\cs_new_protected:Npn \@@_arrow_overset:w {
\c_group_begin_token
\__@@_arrow_overset_aux:w
}
+\cs_new:Nn \__jmt_lwa_bool_convert:n {
+ \IfBooleanTF {#1} {\c_true_bool} {\c_false_bool}
+}
+
% This exp_args is necessary because _ generates the wrong token in expl3 syntax
\exp_args:NNx \NewDocumentCommand \__@@_arrow_overset_aux:w
{s O{0mu} O{1} O{0ex} m t' e{\char_generate:nn {95}{8}} t'} {
\__@@_arrow_overset:nnnnn
{
#5
- \c_math_superscript_token {
- \scriptscriptstyle\IfBooleanT{#6}{\prime}\IfBooleanT{#8}{\prime}
+ \exp_args:Nf\bool_if:nT{\__jmt_lwa_bool_convert:n{#6} || \__jmt_lwa_bool_convert:n{#8}} {
+ \c_math_superscript_token {
+ \scriptscriptstyle\IfBooleanT{#6}{\prime}\IfBooleanT{#8}{\prime}
+ }
} % TODO: Better positioning etc?
\exp_args:Nf\IfValueT{\use:n#7} {
\c_math_subscript_token {
@@ -311,7 +320,7 @@
\exp_args:Nf\IfValueTF{\use:n#7}{
% TODO: Better way to do this? This is all kinds of wrong.
- \hphantom{\!\c_math_subscript_token{#7}}
+ \hphantom{\c_math_subscript_token{#7}}
} {}
\c_group_end_token
}
@@ -431,21 +440,67 @@
% \end{macrocode}
% \end{macro}
% Some personal-preference tweaks.
+% \changes{2019/02/04}{2019/02/04}{Tweaks for capital letters.}
% \begin{macrocode}
\bool_if:NTF \g_@@_tweak_shortcuts_bool {
- \prop_if_in:NnTF \g_@@_selected_presets_prop {ABC} {
- \cs_set:cpn {vS} {
- \@@_arrow_overset:w[2mu][8/10]{S}
- }
- } {}
- \prop_if_in:NnTF \g_@@_selected_presets_prop {abc} {
- \cs_new:cpn {vell} {
- \@@_arrow_overset:w{\ell}
- }
- \cs_new:cpn {ellv} {
- \@@_arrow_overset:w{\ell}
- }
- } {}
+ \prop_if_in:NnTF \g_@@_selected_presets_prop {ABC} {
+ \int_step_inline:nnn {1} {26} {
+ \cs_set:cpx {v\int_to_Alph:n{#1}} {
+ \exp_not:N\@@_arrow_overset:w[2.5mu][8/10]{\int_to_Alph:n{#1}}
+ }
+ \cs_set:cpx {\int_to_Alph:n{#1}v} {
+ \exp_not:N\@@_arrow_overset:w*[2.5mu][7/10]{\int_to_Alph:n{#1}}
+ }
+ }
+ \cs_set:cpn {vS} {
+ \@@_arrow_overset:w[3mu][7/10]{S}
+ }
+ \cs_set:cpn {vT} {
+ \__jmt_lwa_arrow_overset:w[2mu][8/10]{T}
+ }
+ \cs_set:cpn {Tv} {
+ \__jmt_lwa_arrow_overset:w*[1mu][8/10]{T}
+ }
+ \cs_set:cpn {vU} {
+ \__jmt_lwa_arrow_overset:w[2mu][7/10]{U}
+ }
+ \cs_set:cpn {Uv} {
+ \__jmt_lwa_arrow_overset:w*[2mu][7/10]{U}
+ }
+ \cs_set:cpn {vV} {
+ \__jmt_lwa_arrow_overset:w[2.5mu][7/10]{V}
+ }
+ \cs_set:cpn {Vv} {
+ \__jmt_lwa_arrow_overset:w*[2mu][7/10]{V}
+ }
+ \cs_set:cpn {vX} {
+ \@@_arrow_overset:w[3mu][7/10]{X}
+ }
+ \cs_set:cpn {vY} {
+ \@@_arrow_overset:w[2mu][8/10]{Y}
+ }
+ \cs_set:cpn {Yv} {
+ \__jmt_lwa_arrow_overset:w*[2mu][7/10]{Y}
+ }
+ } {}
+ \prop_if_in:NnTF \g_@@_selected_presets_prop {cAcBcC} {
+ \int_step_inline:nnn {1} {26} {
+ \cs_set:cpx {vc\int_to_Alph:n{#1}} {
+ \exp_not:N\@@_arrow_overset:w[1mu][9/10]{\exp_not:N\mathcal{\int_to_Alph:n{#1}}}
+ }
+ \cs_set:cpx {c\int_to_Alph:n{#1}v} {
+ \exp_not:N\@@_arrow_overset:w*[1.5mu][8/10]{\exp_not:N\mathcal{\int_to_Alph:n{#1}}}
+ }
+ }
+ } {}
+ \prop_if_in:NnTF \g_@@_selected_presets_prop {abc} {
+ \cs_new:cpn {vell} {
+ \@@_arrow_overset:w{\ell}
+ }
+ \cs_new:cpn {ellv} {
+ \@@_arrow_overset:w{\ell}
+ }
+ } {}
} {}
% \end{macrocode}
% \end{implementation}