|
17 | 17 | % \iffalse |
18 | 18 | %<package>\NeedsTeXFormat{LaTeX2e}[2020/02/02] |
19 | 19 | %<package>\ProvidesPackage{datax} |
20 | | -%<package> [2020/11/16 v1.1 data import into LaTeX] |
| 20 | +%<package> [2020/11/17 v1.1 data import into LaTeX] |
21 | 21 | %<package>\RequirePackage{pgfkeys} |
22 | 22 | %<package>\RequirePackage{pgfopts} |
23 | | -%<package>\ProcessPgfPackageOptions{/packageoptions} |
24 | | -% |
25 | 23 | % |
26 | 24 | %<*driver> |
27 | | -\begin{filecontents}{data.tex} |
| 25 | +\begin{filecontents}{datax-example-data.tex} |
28 | 26 | \pgfkeyssetvalue{/datax/s}{A literal string} |
29 | 27 | \pgfkeyssetvalue{/datax/x}{\num{2.4}} |
30 | 28 | \pgfkeyssetvalue{/datax/c}{\SI{3e8}{\meter\per\second}} |
31 | 29 | \end{filecontents} |
32 | 30 | \documentclass{ltxdoc} |
33 | | -\usepackage{datax} |
| 31 | +\usepackage[dataxfile=datax-example-data.tex]{datax} |
34 | 32 | \usepackage{booktabs} |
35 | 33 | \usepackage{siunitx} |
36 | 34 | \usepackage[hidelinks]{hyperref} |
|
44 | 42 | %</driver> |
45 | 43 | % \fi |
46 | 44 | % |
47 | | -%\CheckSum{16} |
| 45 | +%\CheckSum{19} |
48 | 46 | % |
49 | 47 | % \CharacterTable |
50 | 48 | % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
|
103 | 101 | % |
104 | 102 | % \section{Interactions} |
105 | 103 | % Technically, \textsf{datax} only needs a data file consisting of a number of assignments: |
106 | | -% |
107 | 104 | % |\pgfkeyssetvalue{/datax/|\meta{tag}|}{|\meta{value}|}| |
108 | | -% |
109 | 105 | % but of course the entire point of the package is automation. For this, you need an interaction plugin for your script |
110 | 106 | % language. If your language is not listed below, you might need to write this plugin for yourself, or request it. |
111 | 107 | % \begin{center} |
|
122 | 118 | % |
123 | 119 | % \begin{macrocode} |
124 | 120 | \pgfkeys{ % |
125 | | - /packageoptions/.cd, % |
126 | | - dataxfile/.store in = \dataxfile, % |
127 | | - dataxfile = data.tex, % |
| 121 | + /packageoptions/dataxfile/.initial=data.tex, % |
128 | 122 | } |
| 123 | +\ProcessPgfPackageOptions{/packageoptions} |
129 | 124 |
|
130 | 125 | \pgfkeys{ % |
131 | 126 | /datax/.is family, datax, % |
|
138 | 133 | }, % |
139 | 134 | } |
140 | 135 |
|
141 | | -\InputIfFileExists{\dataxfile}{}{\PackageWarning{Cannot read file `\dataxfile' }} |
| 136 | +\def\dataxfile{./\pgfkeysvalueof{/packageoptions/dataxfile}} |
| 137 | +\InputIfFileExists{% |
| 138 | + \dataxfile |
| 139 | + }{}{ |
| 140 | + \PackageWarning{datax}{Cannot read file `\dataxfile'} |
| 141 | +} |
142 | 142 | % \end{macrocode} |
143 | 143 | % \begin{macro}{\datax} |
144 | 144 | % Include datum from the specified data file. |
|
147 | 147 | \pgfkeysifdefined{/datax/#1}{ % |
148 | 148 | \pgfkeysvalueof{/datax/#1} % |
149 | 149 | }{ % |
150 | | - \PackageWarning{datax}{Data value `#1' undefined }\textbf{??} % |
| 150 | + \PackageWarning{datax}{Data value `#1' undefined}\textbf{??} % |
151 | 151 | } % |
152 | 152 | } |
153 | 153 | % \end{macrocode} |
|
0 commit comments