diff options
author | Karl Berry <karl@freefriends.org> | 2016-01-30 23:02:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-01-30 23:02:34 +0000 |
commit | f98f780b355bb279f2b6bec1e027ab0d34759000 (patch) | |
tree | 99322650c6bf328f7c394450bc2e9bae0eb627a2 /Master/texmf-dist/tex/latex/signchart | |
parent | 72a0316ebc5fc4fc3c04940669e753e25ff5169d (diff) |
signchart (30jan16)
git-svn-id: svn://tug.org/texlive/trunk@39516 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/signchart')
-rw-r--r-- | Master/texmf-dist/tex/latex/signchart/signchart.sty | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/signchart/signchart.sty b/Master/texmf-dist/tex/latex/signchart/signchart.sty new file mode 100644 index 00000000000..9f4434751ab --- /dev/null +++ b/Master/texmf-dist/tex/latex/signchart/signchart.sty @@ -0,0 +1,93 @@ +%% +%% This is file `signchart.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% signchart.dtx (with options: `package') +%% ---------------------------------------------------------------- +%% signchart --- Create beautiful sign charts. +%% E-mail: anthonywmottaz@gmail.com +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% ---------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{signchart}[2016/01/29 v1.0 First release] +\RequirePackage{tikz} +\RequirePackage{pgfplots} +\pgfplotsset{compat = 1.10} +\RequirePackage{xstring} +\RequirePackage{xkeyval} +\DeclareOption*{\PackageWarning{examplepackage}{Unknown option `\CurrentOption'. + This package does not accept any options.}} +\ProcessOptions\relax +\define@key{signchart}{height}[0.3]{\def\signHeight{#1}} +\define@key{signchart}{width}[5]{\def\signChartWidth{#1}} +\define@key{signchart}{arrows}[<->]{\def\theArrow{#1}} +\makeatother +\newcommand{\signchart}[3][]{ +\setkeys{signchart}{height, width, arrows, #1} +\begin{center} +\begin{tikzpicture} +\pgfmathsetmacro{\snht}{\signHeight} +\pgfmathsetmacro{\wid}{\signChartWidth} +\def\vals{#2} +\def\signs{#3} +\def\valsarray{{\vals}} +\StrCount{\vals}{,}[\len] +\draw[\theArrow,thick] (0,0) -- (\wid,0); +\def\thisVal{-0} +\foreach \i in {0,...,\len} { +\pgfmathtruncatemacro{\k}{\i + 1} +\ifnum \i < \len +\StrPosition[\k]{\vals}{,}[\pos] +\StrBefore[\k]{\vals}{,}[\leftParti] +\ifnum \i = 0 +\def\thisVal{\leftParti} +\else +\StrBehind[\i]{\leftParti}{,}[\thisVal] +\fi +\else +\StrBehind[\i]{\vals}{,}[\thisVal] +\fi +\pgfmathtruncatemacro{\j}{\i + 1} +\StrBehind[\j]{\signs}{,}[\rightPart] +\StrLen{\rightPart}[\aLength] +\pgfmathtruncatemacro{\cutAmount}{\aLength + 1} +\StrGobbleRight{\signs}{\cutAmount}[\leftPartii] +\StrBehind[\j]{,\leftPartii}{,}[\s] +\pgfmathsetmacro{\valpos}{(\wid/(\len+2))*(\i+1)} +\pgfmathsetmacro{\signpos}{(\wid/(\len+2))*(\i+0.5)} +\draw (\valpos,-0.15) -- (\valpos,0.15) node[anchor=south] {\thisVal}; +\node at (\signpos,\snht) {$\s$}; +\ifnum \i = \len +\pgfmathsetmacro{\signpos}{(\wid/(\len+2))*(\len+1.5)} +\pgfmathtruncatemacro{\j}{\len + 1} +\StrBehind[\j]{\signs}{,}[\s] +\node at (\signpos,\snht) {$\s$}; +\fi +} +\end{tikzpicture} +\end{center} +} +%% +%% Copyright (C) 2016 by Anthony Mottaz <anthonywmottaz@gmail.com> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License (LPPL), either +%% version 1.3c of this license or (at your option) any later +%% version. The latest version of this license is in the file: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% You. +%% +%% This work consists of the file signchart.dtx +%% and the derived files signchart.ins, +%% signchart.pdf and +%% signchart.sty. +%% +%% +%% End of file `signchart.sty'. |