| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: letterswitharrows.dtx |
| 4 |
%% Copyright 2019-2024 J. Maximilian Teegen |
| 5 |
%% |
| 6 |
%% This work may be distributed and/or modified under the |
| 7 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 8 |
%% of this license or (at your option) any later version. |
| 9 |
%% The latest version of this license is in |
| 10 |
%% http://www.latex-project.org/lppl.txt |
| 11 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 12 |
%% version 2005/12/01 or later. |
| 13 |
%% |
| 14 |
%% This work has the LPPL maintenance status "maintained". |
| 15 |
%% |
| 16 |
%% The Current Maintainer of this work is J. M. Teegen. |
| 17 |
%% |
| 18 |
%% This work consists of the file letterswitharrows.dtx and its |
| 19 |
%% derived files letterswitharrows.sty and letterswitharrows.pdf. |
| 20 |
% |
| 21 |
%<*batch> |
| 22 |
%<*gobble> |
| 23 |
\ifx\jobname\relax\let\documentclass\undefined\fi |
| 24 |
\ifx\documentclass\undefined |
| 25 |
\csname fi\endcsname |
| 26 |
%</gobble> |
| 27 |
\input l3docstrip.tex |
| 28 |
\keepsilent |
| 29 |
\preamble |
| 30 |
\endpreamble |
| 31 |
\generate{\file{letterswitharrows.sty}{\from{letterswitharrows.dtx}{package}}} |
| 32 |
\endbatchfile |
| 33 |
%</batch> |
| 34 |
%<*gobble> |
| 35 |
\fi |
| 36 |
\expandafter\ifx\csname @currname\endcsname\empty |
| 37 |
\csname fi\endcsname |
| 38 |
%</gobble> |
| 39 |
%<*driver> |
| 40 |
\documentclass[full]{l3doc} |
| 41 |
\usepackage[presets={abc,ABC,cAcBcC,vec-cev},tweaks=false]{letterswitharrows} |
| 42 |
\usepackage{amssymb} |
| 43 |
\usepackage{hyperref} |
| 44 |
\begin{document} |
| 45 |
\DocInput{\jobname.dtx} |
| 46 |
%% \PrintIndex |
| 47 |
\PrintChanges |
| 48 |
\end{document} |
| 49 |
%</driver> |
| 50 |
%<*gobble> |
| 51 |
\fi |
| 52 |
%</gobble> |
| 53 |
% \fi |
| 54 |
|
| 55 |
% \title{The \pkg{letterswitharrows} package} |
| 56 |
% \author{Max Teegen\\ \href{mailto:[email protected]}{[email protected]}} |
| 57 |
% \date{Released 2024-10-31} |
| 58 |
|
| 59 |
% \maketitle |
| 60 |
|
| 61 |
% \begin{documentation} |
| 62 |
% This package provides math-mode commands for setting left and right arrows over mathematical symbols, so that the arrows dynamically scale with the symbols. |
| 63 |
% Here is a sample: {\large\[ |
| 64 |
% \vs \le \tv \in \vec{U_{\mathrlap\vrv}} \qquad \left\vert \vec{AB} \right\vert = \left\vert \cev{AB} \right\vert \qquad A \mathrel{\arrowoverset*[-2mu]{\between}} B |
| 65 |
% \]} |
| 66 |
% \iffalse Somehow embellishments don't work in the documentation!? \fi |
| 67 |
% While it is possible to set arrows over longer strings of symbols, the focus lies on single characters. |
| 68 |
% |
| 69 |
% Only \textsc{pdf} output is supported. Output to \textsc{ps} is implemented, but rarely tested. |
| 70 |
% For a wider range of formats there is \pkg{pgf}-based output. |
| 71 |
|
| 72 |
% \section{Usage} |
| 73 |
% The package provides the general-purpose \tn{arrowoverset} command, as well as some sets of predefined shorthand commands. |
| 74 |
|
| 75 |
% \subsection{Presets} |
| 76 |
% The presets are selected by passing them as options to the \verb|presets| package option. |
| 77 |
% For instance, to define the \verb|abc| and the \verb|vec-cev| sets of commands you would load the package like so: |
| 78 |
% \begin{verbatim} |
| 79 |
% \usepackage[presets={abc,vec-cev}]{letterswitharrows} |
| 80 |
% \end{verbatim} |
| 81 |
% By default, the \verb|abc|, \verb|ABC| and \verb|cAcBcC| presets are loaded. |
| 82 |
|
| 83 |
% \DescribeOption{abc} |
| 84 |
% Passing \verb|abc| to the \verb|presets| option allows you to use the \tn{v\meta{char}}, \tn{\meta{char}v}, and \tn{v\meta{char}v} commands for all the lower-case letters \verb|a| through \verb|z| except for \verb|v|. |
| 85 |
% \begin{function}{\v<char>,\<char>v,\vleft,\vright,\v<char>v} |
| 86 |
% For the letter \verb|v| the commands \tn{vleft} and \tn{vright} are provided. |
| 87 |
% \[ \va, \vb, \vc, \dv, \vmv, F_\tv \] |
| 88 |
% \begin{verbatim} |
| 89 |
% \[ \va, \vb, \vc, \dv, \vmv, F_\tv \] |
| 90 |
% \end{verbatim} |
| 91 |
% \end{function} |
| 92 |
|
| 93 |
% \DescribeOption{ABC} |
| 94 |
% Passing \verb|ABC| to the \verb|presets| option allows you to use the \tn{v\meta{CHAR}}, \tn{\meta{CHAR}v}, and \tn{v\meta{CHAR}v} commands for all the upper-case letters \verb|A| through \verb|Z|. |
| 95 |
% \begin{function}{\v<CHAR>,\<CHAR>v} |
| 96 |
% \[ \vA, \vB, \vC, \Dv, \vEv, F_\Gv \] |
| 97 |
% \begin{verbatim} |
| 98 |
% \[ \vA, \vB, \vC, \Dv, \vEv, F_\Gv \] |
| 99 |
% \end{verbatim} |
| 100 |
% \end{function} |
| 101 |
|
| 102 |
% \DescribeOption{cAcBcC} |
| 103 |
% Passing \verb|cAcBcC| to the \verb|presets| option allows you to use the \tn{vc\meta{CHAR}}, \tn{c\meta{CHAR}v}, and \tn{vc\meta{CHAR}v} commands for all the upper-case letters \verb|A| through \verb|Z| to set arrows over \tn{mathcal}-letters. |
| 104 |
% \begin{function}{\vc<CHAR>,\c<CHAR>v} |
| 105 |
% \[ \vcA, \vcB, \vcC, \cDv, \vcEv, F_\cGv \] |
| 106 |
% \begin{verbatim} |
| 107 |
% \[ \vcA, \vcB, \vcC, \cDv, \vcEv, F_\cGv \] |
| 108 |
% \end{verbatim} |
| 109 |
% \end{function} |
| 110 |
|
| 111 |
% \DescribeOption{vec-cev} |
| 112 |
% Passing \verb|vec-cev| to the \verb|presets| option (re)defines the \tn{vec}, \tn{cev}, and \tn{vecev} commands. |
| 113 |
% \begin{function}{\vec,\cev} |
| 114 |
% Unlike the other commands these do not automatically consume subsequent subscripts or \verb|'| tokens. |
| 115 |
% \[ \vec{\mathbf{x}} := \cev{AB}\] |
| 116 |
% \begin{verbatim} |
| 117 |
% \[ \vec{\mathbf{x}} := \cev{AB}\] |
| 118 |
% \end{verbatim} |
| 119 |
% \end{function} |
| 120 |
|
| 121 |
% \subsection{The \tn{arrowoverset} command} |
| 122 |
% \begin{function}{\arrowoverset,\arrowoverset*} |
| 123 |
% \begin{syntax} |
| 124 |
% |\arrowoverset | [\meta{xoffset}] [\meta{xscale}] [\meta{yoffset}] \Arg{math} |
| 125 |
% |\arrowoverset*| [\meta{xoffset}] [\meta{xscale}] [\meta{yoffset}] \Arg{math} |
| 126 |
% \end{syntax} |
| 127 |
% This command sets a right (or left if \tn{arrowoverset*} is used) arrow over \meta{math}. |
| 128 |
% The base length of the arrow is the width of the \meta{math} multiplied by \meta{xscale}, which must be specified as a fraction \meta{num}\verb|/|\meta{denom}. |
| 129 |
% The arrow is offset by \meta{xoffset} to the right, which must be a math skip expression, and by \meta{yoffset} to the top, which must be a skip expression. |
| 130 |
|
| 131 |
% This command consumes subsequent subscripts or up to two primes \verb|'|. The former does not affect the length of the arrow. |
| 132 |
% \end{function} |
| 133 |
|
| 134 |
% \subsection{Other package options} |
| 135 |
% \DescribeOption{pgf} |
| 136 |
% If you specify the \verb|pgf| option, every arrow is drawn as a \verb|pgfpicture|. This requires the \pkg{pgf} package. |
| 137 |
% Double arrows are not implemented in pgf mode. |
| 138 |
% \begin{texnote} |
| 139 |
% You can set up custom arrow drawing code by redefining \cs{__jmt_lwa_arrow_draw:nnn}. |
| 140 |
% 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 |
% If \verb|#3| is \verb|-| if the arrow should point rightwards and empty otherwise. |
| 142 |
% \end{texnote} |
| 143 |
|
| 144 |
% \DescribeOption{linewidth} |
| 145 |
% Specifying \verb|linewidth=<value>| as a package option allows you to adjust the line width of the arrows to adjust for the weigth of the maths font you are using. |
| 146 |
% The default value is \verb|linewidth=0.3|. |
| 147 |
|
| 148 |
|
| 149 |
% \DescribeOption{tweaks} |
| 150 |
% Specifying the \verb|tweaks| option applies per-letter scaling adjustments to some of the single-letter shorthands. This is enabled by default. |
| 151 |
% 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|. |
| 152 |
% This documentation uses \verb|tweaks=false|. |
| 153 |
|
| 154 |
% \end{documentation} |
| 155 |
% \begin{implementation} |
| 156 |
% \section{Implementation} |
| 157 |
|
| 158 |
% \changes{2019/11/21}{2019/11/21}{Require \pkg{expl3} before \tn{ProvidesExplPackage}.} |
| 159 |
% \begin{macrocode} |
| 160 |
\NeedsTeXFormat{LaTeX2e} |
| 161 |
\RequirePackage{expl3} |
| 162 |
\ProvidesExplPackage {letterswitharrows} {2024/10/31} {} {Draw arrows over math letters.} |
| 163 |
\RequirePackage{xparse,l3keys2e,mathtools} |
| 164 |
% TODO: I just use mathtools for mathrlap; replace. |
| 165 |
|
| 166 |
%<@@=jmt_lwa> |
| 167 |
\msg_new:nnn {letterswitharrows} {pdf-only} {Only~pdf~output~is~supported.} |
| 168 |
\AtBeginDocument{ |
| 169 |
\sys_if_output_pdf:F { |
| 170 |
\msg_warning:nn {letterswitharrows} {pdf-only} |
| 171 |
} |
| 172 |
} |
| 173 |
% \end{macrocode} |
| 174 |
% The drawing code. |
| 175 |
% \changes{2021/07/10}{2021/07/19}{Implement adjustable linewidth.} |
| 176 |
% \changes{2024/10/31}{2023/03/11}{Add double arrows.} |
| 177 |
% \begin{macro}{\__@@_arrow_draw_special:nnn,\__@@_arrow_draw_double:nn,\__@@_arrow_draw_pgf:nnn,\__@@_arrow_left:nn,\__@@_arrow_right:nn,\__@@_arrow_double:nn} |
| 178 |
% \begin{macrocode} |
| 179 |
\cs_new:Nn \__@@_arrow_draw_special:nnn % length, font size, sign |
| 180 |
{ |
| 181 |
\sys_if_output_pdf:TF { |
| 182 |
\tex_special:D {pdf:~ |
| 183 |
q~ |
| 184 |
1~J~1~j~ |
| 185 |
1~0~0~\dim_to_decimal:n{#3#2pt/10}~0~0~cm~ |
| 186 |
\fp_use:c{g_@@_line_width}~w~ |
| 187 |
q~ |
| 188 |
\dim_to_decimal:n{#3#2pt/10}~0~0~1~0~0~cm~ |
| 189 |
1~0~0~1~-1~0~cm~ |
| 190 |
0~1~m~ |
| 191 |
.25~0~1~0~1~0~c~ |
| 192 |
1~0~.25~0~0~-1~c~ |
| 193 |
S~ |
| 194 |
Q~ |
| 195 |
Q~ |
| 196 |
q~ |
| 197 |
0~0~m~ |
| 198 |
-1~0~0~1~0~0~cm~ |
| 199 |
\fp_use:c{g_@@_line_width}~w~ |
| 200 |
\dim_to_decimal:n{#3#1}~0~l~S~ |
| 201 |
Q |
| 202 |
} |
| 203 |
} { |
| 204 |
\tex_special:D {"~ |
| 205 |
1~setlinecap~1~setlinejoin~ |
| 206 |
1~0~0~\dim_to_decimal:n{#3#2pt/10}~0~0~6~array~astore~concat~ |
| 207 |
\fp_use:c{g_@@_line_width}~setlinewidth~ |
| 208 |
gsave~ |
| 209 |
\dim_to_decimal:n{#3#2pt/10}~0~0~1~0~0~6~array~astore~concat~ |
| 210 |
1~0~0~1~-1~0~6~array~astore~concat~ |
| 211 |
0~1~moveto~ |
| 212 |
.25~0~1~0~1~0~curveto~ |
| 213 |
1~0~.25~0~0~-1~curveto~ |
| 214 |
stroke~ |
| 215 |
grestore~ |
| 216 |
0~0~moveto~ |
| 217 |
-1~0~0~1~0~0~6~array~astore~concat~ |
| 218 |
\dim_to_decimal:n{#3#1}~0~lineto~stroke |
| 219 |
} |
| 220 |
} |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
% TODO |
| 225 |
% \tl_new:N \g_@@_pgf_arrow_style_tl |
| 226 |
% \tl_set:Nn \g_@@_pgf_arrow_style_tl |
| 227 |
% {Computer~Modern~Rightarrow[width=#2pt*2/10,length=#2pt/10,sharp]} |
| 228 |
|
| 229 |
\cs_new:Nn \__@@_arrow_draw_pgf:nnn { |
| 230 |
\begin{pgfpicture} |
| 231 |
\pgfsetlinewidth{#2pt*\fp_use:c{g_@@_line_width}/10} |
| 232 |
\pgfsetarrowsstart |
| 233 |
{Computer~Modern~Rightarrow[width=#2pt*2/10,length=#2pt/10,sharp]} |
| 234 |
% \pgfsetarrowsstart{\tl_use:N \g_@@_pgf_arrow_style_tl} |
| 235 |
\pgfpathmoveto{\pgfpointorigin} |
| 236 |
\pgfpathlineto{\pgfpoint{-#3#1}{0cm}} |
| 237 |
\pgfusepath{stroke} |
| 238 |
\pgfresetboundingbox |
| 239 |
\end{pgfpicture} |
| 240 |
} |
| 241 |
|
| 242 |
\cs_new_eq:NN \__@@_arrow_draw:nnn \use_none:nnn |
| 243 |
|
| 244 |
|
| 245 |
\cs_new:Nn \__@@_arrow_draw_double:nn |
| 246 |
{ |
| 247 |
\tex_special:D {pdf:~ |
| 248 |
q~ |
| 249 |
1~J~1~j~ |
| 250 |
1~0~0~\dim_to_decimal:n{#2pt/10}~0~0~cm~ |
| 251 |
\fp_use:c{g__@@_line_width}~w~ |
| 252 |
q~ |
| 253 |
\dim_to_decimal:n{#2pt/10}~0~0~1~0~0~cm~ |
| 254 |
1~0~0~1~-1~0~cm~ |
| 255 |
0~1~m~ |
| 256 |
.25~0~1~0~1~0~c~ |
| 257 |
1~0~.25~0~0~-1~c~ |
| 258 |
S~ |
| 259 |
Q~ |
| 260 |
0~0~m~ |
| 261 |
-1~0~0~1~0~0~cm~ |
| 262 |
\dim_to_decimal:n{#1}~0~l~S~ |
| 263 |
\dim_to_decimal:n{#2pt/10}~0~0~1~\dim_to_decimal:n{#1}~0~cm~ |
| 264 |
1~0~0~1~-1~0~cm~ |
| 265 |
0~1~m~ |
| 266 |
.25~0~1~0~1~0~c~ |
| 267 |
1~0~.25~0~0~-1~c~ |
| 268 |
S~ |
| 269 |
Q |
| 270 |
} |
| 271 |
} |
| 272 |
|
| 273 |
|
| 274 |
\cs_new:Nn \__@@_arrow_right:nn { |
| 275 |
\skip_horizontal:n {#1} |
| 276 |
\__@@_arrow_draw:nnn {#1} {#2} {} |
| 277 |
} |
| 278 |
|
| 279 |
\cs_new:Nn \__@@_arrow_left:nn { |
| 280 |
\__@@_arrow_draw:nnn {#1} {#2} {-} |
| 281 |
\skip_horizontal:n {#1} |
| 282 |
} |
| 283 |
|
| 284 |
\cs_new:Nn \__@@_arrow_double:nn { |
| 285 |
\skip_horizontal:n {#1} |
| 286 |
\__@@_arrow_draw_double:nn {#1} {#2} |
| 287 |
} |
| 288 |
|
| 289 |
% \end{macrocode} |
| 290 |
% \end{macro} |
| 291 |
|
| 292 |
% The core functions. |
| 293 |
% \changes{2020/05/08}{2020/05/08}{Reset tabskip. Fixes spacing in aligned environments} |
| 294 |
% \begin{macro}{\__@@_arrow_overset_style:Nnncnnn,\__@@_arrow_overset:nnnnn} |
| 295 |
% \begin{macrocode} |
| 296 |
\cs_new:Npn \__@@_arrow_overset_style:Nnncnnn #1#2#3#4#5#6#7 { |
| 297 |
\hbox_set:Nn \l_tmpa_box {$\m@th#1#3$} |
| 298 |
\dim_set:Nn \l_tmpa_dim {#2 pt/10} |
| 299 |
\vbox:n { |
| 300 |
\tex_lineskiplimit:D = \maxdimen |
| 301 |
\tex_baselineskip:D = 0pt |
| 302 |
\tex_tabskip:D = 0pt |
| 303 |
\tex_lineskip:D = \dim_eval:n {\l_tmpa_dim * 3/2 + #7} |
| 304 |
\tex_halign:D { ## \tex_cr:D |
| 305 |
\skip_horizontal:n {\l_tmpa_dim / 2} |
| 306 |
$ |
| 307 |
\m@th |
| 308 |
#1 |
| 309 |
\tex_mskip:D \muskip_eval:n {#5} |
| 310 |
\use:c {#4} {\dim_eval:n{\box_wd:N \l_tmpa_box * #6}} {#2} |
| 311 |
$ |
| 312 |
\tex_cr:D |
| 313 |
\box_use_drop:N \l_tmpa_box |
| 314 |
\tex_cr:D |
| 315 |
} |
| 316 |
} |
| 317 |
} |
| 318 |
|
| 319 |
\cs_new:Nn \__@@_arrow_overset:nnnnn { % content, direction, xoffset, scale, yoffset |
| 320 |
\mathchoice { |
| 321 |
\__@@_arrow_overset_style:Nnncnnn |
| 322 |
\displaystyle {\tf@size} {#1} {__@@_arrow_#2:nn} {#3} {#4} {#5} |
| 323 |
} { |
| 324 |
\__@@_arrow_overset_style:Nnncnnn |
| 325 |
\textstyle {\tf@size} {#1} {__@@_arrow_#2:nn} {#3} {#4} {#5} |
| 326 |
} { |
| 327 |
\__@@_arrow_overset_style:Nnncnnn |
| 328 |
\scriptstyle {\sf@size} {#1} {__@@_arrow_#2:nn} {#3} {#4} {#5} |
| 329 |
} { |
| 330 |
\__@@_arrow_overset_style:Nnncnnn |
| 331 |
\scriptscriptstyle {\ssf@size} {#1} {__@@_arrow_#2:nn} {#3} {#4} {#5} |
| 332 |
} |
| 333 |
} |
| 334 |
% \end{macrocode} |
| 335 |
% \end{macro} |
| 336 |
|
| 337 |
% \begin{macro}{\@@_arrow_overset:w,\arrowoverset} |
| 338 |
% \changes{2019/02/04}{2019/02/04}{Subscript spacing adjustments} |
| 339 |
% \begin{macrocode} |
| 340 |
\cs_new_protected:Npn \@@_arrow_overset:w { |
| 341 |
\c_group_begin_token |
| 342 |
\__@@_arrow_overset_aux:w |
| 343 |
} |
| 344 |
|
| 345 |
\cs_new:Nn \__@@_bool_convert:n { |
| 346 |
\IfBooleanTF {#1} {\c_true_bool} {\c_false_bool} |
| 347 |
} |
| 348 |
|
| 349 |
% This exp_args is necessary because _ generates the wrong token in expl3 syntax |
| 350 |
\exp_args:NNx \NewDocumentCommand \__@@_arrow_overset_aux:w |
| 351 |
{s s O{0mu} O{1} O{0ex} m t' e{\char_generate:nn {95}{8}} t'} { |
| 352 |
\__@@_arrow_overset:nnnnn |
| 353 |
{ |
| 354 |
#6 |
| 355 |
\exp_args:Nf\bool_if:nT{\__@@_bool_convert:n{#7} || \__@@_bool_convert:n{#9}} { |
| 356 |
\c_math_superscript_token { |
| 357 |
\scriptscriptstyle\IfBooleanT{#7}{\prime}\IfBooleanT{#9}{\prime} |
| 358 |
} |
| 359 |
} % TODO: Better positioning etc? |
| 360 |
\exp_args:Nf\IfValueT{\use:n#8} { |
| 361 |
\c_math_subscript_token { |
| 362 |
\mathrlap{#8} |
| 363 |
} |
| 364 |
} |
| 365 |
} |
| 366 |
{\IfBooleanTF{#1}{\IfBooleanTF{#2}{double}{left}}{right}} |
| 367 |
{#3} {#4} {#5} |
| 368 |
|
| 369 |
\exp_args:Nf\IfValueTF{\use:n#8}{ |
| 370 |
% TODO: Better way to do this? This is all kinds of wrong. |
| 371 |
\hphantom{\c_math_subscript_token{#8}} |
| 372 |
} {} |
| 373 |
\c_group_end_token |
| 374 |
} |
| 375 |
\cs_set_eq:NN \arrowoverset \@@_arrow_overset:w |
| 376 |
% \end{macrocode} |
| 377 |
% Replacements for \pkg{hyperref} bookmarks. |
| 378 |
% \begin{macrocode} |
| 379 |
\AtBeginDocument{ |
| 380 |
\@ifpackageloaded{hyperref}{ |
| 381 |
\pdfstringdefDisableCommands{ |
| 382 |
% Why does this only work with Expandable? |
| 383 |
\DeclareExpandableDocumentCommand \@@_arrow_overset:w {s o o o m} { |
| 384 |
\ifpdfstringunicode |
| 385 |
{#5 \IfBooleanTF{#1}{\unichar{"20D6}}{\unichar{"20D7}}} |
| 386 |
{#5} |
| 387 |
} |
| 388 |
} |
| 389 |
}{} |
| 390 |
} |
| 391 |
% \end{macrocode} |
| 392 |
% \end{macro} |
| 393 |
|
| 394 |
% Package option handling. |
| 395 |
% \begin{variable}{\g_@@_tweak_shortcuts_bool,\g_@@_selected_presets_prop} |
| 396 |
% \begin{macro}{\__@@_arrow_draw:nnn} |
| 397 |
% \begin{macrocode} |
| 398 |
\bool_new:N \g_@@_tweak_shortcuts_bool |
| 399 |
\prop_new:N \g_@@_selected_presets_prop |
| 400 |
\keys_define:nn {letterswitharrows} { |
| 401 |
mode .choice:, |
| 402 |
mode / special .code:n = { |
| 403 |
\cs_set_eq:NN \__@@_arrow_draw:nnn \__@@_arrow_draw_special:nnn |
| 404 |
}, |
| 405 |
mode / pgf .code:n = { |
| 406 |
\RequirePackage{pgf} |
| 407 |
\ExplSyntaxOff\usepgflibrary{arrows.meta}\ExplSyntaxOn |
| 408 |
\cs_set_eq:NN \__@@_arrow_draw:nnn \__@@_arrow_draw_pgf:nnn |
| 409 |
}, |
| 410 |
mode .initial:n = {special}, |
| 411 |
pgf .meta:n = {mode = pgf}, |
| 412 |
presets .multichoices:nn = {abc, ABC, cAcBcC, vec-cev} { |
| 413 |
\int_compare:nNnTF \l_keys_choice_int = 1 { |
| 414 |
\prop_gclear:N \g_@@_selected_presets_prop |
| 415 |
} {} |
| 416 |
\prop_gput:NVn \g_@@_selected_presets_prop \l_keys_choice_tl {} |
| 417 |
}, |
| 418 |
presets .initial:n = {abc, ABC, cAcBcC}, |
| 419 |
tweaks .bool_set:N = \g_@@_tweak_shortcuts_bool, |
| 420 |
tweaks .initial:n = {true}, |
| 421 |
linewidth .fp_set:N = \g_@@_line_width, |
| 422 |
linewidth .initial:n = {.3}, |
| 423 |
} |
| 424 |
\ProcessKeysPackageOptions{letterswitharrows} |
| 425 |
% \end{macrocode} |
| 426 |
% \end{macro} |
| 427 |
% \end{variable} |
| 428 |
|
| 429 |
% \begin{macro}{\v<char>,\<char>v,\vleft,\vright,\v<char>v} |
| 430 |
% \begin{macrocode} |
| 431 |
\prop_if_in:NnTF \g_@@_selected_presets_prop {abc} { |
| 432 |
\int_step_inline:nnn {1} {26} { |
| 433 |
\int_compare:nNnTF {#1} = {22} { |
| 434 |
\cs_new:cpx {vright} { |
| 435 |
\exp_not:N\@@_arrow_overset:w{v} |
| 436 |
} |
| 437 |
\cs_new:cpx {vleft} { |
| 438 |
\exp_not:N\@@_arrow_overset:w*{v} |
| 439 |
} |
| 440 |
\cs_new:cpx {vvv} { |
| 441 |
\exp_not:N\@@_arrow_overset:w**{v} |
| 442 |
} |
| 443 |
} { |
| 444 |
\cs_new:cpx {v\int_to_alph:n{#1}} { |
| 445 |
\exp_not:N\@@_arrow_overset:w{\int_to_alph:n{#1}} |
| 446 |
} |
| 447 |
\cs_new:cpx {\int_to_alph:n{#1}v} { |
| 448 |
\exp_not:N\@@_arrow_overset:w*{\int_to_alph:n{#1}} |
| 449 |
} |
| 450 |
\cs_new:cpx {v\int_to_alph:n{#1}v} { |
| 451 |
\exp_not:N\@@_arrow_overset:w**{\int_to_alph:n{#1}} |
| 452 |
} |
| 453 |
} |
| 454 |
} |
| 455 |
} {} |
| 456 |
% \end{macrocode} |
| 457 |
% \end{macro} |
| 458 |
% \begin{macro}{\v<CHAR>,\<CHAR>v,\v<CHAR>v} |
| 459 |
% \begin{macrocode} |
| 460 |
\prop_if_in:NnTF \g_@@_selected_presets_prop {ABC} { |
| 461 |
\int_step_inline:nnn {1} {26} { |
| 462 |
\cs_new:cpx {v\int_to_Alph:n{#1}} { |
| 463 |
\exp_not:N\@@_arrow_overset:w{\int_to_Alph:n{#1}} |
| 464 |
} |
| 465 |
\cs_new:cpx {\int_to_Alph:n{#1}v} { |
| 466 |
\exp_not:N\@@_arrow_overset:w*{\int_to_Alph:n{#1}} |
| 467 |
} |
| 468 |
\cs_new:cpx {v\int_to_Alph:n{#1}v} { |
| 469 |
\exp_not:N\@@_arrow_overset:w**{\int_to_Alph:n{#1}} |
| 470 |
} |
| 471 |
} |
| 472 |
} {} |
| 473 |
% \end{macrocode} |
| 474 |
% \end{macro} |
| 475 |
% \begin{macro}{\vc<CHAR>,\c<CHAR>v,\vc<CHAR>v} |
| 476 |
% \begin{macrocode} |
| 477 |
\prop_if_in:NnTF \g_@@_selected_presets_prop {cAcBcC} { |
| 478 |
\int_step_inline:nnn {1} {26} { |
| 479 |
\cs_new:cpx {vc\int_to_Alph:n{#1}} { |
| 480 |
\exp_not:N\@@_arrow_overset:w{\exp_not:N\mathcal{\int_to_Alph:n{#1}}} |
| 481 |
} |
| 482 |
\cs_new:cpx {c\int_to_Alph:n{#1}v} { |
| 483 |
\exp_not:N\@@_arrow_overset:w*{\exp_not:N\mathcal{\int_to_Alph:n{#1}}} |
| 484 |
} |
| 485 |
\cs_new:cpx {vc\int_to_Alph:n{#1}v} { |
| 486 |
\exp_not:N\@@_arrow_overset:w**{\exp_not:N\mathcal{\int_to_Alph:n{#1}}} |
| 487 |
} |
| 488 |
} |
| 489 |
} {} |
| 490 |
% \end{macrocode} |
| 491 |
% \end{macro} |
| 492 |
% \begin{macro}{\vec,\cev,\vecev} |
| 493 |
% \begin{macrocode} |
| 494 |
\prop_if_in:NnTF \g_@@_selected_presets_prop {vec-cev} { |
| 495 |
\RenewDocumentCommand \vec {m} { |
| 496 |
\@@_arrow_overset:w {#1} \scan_stop: |
| 497 |
} |
| 498 |
\DeclareDocumentCommand \cev {m} { |
| 499 |
\@@_arrow_overset:w* {#1} \scan_stop: |
| 500 |
} |
| 501 |
\DeclareDocumentCommand \vecev {m} { |
| 502 |
\@@_arrow_overset:w** {#1} \scan_stop: |
| 503 |
} |
| 504 |
} {} |
| 505 |
% \end{macrocode} |
| 506 |
% \end{macro} |
| 507 |
% Some personal-preference tweaks. |
| 508 |
% \changes{2019/02/04}{2019/02/04}{Tweaks for capital letters.} |
| 509 |
% \begin{macrocode} |
| 510 |
\bool_if:NTF \g_@@_tweak_shortcuts_bool { |
| 511 |
\prop_if_in:NnTF \g_@@_selected_presets_prop {ABC} { |
| 512 |
\int_step_inline:nnn {1} {26} { |
| 513 |
\cs_set:cpx {v\int_to_Alph:n{#1}} { |
| 514 |
\exp_not:N\@@_arrow_overset:w[2.5mu][8/10]{\int_to_Alph:n{#1}} |
| 515 |
} |
| 516 |
\cs_set:cpx {\int_to_Alph:n{#1}v} { |
| 517 |
\exp_not:N\@@_arrow_overset:w*[2.5mu][7/10]{\int_to_Alph:n{#1}} |
| 518 |
} |
| 519 |
\cs_set:cpx {v\int_to_Alph:n{#1}v} { |
| 520 |
\exp_not:N\@@_arrow_overset:w**[1.5mu][9/10]{\int_to_Alph:n{#1}} |
| 521 |
} |
| 522 |
} |
| 523 |
\cs_set:cpn {vS} { |
| 524 |
\@@_arrow_overset:w[3mu][7/10]{S} |
| 525 |
} |
| 526 |
\cs_set:cpn {vSv} { |
| 527 |
\@@_arrow_overset:w**[2mu][9/10]{S} |
| 528 |
} |
| 529 |
\cs_set:cpn {vT} { |
| 530 |
\@@_arrow_overset:w[2mu][8/10]{T} |
| 531 |
} |
| 532 |
\cs_set:cpn {Tv} { |
| 533 |
\@@_arrow_overset:w*[1mu][8/10]{T} |
| 534 |
} |
| 535 |
\cs_set:cpn {vU} { |
| 536 |
\@@_arrow_overset:w[2mu][7/10]{U} |
| 537 |
} |
| 538 |
\cs_set:cpn {Uv} { |
| 539 |
\@@_arrow_overset:w*[2mu][7/10]{U} |
| 540 |
} |
| 541 |
\cs_set:cpn {vUv} { |
| 542 |
\@@_arrow_overset:w**[1.5mu][8/10]{U} |
| 543 |
} |
| 544 |
\cs_set:cpn {vV} { |
| 545 |
\@@_arrow_overset:w[2.5mu][7/10]{V} |
| 546 |
} |
| 547 |
\cs_set:cpn {Vv} { |
| 548 |
\@@_arrow_overset:w*[2mu][7/10]{V} |
| 549 |
} |
| 550 |
\cs_set:cpn {vX} { |
| 551 |
\@@_arrow_overset:w[3mu][7/10]{X} |
| 552 |
} |
| 553 |
\cs_set:cpn {vY} { |
| 554 |
\@@_arrow_overset:w[2mu][8/10]{Y} |
| 555 |
} |
| 556 |
\cs_set:cpn {Yv} { |
| 557 |
\@@_arrow_overset:w*[2mu][7/10]{Y} |
| 558 |
} |
| 559 |
} {} |
| 560 |
\prop_if_in:NnTF \g_@@_selected_presets_prop {cAcBcC} { |
| 561 |
\int_step_inline:nnn {1} {26} { |
| 562 |
\cs_set:cpx {vc\int_to_Alph:n{#1}} { |
| 563 |
\exp_not:N\@@_arrow_overset:w[1mu][9/10]{\exp_not:N\mathcal{\int_to_Alph:n{#1}}} |
| 564 |
} |
| 565 |
\cs_set:cpx {c\int_to_Alph:n{#1}v} { |
| 566 |
\exp_not:N\@@_arrow_overset:w*[1.5mu][8/10]{\exp_not:N\mathcal{\int_to_Alph:n{#1}}} |
| 567 |
} |
| 568 |
} |
| 569 |
} {} |
| 570 |
\prop_if_in:NnTF \g_@@_selected_presets_prop {abc} { |
| 571 |
\cs_new:cpn {vell} { |
| 572 |
\@@_arrow_overset:w{\ell} |
| 573 |
} |
| 574 |
\cs_new:cpn {ellv} { |
| 575 |
\@@_arrow_overset:w*{\ell} |
| 576 |
} |
| 577 |
\cs_new:cpn {vellv} { |
| 578 |
\@@_arrow_overset:w**{\ell} |
| 579 |
} |
| 580 |
} {} |
| 581 |
} {} |
| 582 |
% \end{macrocode} |
| 583 |
% \end{implementation} |
| 584 |
|