diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/pst-calculate |
Initial commit
Diffstat (limited to 'macros/latex/contrib/pst-calculate')
-rw-r--r-- | macros/latex/contrib/pst-calculate/Changes | 2 | ||||
-rw-r--r-- | macros/latex/contrib/pst-calculate/README.md | 12 | ||||
-rw-r--r-- | macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.bib | 15 | ||||
-rw-r--r-- | macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.pdf | bin | 0 -> 42398 bytes | |||
-rw-r--r-- | macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.tex | 108 | ||||
-rw-r--r-- | macros/latex/contrib/pst-calculate/latex/pst-calculate.sty | 57 |
6 files changed, 194 insertions, 0 deletions
diff --git a/macros/latex/contrib/pst-calculate/Changes b/macros/latex/contrib/pst-calculate/Changes new file mode 100644 index 0000000000..e210557ccc --- /dev/null +++ b/macros/latex/contrib/pst-calculate/Changes @@ -0,0 +1,2 @@ +0.02 2019-01-24 - fix for wrong package message +0.01 2018-02-04 - first CTAN version diff --git a/macros/latex/contrib/pst-calculate/README.md b/macros/latex/contrib/pst-calculate/README.md new file mode 100644 index 0000000000..24775f4f59 --- /dev/null +++ b/macros/latex/contrib/pst-calculate/README.md @@ -0,0 +1,12 @@ +# README # +Package pst-calculate defines two macros +which uses the capabilities +from LaTeX3 for calculating the values of +functions. It works only for LaTeX and not +for real TeX documents. + +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.3 or, at your option, any later version. + +Herbert Voß <hvoss@tug.org>
\ No newline at end of file diff --git a/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.bib b/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.bib new file mode 100644 index 0000000000..0913bdbd24 --- /dev/null +++ b/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.bib @@ -0,0 +1,15 @@ +@ctan{l3, +author = {{The \LaTeX3\ project}}, + title = {The \texttt{expl3} package and \LaTeX3\ programming}, + date = {2017-12-16}, + urldate = {2018-02-04}, + url = {/latex/macros/contrib/l3kernel/expl3.pdf} +} +@ctan{xfp, +author = {{The \LaTeX3\ project}}, +title = {The \texttt{xfp} package -- Floating Point Unit}, +Organisation = {CTAN}, +url = {/pkg/xfp}, + urldate = {2018-02-04}, +} + diff --git a/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.pdf b/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.pdf Binary files differnew file mode 100644 index 0000000000..c8649dd593 --- /dev/null +++ b/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.pdf diff --git a/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.tex b/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.tex new file mode 100644 index 0000000000..174b15c174 --- /dev/null +++ b/macros/latex/contrib/pst-calculate/doc/pst-calculate-doc.tex @@ -0,0 +1,108 @@ +%% $Id: pst-calculate-doc.tex 919 2019-01-24 20:23:36Z herbert $ +% +\listfiles +\documentclass[fontsize=11pt,DIV=14,parskip=half-]{scrartcl} +\usepackage[T1]{fontenc} + +\usepackage{graphicx} +\usepackage{multido} +\usepackage{libertine} +\usepackage[scaled=0.88]{beramono} +\usepackage{pst-calculate} % support opentype spark fonts +\makeatletter +\let\Version\pstcalculate@version +\makeatother + +\usepackage{showexpl,xltabular,booktabs,xurl,xcolor,ragged2e} +\lstset{% + language=[LaTeX]TeX,% + float=hbp,% + basicstyle=\ttfamily\small, % + keywordstyle=\bfseries, % + columns=flexible, % + tabsize=4, % +% frame=single, % + extendedchars=true, % + showspaces=false, % + showstringspaces=false, % +% numbers=left, +% numbersep=0.8em, +% numberstyle=\tiny, % + breaklines=true, % + breakautoindent=true, + captionpos=b, + xleftmargin=1em +} + +\usepackage[style=dtk]{biblatex} +\addbibresource{\jobname.bib} + +\usepackage{dtk-logos} % for Wikipedia W + +\pagestyle{headings} + +\usepackage[colorlinks,hyperfootnotes=false]{hyperref} +% define \code for url-like breaking of typewriter fragments. +\ifx\nolinkurl\undefined \let\code\url \else \let\code\nolinkurl \fi + +% Define \cs to prepend a backslash, and be unbreakable: +\DeclareRobustCommand\cs[1]{\mbox{\texttt{\char`\\#1}}} + + +\title{Support for floating point operations on \LaTeX-Level \\--\\ v.~\Version} +\author{Herbert Voß} +\begin{document} +\maketitle +\tableofcontents + +\section{Introduction} + +The upcoming \LaTeX3 can already be used. It is more or less stable and +macros will change only if really needed. + + +\section{Package options} +The package knows two optional arguments which, of course, have a corresponding +name in package \texttt{siunitx}. One can also use that one. + +\begin{tabularx}{\linewidth}{@{}llX@{}}\toprule +\emph{name} & \emph{\texttt{siunitx}} & \emph{description}\\\midrule +\texttt{useComma} & \texttt{output-decimal-marker=\{,\}} & Output always a comma instead of the default dot.\\ +\texttt{roundDigit}& \texttt{round-mode=places,round-precision=<value>} & round the given digit number.\\ +\bottomrule +\end{tabularx} + +\section{Using the macros} + +\begin{LTXexample}[pos=t] +\psCalculate{3.14126*314^2}\\ % Uses \num from siunitx +\pscalculate{3.14126*314^2} % doesn't use \num +\end{LTXexample} + +Without using any additional argument all available digits are printed. + +\section{Optional arguments} + +All optional arguments of package \texttt{siunitx} can be used: + +\begin{LTXexample}[pos=t] +\psCalculate[group-digits=false]{3.14126*314^2}\\ +\psCalculate[output-decimal-marker={,}]{3.14126*314^2/sin(3)}\\ +\psCalculate[exponent-product=\cdot,scientific-notation=true]{3.14126*314^2/sin(3)}\\ +\psCalculate[scientific-notation=engineering]{3.14126*314^2/sin(3)}\\ +\psCalculate[fixed-exponent=2,scientific-notation=fixed]{3.14126*314^2/sin(3)}\\ +\psCalculate[round-precision=3]{3.14126*314^2/sin(3)}\\ +\psCalculate[round-mode=places,round-precision=3]{3.14126*314^2/sin(3)} +\end{LTXexample} + +For more optional argument to format the output have a look at the documentation of \texttt{siunitx}. + + +\RaggedRight +\nocite{*} +\printbibliography + + +\end{document} + +y
\ No newline at end of file diff --git a/macros/latex/contrib/pst-calculate/latex/pst-calculate.sty b/macros/latex/contrib/pst-calculate/latex/pst-calculate.sty new file mode 100644 index 0000000000..82d5b0be21 --- /dev/null +++ b/macros/latex/contrib/pst-calculate/latex/pst-calculate.sty @@ -0,0 +1,57 @@ +%% $Id: pst-calculate.sty 920 2019-01-24 20:24:45Z herbert $ +%% +%% This file is distributed under the terms of the LaTeX Project Public +%% License from CTAN archives in directory macros/latex/base/lppl.txt. +%% Either version 1.3 or, at your option, any later version. +%% +% Copyright 2018 Herbert Voss hvoss@tug.org +%% +\def\pstcalculate@version{0.02} +\ProvidesPackage{pst-calculate}[% + 2019/01/24 v. \pstcalculate@version (Herbert Voss) Support for + caculations with floating point numbers.] +% +\RequirePackage{xkeyval} + +\newif\ifcalc@useComma \calc@useCommafalse +\DeclareOptionX{useComma}[true]{\@nameuse{calc@useComma#1}} +% +\let\calc@roundDigit\relax +\DeclareOptionX{roundDigit}{\def\calc@roundDigit{#1}} + +\DeclareOptionX*{\PassOptionsToPackage\CurrentOption{siunitx}} + +\ProcessOptionsX\relax + +\RequirePackage{xparse,siunitx} + +\ifx\relax\calc@roundDigit \else + \sisetup{round-mode=places,round-precision=\calc@roundDigit}% +\fi +\ifcalc@useComma + \sisetup{output-decimal-marker={,}} +\fi + +\ExplSyntaxOn +\DeclareExpandableDocumentCommand\ps@Calculate{m}{\fp_to_decimal:n{#1}}% +%\DeclareExpandableDocumentCommand\ps@@Calculate{m}{\fp_to_int:n{#1}}% +%\DeclareExpandableDocumentCommand\ps@@@Calculate{m}{\fp_to_scientific:n{#1}}% +\ExplSyntaxOff + +\def\pst@calculateType{0} + +\def\psCalculate{\@ifnextchar[\psCalculate@i{\psCalculate@i[]}} + +\def\psCalculate@i[#1]#2{% + \begingroup + \ifx\relax#1\relax\else\sisetup{#1}\fi + \num{\ps@Calculate{#2}} + \endgroup + \ignorespaces +} + +\let\pscalculate\ps@Calculate + +%% +\endinput + |