%%
%% 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/02/12 v1.01]
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\pgfplotsset{compat = 1.10}
\RequirePackage{xstring}
\RequirePackage{xkeyval}
\def\signHeightKey{0.3}
\def\valNorthSouthKey{south}
\def\valSepKey{3pt}
\DeclareOption{signunder}{\def\signHeightKey{-0.3}}
\DeclareOption{valunder}{%
\def\valNorthSouthKey{north}%
\def\valSepKey{13pt}}
\DeclareOption*{%
\PackageWarning{signchart}{Unknown option ‘\CurrentOption’}%
}
\ProcessOptions\relax
\define@key{signchart}{height}[\signHeightKey]{\def\signHeight{#1}}
\define@key{signchart}{valanchor}[\valNorthSouthKey]{\def\valNorthSouth{#1}}
\define@key{signchart}{valsep}[\valSepKey]{\def\valSep{#1}}
\define@key{signchart}{width}[5]{\def\signChartWidth{#1}}
\define@key{signchart}{arrows}[<->]{\def\theArrow{#1}}
\makeatother
\newcommand{\signchart}[3][]{
\setkeys{signchart}{height, valanchor, valsep, 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=\valNorthSouth,
    inner sep=\valSep]
{\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'.
