|
229 | 229 | \NewDocumentCommand{\ind}{}{\mathcolor{lightgray}{\bullet}} |
230 | 230 |
|
231 | 231 | %% Argument placeholder |
232 | | -\NewDocumentCommand{\argument}{s O{} O{1}}{% |
233 | | - \def\squaresize{1.0}% % default size |
234 | | - \IfBooleanT{#1}{\def\squaresize{0.7}}% % if starred, set size corresponding to scriptstyle |
235 | | - \IfBlankF{#2}{\def\squaresize{#2}}% % if optional argument is passed, set size to custom value |
236 | | - % TODO: utilize \mathpalette |
237 | | - \scalebox{\squaresize}{% |
238 | | - \begin{tikzpicture}[baseline=-#3*0.6ex] |
239 | | - \node(char)[draw, shape=rectangle, dash=on 1.2pt off 1.05pt phase 0.5pt, dash expand off, |
240 | | - inner ysep=2pt, inner xsep=2pt, minimum size=0.6em, rounded corners=2pt] {}; |
241 | | - %% alternative: |
242 | | - % \node(char)[draw, shape=rectangle, dash=on 1.1pt off 0.8pt phase 0.5pt, dash expand off, |
243 | | - % inner ysep=2pt, inner xsep=2pt, minimum size=0.6em, rounded corners=2pt] {}; |
244 | | - \end{tikzpicture}% |
| 232 | +\newsavebox{\argumentbox} |
| 233 | +\sbox{\argumentbox}{% |
| 234 | + \begin{tikzpicture}[baseline=-0.6ex] |
| 235 | + \node(char)[draw, shape=rectangle, dash=on 1.2pt off 1.05pt phase 0.5pt, dash expand off, |
| 236 | + inner ysep=2pt, inner xsep=2pt, minimum size=0.6em, rounded corners=2pt] {}; |
| 237 | + \end{tikzpicture}% |
| 238 | +} |
| 239 | +\NewDocumentCommand{\argument}{o}{% |
| 240 | + \IfValueTF{#1}{% use #1 as a scaling factor, resizebox relative to the text size |
| 241 | + \scalebox{#1}{\resizebox{!}{0.58em}{\usebox{\argumentbox}}} |
| 242 | + }{% choose scaling factor based on display/text/script/scriptscript math style |
| 243 | + \mathchoice{\argument[1.0]}{\argument[1.0]}{\argument[0.7]}{\argument[0.6]} |
245 | 244 | }% |
246 | 245 | } |
247 | 246 |
|
|
0 commit comments