summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/signchart
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/signchart
Initial commit
Diffstat (limited to 'macros/latex/contrib/signchart')
-rw-r--r--macros/latex/contrib/signchart/README.txt24
-rw-r--r--macros/latex/contrib/signchart/signchart.dtx319
-rw-r--r--macros/latex/contrib/signchart/signchart.ins71
-rw-r--r--macros/latex/contrib/signchart/signchart.pdfbin0 -> 308045 bytes
-rw-r--r--macros/latex/contrib/signchart/signchart.sty105
5 files changed, 519 insertions, 0 deletions
diff --git a/macros/latex/contrib/signchart/README.txt b/macros/latex/contrib/signchart/README.txt
new file mode 100644
index 0000000000..a34b9103e8
--- /dev/null
+++ b/macros/latex/contrib/signchart/README.txt
@@ -0,0 +1,24 @@
+----------------------------------------------------------------
+signchart --- v1.01 2016/02/12
+E-mail: anthonywmottaz@gmail.com
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
+The signchart package provides you with the ability to create
+beautifully typeset sign charts.
+
+Refer to the documentation for usage instructions. Suggestions
+for improvement can be sent to the email address above.
+
+------------------ INSTALLATION INSTRUCTIONS -------------------
+Copy the 'signchart.dtx' file to a temporary location, then
+from a terminal run the following command twice:
+pdflatex signchart.dtx
+Then we need to create the index. Run the command:
+makeindex -s gind.ist signchart
+and then run pdflatex twice more.
+
+Finally, you need to move the 'signchart.sty' to folders that
+are searched by your TeX distribution.
+----------------------------------------------------------------
diff --git a/macros/latex/contrib/signchart/signchart.dtx b/macros/latex/contrib/signchart/signchart.dtx
new file mode 100644
index 0000000000..a450128960
--- /dev/null
+++ b/macros/latex/contrib/signchart/signchart.dtx
@@ -0,0 +1,319 @@
+% \iffalse meta-comment
+%<*internal>
+\iffalse
+%</internal>
+%<*readme>
+----------------------------------------------------------------
+signchart --- v1.01 2016/02/12
+E-mail: anthonywmottaz@gmail.com
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
+The signchart package provides you with the ability to create
+beautifully typeset sign charts.
+
+Refer to the documentation for usage instructions. Suggestions
+for improvement can be sent to the email address above.
+
+------------------ INSTALLATION INSTRUCTIONS -------------------
+Copy the 'signchart.dtx' file to a temporary location, then
+from a terminal run the following command twice:
+ pdflatex signchart.dtx
+Then we need to create the index. Run the command:
+ makeindex -s gind.ist signchart
+and then run pdflatex twice more.
+
+Finally, you need to move the 'signchart.sty' to folders that
+are searched by your TeX distribution.
+----------------------------------------------------------------
+%</readme>
+%<*internal>
+\fi
+\def\nameofplainTeX{plain}
+\ifx\fmtname\nameofplainTeX\else
+ \expandafter\begingroup
+\fi
+%</internal>
+%<*install>
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+----------------------------------------------------------------
+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
+----------------------------------------------------------------
+
+\endpreamble
+\postamble
+
+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.
+
+\endpostamble
+\usedir{tex/latex/signchart}
+\generate{
+ \file{\jobname.sty}{\from{\jobname.dtx}{package}}
+}
+%</install>
+%<install>\endbatchfile
+%<*internal>
+\usedir{source/latex/signchart}
+\generate{
+ \file{\jobname.ins}{\from{\jobname.dtx}{install}}
+}
+\nopreamble\nopostamble
+\usedir{doc/latex/signchart}
+\generate{
+ \file{README.txt}{\from{\jobname.dtx}{readme}}
+}
+\ifx\fmtname\nameofplainTeX
+ \expandafter\endbatchfile
+\else
+ \expandafter\endgroup
+\fi
+%</internal>
+%<*package>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{signchart}[2016/02/12 v1.01]
+%</package>
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage{\jobname}
+\usepackage[numbered]{hypdoc}
+\usepackage{fancyvrb}
+\usepackage{microtype}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{166}
+%
+%\GetFileInfo{\jobname.sty}
+%
+%\DoNotIndex{\if,\fi,\else,\ifnum}
+%\DoNotIndex{\begin,\end,\def,\let,\foreach,\i,\j,\k,\s}
+%\DoNotIndex{\pgfmathsetmacro,\pgfmathtruncatemacro}
+%\DoNotIndex{\pgfplotsset,\makeatletter,\makeatother}
+%\DoNotIndex{\CurrentOption,\DeclareOption,\define@key}
+%\DoNotIndex{\newcommand,\relax}
+%
+%\title{^^A
+% The \textsf{signchart} package\thanks{^^A
+% This file describes version \fileversion, last revised \filedate.^^A
+% }^^A
+%}
+%\author{^^A
+% Anthony Mottaz\thanks{E-mail: anthonywmottaz@gmail.com}^^A
+%}
+%\date{Released \filedate}
+%
+%\maketitle
+%
+%\abstract{The signchart package provides you with the ability to create
+%beautifully typeset sign charts.}
+%
+%
+%
+%\section{Introduction}
+%
+%The \texttt{signchart} package provides the command
+%\begin{center}
+%|\signchart|\oarg{options}\marg{values}\marg{signs}
+%\end{center}
+%for typesetting sign charts. For example,
+%|\signchart{1,2,3}{+,-,+,-}| will produce
+%\signchart{1,2,3}{+,-,+,-}
+%This process is achieved using the \texttt{tikz} and \texttt{xstring}
+%packages to extract the \meta{values} and \meta{signs} and place
+%them on a number line.
+%
+%
+%
+%\section{Usage}
+%\subsection{Load the package}
+%
+%Load the package:
+%\begin{Verbatim}[gobble=1]
+% \usepackage\oarg{options}{signchart}
+%\end{Verbatim}
+%
+%Currently, there are two options that can be called when loading the
+%|signchart| package.
+%
+%\DescribeMacro{signunder}
+%Loading the package with this option will cause the signs to be placed below
+%the sign chart. This is achieved by changing the default value of
+%\texttt{height} to \texttt{$-0.3$}. \emph{(See macro options below)}
+%
+%\DescribeMacro{valunder}
+%Loading the package with this option will cause the values to be placed below
+%the sign chart. This is achieved by changing the default anchor position of
+%the values from \texttt{south} to \texttt{north}. \emph{(See macro options
+%below)}
+%
+%\subsection{Macros}
+%
+%\DescribeMacro{signchart}
+%|\signchart|\oarg{optons}\marg{values}\marg{signs} \quad The |\signchart|
+%command produces a signchart---a number line with evenly spaced ticks,
+%with \meta{values} placed over each tick mark and \meta{signs} placed
+%between each value.
+%
+%\DescribeMacro{\meta{values}}
+%For the \meta{values} argument, the user should enter the values
+%that will be placed above the tick marks in a comma separated list.
+%
+%\DescribeMacro{\meta{signs}}
+%For the \meta{signs} argument, the user should enter the signs that will
+%be placed between each of the \meta{values}, also in a comma separated list.
+%\textbf{It is important to note} that the number of signs should be at most
+%one more than the number of values. Any additional signs will be considered as
+%one sign and give undesired results.
+%
+%\DescribeMacro{\oarg{options}}
+%The width, placement of
+%\meta{values} and \meta{signs}, and the arrows can be adjusted with
+%\meta{options}.
+%\DescribeMacro{width}
+%The option \meta{width}=\meta{number} can be used to specify the width of
+%the sign chart using the default \texttt{tikzpicture} units (cm). If no
+%option is given, then \meta{width}\texttt{= 5} is used.
+%
+%\DescribeMacro{valanchor}
+%This macro can change the anchor for placing the \meta{values}. By default,
+%this is set to \texttt{south} in order to place the \meta{values} above the
+%number line. The other possibility is to set \texttt{valanchor=north}.
+%
+%\DescribeMacro{valsep}
+%This macro controls the separation distance from the \meta{values} to the
+%number line. By default, this is set to \texttt{3pt}. When the option
+%\texttt{valunder} is passed to the package, this is redefined to \texttt{13pt}
+%to achieve a similar distance underneath the number line.
+%
+%\DescribeMacro{height}
+%The option \meta{height}=\meta{number} can be used to specify the distance
+%between the number line and the signs using the default \texttt{tikzpicture}
+%units (cm). If no option is given, then \meta{height}\texttt{= 0.3} is used.
+%
+%\DescribeMacro{arrows}
+%The option \meta{arrows}=\meta{arrow style} can be used to specify the arrow
+%head shape used on the number line. If no option is given, then
+%\meta{arrows}\texttt{= <->} is used.
+%
+%\changes{v1.0}{2016/01/29}{First public release}
+%\changes{v1.01}{2016/02/12}{Improved Documentation, addition of package
+%options}
+%\StopEventually{^^A
+% \PrintChanges
+% \PrintIndex
+%}
+%
+%\section{Implementation}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+\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}
+}
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%\Finale
diff --git a/macros/latex/contrib/signchart/signchart.ins b/macros/latex/contrib/signchart/signchart.ins
new file mode 100644
index 0000000000..85f2b5e705
--- /dev/null
+++ b/macros/latex/contrib/signchart/signchart.ins
@@ -0,0 +1,71 @@
+%%
+%% This is file `signchart.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% signchart.dtx (with options: `install')
+%% ----------------------------------------------------------------
+%% 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
+%% ----------------------------------------------------------------
+%%
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+----------------------------------------------------------------
+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
+----------------------------------------------------------------
+
+\endpreamble
+\postamble
+
+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.
+
+\endpostamble
+\usedir{tex/latex/signchart}
+\generate{
+ \file{\jobname.sty}{\from{\jobname.dtx}{package}}
+}
+\endbatchfile
+%%
+%% 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.ins'.
diff --git a/macros/latex/contrib/signchart/signchart.pdf b/macros/latex/contrib/signchart/signchart.pdf
new file mode 100644
index 0000000000..22ae49e2a5
--- /dev/null
+++ b/macros/latex/contrib/signchart/signchart.pdf
Binary files differ
diff --git a/macros/latex/contrib/signchart/signchart.sty b/macros/latex/contrib/signchart/signchart.sty
new file mode 100644
index 0000000000..684abdf6fc
--- /dev/null
+++ b/macros/latex/contrib/signchart/signchart.sty
@@ -0,0 +1,105 @@
+%%
+%% 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'.