initial commit

This commit is contained in:
k-a-z-u
2018-06-05 11:29:16 +02:00
parent 6d649df87d
commit 5248f3339d
17 changed files with 2578 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
\RequirePackage{environ}
% ### DEFINE NumberLine ENVIRONMENT ###
% define numberLine/area parameters
\pgfkeys{/numberLine/area/.is family, /numberLine/area,
height/.estore in = \numberLineAreaHeight,
color/.estore in = \numberLineAreaColor,
opacity/.estore in = \numberLineAreaOpacity,
label/.store in = \numberLineAreaLabel,
textcolor/.store in = \numberLineAreaTextcolor,
textabove/.store in = \numberLineAreaTextPosition
}
\pgfkeys{/numberLine/area, default/.style = {height=0.2, color=orange, opacity=1, label=, textcolor=black, textabove=0.2ex}}
% define numberLine/area parameters
\pgfkeys{/numberLine/point/.is family, /numberLine/point,
size/.estore in = \numberLinePointSize,
color/.estore in = \numberLinePointColor,
textcolor/.store in = \numberLinePointTextcolor,
textabove/.store in = \numberLinePointTextPosition
}
\pgfkeys{/numberLine/point, default/.style = {size=0.1, color=orange, textcolor=black, textabove=0.3ex}}
% define environment
\NewEnviron{numberLine}[3][]{
% Draw an xtick at (1: x-position, 2: label to display)
\newcommand{\xtick}[2]{
\draw (##1,0.1) -- + (0,-0.2) node[below] {$##2$}
}
% Draw an area on the number-line (1: from x, 2: to x, 3: color)
\newcommand{\area}[3][]{
\pgfkeys{/numberLine/area, default, ##1}
\begin{pgfonlayer}{areas}
\fill [\numberLineAreaColor,fill opacity=\numberLineAreaOpacity] (##2,-0.1) rectangle (##3,{-0.1 + \numberLineAreaHeight})
node[pos=.5,yshift=\numberLineAreaTextPosition,label={[\numberLineAreaTextcolor]\numberLineAreaLabel}] {};
\end{pgfonlayer}
}
% Draw a point on the number-line (1: x-position, 2: color, 3: size)
\newcommand{\point}[3][]{
\pgfkeys{/numberLine/point, default, ##1}
\begin{pgfonlayer}{points}
\fill[\numberLinePointColor] (##2,0) circle (\numberLinePointSize)
node[above=\numberLinePointTextPosition,text=\numberLinePointTextcolor] {##3};
\end{pgfonlayer}
}
\pgfdeclarelayer{areas}
\pgfdeclarelayer{points}
\pgfsetlayers{areas,main,points}
\begin{tikzpicture}[#1]
\BODY
%draw horizontal line above everything else (except the x-ticks)
\draw (#2,0) -- (#3,0);
%draw xticks above everything else
\foreach \x in {#2,...,#3}
\xtick{\x}{\x};
\end{tikzpicture}
}

View File

@@ -0,0 +1,44 @@
\RequirePackage{environ}
% Pipelines
\usepackage{calc}
\tikzset{%
pipelineStep/.style = {rectangle, draw, minimum width=5em, align=center, minimum height=2em},
pipelineInput/.style = {coordinate, draw, circle, inner sep=0pt,minimum size=0.7cm},
pipelineOutput/.style = {coordinate, draw, circle, inner sep=0pt,minimum size=0.7cm},
pipelineConnection/.style = {draw, -latex'}
}
\newcounter{previouspipelineelementindexcounter}
\newcounter{nextpipelineelementindexcounter}
\NewEnviron{pipeline}[1][]{
\setcounter{previouspipelineelementindexcounter}{0}
\setcounter{nextpipelineelementindexcounter}{1}
\newcommand{\pipelineInput}[2][]{
\node[pipelineInput,##1] (step0) {##2};
}
\newcommand{\pipelineElement}[2][]{
\node[pipelineStep, right of=step\thepreviouspipelineelementindexcounter,##1](step\thenextpipelineelementindexcounter){##2};
\path[pipelineConnection] (step\thepreviouspipelineelementindexcounter) -- (step\thenextpipelineelementindexcounter);
\addtocounter{previouspipelineelementindexcounter}{1}
\addtocounter{nextpipelineelementindexcounter}{1}
}
\newcommand{\pipelineOutput}[2][]{
\node[pipelineOutput, right of=step\thepreviouspipelineelementindexcounter,##1](step\thenextpipelineelementindexcounter){##2};
\path[pipelineConnection] (step\thepreviouspipelineelementindexcounter) -- (step\thenextpipelineelementindexcounter);
\addtocounter{previouspipelineelementindexcounter}{1}
\addtocounter{nextpipelineelementindexcounter}{1}
}
% Group a range of pipeline elements within a rectangle
% param 1: from (number of the first element)
% param 2: to (number of the last element)
% param 3: Title of the group
\newcommand{\pipelineGroupSegment}[4][]{
\node[draw,inner sep=2mm,label=above:##4,fit=(step##2) (step##3),##1] {};
}
\begin{tikzpicture}[#1]
\BODY
\end{tikzpicture}
}