summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-10-07 20:14:30 +0000
committerKarl Berry <karl@freefriends.org>2023-10-07 20:14:30 +0000
commitd9ded67c5b4a55068d91460161c87b0432637e2b (patch)
treed0b587eafef90953e285963119274c77dfe272fd /Master/texmf-dist/tex/latex
parent47e1413de6dc3846b408dc8ac675726f9da9ecae (diff)
tikz-osci (7oct23)
git-svn-id: svn://tug.org/texlive/trunk@68470 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/tikz-osci/tikz-osci.sty70
1 files changed, 43 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-osci/tikz-osci.sty b/Master/texmf-dist/tex/latex/tikz-osci/tikz-osci.sty
index d2d59cd5255..29d2541911f 100644
--- a/Master/texmf-dist/tex/latex/tikz-osci/tikz-osci.sty
+++ b/Master/texmf-dist/tex/latex/tikz-osci/tikz-osci.sty
@@ -1,22 +1,21 @@
% -----------------------------------------------------------
% This is TikZ Osci package
%
-% It provides some macros to draw oscilloscope screen captures
-% from math functions provided by the user.
+% It allows you to produce oscilloscope "screen shots".
%
% It is based on TikZ and pgfplots and is a replacement can-
% didate to the pstricks pst-osci package which is not main-
% tained anymore.
%
% Author: Thibault Giauffret
-% Date: 2013/10/06
-% Version: 0.1.0
+% Date: 2013/10/07
+% Version: 0.2.0
% Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
% Not an expert... Just doing it for fun.
% -----------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tikz-osci}[2023/09/30 0.1.0 Tikz Osci package]
+\ProvidesPackage{tikz-osci}[2023/09/30 0.2.0 Tikz Osci package]
% Required packages
\RequirePackage[dvipsnames]{xcolor}
@@ -34,6 +33,8 @@
/osci/.cd,
scale/.store in=\scale,
scale=1,
+ rounded corners/.store in=\roundedCorners,
+ rounded corners=10,
second channel/.store in=\secondChannel,
second channel=0,
screen offset one/.store in=\screenOffsetOne,
@@ -50,16 +51,24 @@
sample rate=200,
xy mode/.store in=\xyMode,
xy mode=0,
- expr one/.store in=\exprOne,
- expr one=2*sin(2*180/0.020*x),
- expr two/.store in=\exprTwo,
- expr two=0.6*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
+ func one/.store in=\funcOne,
+ func one=2*sin(2*180/0.020*x),
+ func two/.store in=\funcTwo,
+ func two=0.6*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
+ indicators/.store in=\indicators,
+ indicators=1,
color one/.store in=\colorOne,
color one=D62626,
+ color text one/.store in=\colorTextOne,
+ color text one=FFFFFF,
color two/.store in=\colorTwo,
color two=1053AF,
+ color text two/.store in=\colorTextTwo,
+ color text two=FFFFFF,
color xy/.store in=\colorXY,
color xy=2E8B73,
+ color text xy/.store in=\colorTextXY,
+ color text xy=FFFFFF,
graph back color/.store in=\graphBackColor,
graph back color=FFFFFF,
info back color/.store in=\infoBackColor,
@@ -68,8 +77,8 @@
info text color=000000,
main axis color/.store in=\mainAxisColor,
main axis color=000000,
- sub axis color/.store in=\subAxisColor,
- sub axis color=AAAAAA,
+ grid color/.store in=\gridColor,
+ grid color=AAAAAA,
}
% The main command
@@ -93,12 +102,15 @@
\definecolor{infoBackColor}{HTML}{\infoBackColor}
\definecolor{infoTextColor}{HTML}{\infoTextColor}
\definecolor{mainAxisColor}{HTML}{\mainAxisColor}
- \definecolor{subAxisColor}{HTML}{\subAxisColor}
+ \definecolor{gridColor}{HTML}{\gridColor}
+ \definecolor{colorTextOne}{HTML}{\colorTextOne}
+ \definecolor{colorTextTwo}{HTML}{\colorTextTwo}
+ \definecolor{colorTextXY}{HTML}{\colorTextXY}
% Draw the info box
\draw[black,thick, fill= infoBackColor]
(0,0) --
- ++(10,0) {[rounded corners=10] --
+ ++(10,0) {[rounded corners=\roundedCorners] --
++(0,-1.5) --
++(-10,0)} --
cycle
@@ -109,13 +121,13 @@
% Add voltage/div label for the first channel
\draw[firstcolor,fill=firstcolor] (0.5,-0.15) rectangle (1.5,-0.6);
- \draw (1,-0.1) node[anchor=north, color=white] {CH1};
+ \draw (1,-0.1) node[anchor=north, color=colorTextOne] {CH1};
\draw (1,-0.75) node[anchor=north, color= infoTextColor] {\voltageDivOne\ V/div};
% Add voltage/div label for the second channel
\ifnum\secondChannel=1
\draw[secondcolor,fill=secondcolor] (8.5,-0.15) rectangle (9.5,-0.6);
- \draw (9,-0.1) node[anchor=north, color=white] {CH2};
+ \draw (9,-0.1) node[anchor=north, color=colorTextTwo]{CH2};
\draw (9,-0.75) node[anchor=north, color= infoTextColor] {\voltageDivTwo\ V/div};
\fi
@@ -128,7 +140,7 @@
% Draw the oscilloscope screen border
\draw[black,thick, fill= graphbackcolor]
(0,0) --
- ++(10,0) {[rounded corners=10] --
+ ++(10,0) {[rounded corners=\roundedCorners] --
++(0,8) --
++(-10,0)} --
cycle
@@ -143,6 +155,7 @@
\begin{axis}[xmin=-5*(\timeDiv/1000), xmax=5*(\timeDiv/1000), ymin=-4, ymax=4, xtick distance = \timeDiv/1000,
axis x line=middle, axis y line=middle,
axis line style={-},
+ color=mainAxisColor,
% Draw major grid
grid=both,
xticklabels={,,},
@@ -151,7 +164,7 @@
minor tick num=4,
% Remove minor grid
minor grid style={line width=0pt, draw=white, draw opacity=0},
- major grid style={thick,dashed,draw=subAxisColor},
+ major grid style={thick,dashed,draw=gridColor},
every major tick/.append style={very thick, major tick length=6pt, color=mainAxisColor},
every minor tick/.append style={thick, minor tick length=4pt, color=mainAxisColor},
]
@@ -171,26 +184,29 @@
% Draw each channel separately
% First channel plot
\addplot[color=firstcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
- smooth, samples=\sampleRate]{(\exprOne)/\voltageDivOne+\screenOffsetOne};
+ smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne+\screenOffsetOne};
% If the second channel is enabled, draw it
\ifnum\secondChannel=1
% Draw the second channel
- \addplot[color=secondcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), smooth, samples=\sampleRate]{(\exprTwo)/\voltageDivTwo+\screenOffsetTwo};
+ \addplot[color=secondcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), smooth, samples=\sampleRate]{(\funcTwo)/\voltageDivTwo+\screenOffsetTwo};
\fi
\fi
\end{axis}
\ifnum\xyMode=0
- % Draw the first channel's screen marker
- \draw[firstcolor,fill=firstcolor] (0.4, \screenOffsetOne+4) -- (0, \screenOffsetOne+4+0.3) -- (0, \screenOffsetOne+4-0.3) -- cycle;
- \draw (-0.04, \screenOffsetOne+4) node[anchor=west, color=white,font=\fontsize{8}{10}\selectfont] {1};
-
- % Draw the second channel's screen marker
- \ifnum\secondChannel=1
- \draw[secondcolor,fill=secondcolor] (0.4, \screenOffsetTwo+4) -- (0, \screenOffsetTwo+4+0.3) -- (0, \screenOffsetTwo+4-0.3) -- cycle;
- \draw (-0.04, \screenOffsetTwo+4) node[anchor=west, color=white,font=\fontsize{8}{10}\selectfont] {2};
+ \ifnum\indicators=1
+ % Draw the first channel's screen marker
+ \draw[firstcolor,fill=firstcolor] (0.4, \screenOffsetOne+4) -- (0, \screenOffsetOne+4+0.3) -- (0, \screenOffsetOne+4-0.3) -- cycle;
+ \draw (-0.04, \screenOffsetOne+4) node[anchor=west, color=colorTextOne,font=\fontsize{8}{10}\selectfont] {1};
+
+
+ % Draw the second channel's screen marker
+ \ifnum\secondChannel=1
+ \draw[secondcolor,fill=secondcolor] (0.4, \screenOffsetTwo+4) -- (0, \screenOffsetTwo+4+0.3) -- (0, \screenOffsetTwo+4-0.3) -- cycle;
+ \draw (-0.04, \screenOffsetTwo+4) node[anchor=west, color=colorTextTwo,font=\fontsize{8}{10}\selectfont] {2};
+ \fi
\fi
\fi