blob: dd16e05ea3761847fcbe5178c1dcbb4799af861e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
%%
%% This is file `dynamicnumber.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% dynamicnumber.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2015 by Olivier Pieters
%%
%% This file may be distributed and/or modified under the
%% conditions of the MIT License, a version can be found
%% in the GitHub repository:
%%
%% https://github.com/opieters/DynamicNumber
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{dynamicnumber}
[2015/10/04 v0.1.1 Dynamic Number package]
%% \DescribeMacro{\dncurrent}
\RequirePackage{pgfkeys}
\RequirePackage{xparse}
\newread\dninstream
\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\@IfNoValueOrEmptyTF}{mmm}
{
\IfNoValueTF{#1}{#2}
{
\tl_if_empty:nTF {#1} {#2} {#3}
}
}
\ExplSyntaxOff
\DeclareDocumentCommand{\dndeclare}{m}{%
\pgfkeys{%
/dynamicnumber/#1/.is family,
/dynamicnumber/#1/.unknown/.style = {%
\pgfkeyscurrentpath/\pgfkeyscurrentname/.initial = ##1%
}
}%
}
\DeclareDocumentCommand{\dnsetcurrent}{m}{%
\@ifundefined{dncurrent}{%
\DeclareDocumentCommand{\dncurrent}{}{#1}%
}
{%
\RenewDocumentCommand{\dncurrent}{}{#1}%
}%
}
\DeclareDocumentCommand{\dnload}{m}{%
\IfFileExists{#1.dnlist}{%
\immediate\openin\dninstream=#1.dnlist
\@whilesw\unless\ifeof\dninstream\fi{%
\immediate\read\dninstream to \@auxcommand
\@auxcommand
}%
\immediate\closein\dninstream%
\dnsetcurrent{#1}%
}{}%
}
\DeclareDocumentCommand{\dnget}{O{} m}{%
\@IfNoValueOrEmptyTF{#1}{%
\pgfkeysvalueof{/dynamicnumber/\dncurrent/#2}}{%
\pgfkeysvalueof{/dynamicnumber/#1/#2}}%
}
\endinput
%%
%% End of file `dynamicnumber.sty'.
|