Skip to content

Commit

Permalink
Polishing for 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gustaphe committed Nov 17, 2020
1 parent 23641cc commit 931299f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
all: datax.zip README.html

datax.zip: datax.pdf datax.dtx datax.ins README.md
mkdir datax
mkdir -p datax
cp $^ datax/
7z a $@ datax

datax.pdf : datax.dtx datax.sty
pdflatex -file-line-error -interaction=nonstopmode $<

datax.sty : datax.ins
pdflatex -file-line-error -interaction=nonstopmode $<
datax.sty : datax.ins datax.dtx
pdflatex -file-line-error $<

README.html: README.md
md2html $<
md2html $< > $@

clean :
$(RM) -rd datax
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ LaTeX document
The calculated length was \(a=\datax{a}\).
```

## Copyright and license
Copyright 2020 David Gustavsson

This package may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.3 of this license or (at your option) any later
version. The latest version of this license is in:

http://www.latex-project.org/lppl.txt

and version 1.3 or later is part of all distributions of
LaTeX version 2005/12/01 or later.
26 changes: 13 additions & 13 deletions datax.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[2020/02/02]
%<package>\ProvidesPackage{datax}
%<package> [2020/11/16 v1.1 data import into LaTeX]
%<package> [2020/11/17 v1.1 data import into LaTeX]
%<package>\RequirePackage{pgfkeys}
%<package>\RequirePackage{pgfopts}
%<package>\ProcessPgfPackageOptions{/packageoptions}
%
%
%<*driver>
\begin{filecontents}{data.tex}
\begin{filecontents}{datax-example-data.tex}
\pgfkeyssetvalue{/datax/s}{A literal string}
\pgfkeyssetvalue{/datax/x}{\num{2.4}}
\pgfkeyssetvalue{/datax/c}{\SI{3e8}{\meter\per\second}}
\end{filecontents}
\documentclass{ltxdoc}
\usepackage{datax}
\usepackage[dataxfile=datax-example-data.tex]{datax}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage[hidelinks]{hyperref}
Expand All @@ -44,7 +42,7 @@
%</driver>
% \fi
%
%\CheckSum{16}
%\CheckSum{19}
%
% \CharacterTable
% {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
Expand Down Expand Up @@ -103,9 +101,7 @@
%
% \section{Interactions}
% Technically, \textsf{datax} only needs a data file consisting of a number of assignments:
%
% |\pgfkeyssetvalue{/datax/|\meta{tag}|}{|\meta{value}|}|
%
% but of course the entire point of the package is automation. For this, you need an interaction plugin for your script
% language. If your language is not listed below, you might need to write this plugin for yourself, or request it.
% \begin{center}
Expand All @@ -122,10 +118,9 @@
%
% \begin{macrocode}
\pgfkeys{ %
/packageoptions/.cd, %
dataxfile/.store in = \dataxfile, %
dataxfile = data.tex, %
/packageoptions/dataxfile/.initial=data.tex, %
}
\ProcessPgfPackageOptions{/packageoptions}

\pgfkeys{ %
/datax/.is family, datax, %
Expand All @@ -138,7 +133,12 @@
}, %
}

\InputIfFileExists{\dataxfile}{}{\PackageWarning{Cannot read file `\dataxfile' }}
\def\dataxfile{./\pgfkeysvalueof{/packageoptions/dataxfile}}
\InputIfFileExists{%
\dataxfile
}{}{
\PackageWarning{datax}{Cannot read file `\dataxfile'}
}
% \end{macrocode}
% \begin{macro}{\datax}
% Include datum from the specified data file.
Expand All @@ -147,7 +147,7 @@
\pgfkeysifdefined{/datax/#1}{ %
\pgfkeysvalueof{/datax/#1} %
}{ %
\PackageWarning{datax}{Data value `#1' undefined }\textbf{??} %
\PackageWarning{datax}{Data value `#1' undefined}\textbf{??} %
} %
}
% \end{macrocode}
Expand Down

0 comments on commit 931299f

Please sign in to comment.