diff options
author | Norbert Preining <norbert@preining.info> | 2020-01-25 03:01:31 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-01-25 03:01:31 +0000 |
commit | 75672286990bb55c7b46277f845d14eafcf2ba61 (patch) | |
tree | 29456eb5880d5a2629b2ae329423c9ceaaaf6887 /macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex | |
parent | e1192611f0655a1ccaff0dff2f53c7c65fa5db07 (diff) |
CTAN sync 202001250301
Diffstat (limited to 'macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex')
-rw-r--r-- | macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex new file mode 100644 index 0000000000..f2bd6a5ffc --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-base/latex/tkz-obj-grids.tex @@ -0,0 +1,78 @@ +% tkz-obj-grids.tex +% Copyright 2011 by Alain Matthes +% This file may be distributed and/or modified +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% utf8 encoding +\def\fileversion{3.01c} +\def\filedate{2020/01/23} +\typeout{2020/01/23 3.01c tkz-obj-grids.tex} +\makeatletter +%<--------------------------------------------------------------------------–> +% Setup Grid +%<--------------------------------------------------------------------------–> +\pgfkeys{/@tkzsugrid/.cd, + line width/.store in = \tkz@sug@lw, + color/.store in = \tkz@sug@color, + line width = \tkz@grid@lw, + color = \tkz@grid@color + } + +\def\tkzSetUpGrid{\pgfutil@ifnextchar[{\tkz@SetUpGrid}{\tkz@SetUpGrid[]}} +\def\tkz@SetUpGrid[#1]{% +\begingroup +\pgfqkeys{/@tkzsugrid}{#1} +\global\let\tkz@grid@lw\tkz@sug@lw +\global\let\tkz@grid@color\tkz@sug@color +\endgroup +} +%<--------------------------------------------------------------------------–> +% tkzGrid +%<--------------------------------------------------------------------------–> +\pgfkeys{/@tkzGrid/.cd, + color/.code = {\def\tkz@gd@color{#1}% + \edef\tkz@gd@subcolor{% + \tkz@gd@color!\tkzCoeffSubColor}}, + subxstep/.store in = {\tkz@gd@subxstep}, + subystep/.store in = {\tkz@gd@subystep}, + ratio/.store in = {\tkz@gd@ratio}, + line width/.code = {\edef\tkz@gd@lw{#1} + \edef\tkz@gd@sublw{\tkz@gd@ratio\tkz@gd@lw}}, + sub/.is if = tkz@gd@sub, + sub/.default = true , + sub = false, + color = \tkz@grid@color, + ratio = 0.75, + subxstep = \tkz@grid@xstep, + subystep = \tkz@grid@ystep, + line width = \tkz@grid@lw, + /@tkzGrid/.search also = {/tikz}, +} +%<--------------------------------------------------------------------------–> +\def\tkzGrid{\pgfutil@ifnextchar[{\tkz@Grid}{\tkz@Grid[]}} +\def\tkz@Grid[#1]{\@ifnextchar({\tkz@@Grid[#1]}% + {\tkz@@Grid[#1](\tkz@tmp@xa,\tkz@tmp@ya)(\tkz@tmp@xb,\tkz@tmp@yb)}} +\def\tkz@@Grid[#1](#2,#3)(#4,#5){% + \pgfqkeys{/@tkzGrid}{#1} + \begingroup + \edef\tkz@gxa{\fpeval{(#2-\tkz@init@xorigine)/\tkz@init@xstep}} + \edef\tkz@gxb{\fpeval{(#4-\tkz@init@xorigine)/\tkz@init@xstep}} + \edef\tkz@gya{\fpeval{(#3-\tkz@init@yorigine)/\tkz@init@ystep}} + \edef\tkz@gyb{\fpeval{(#5-\tkz@init@yorigine)/\tkz@init@ystep}} + \iftkz@gd@sub% + \edef\@subxstep{\fpeval{\tkz@gd@subxstep/\tkz@init@xstep}}% + \edef\@subystep{\fpeval{\tkz@gd@subystep/\tkz@init@ystep}}% + \draw [xstep = \@subxstep cm,% + ystep = \@subystep cm,% + color = \tkz@gd@subcolor,% + line width = \tkzRatioLineGrid]% + (\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);% + \fi + \draw [color = \tkz@gd@color,% + line width = \tkz@gd@lw]% + (\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);% + \endgroup +}% + %<--------------------------------------------------------------------------–> +\makeatother +\endinput
\ No newline at end of file |