1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
\documentclass[11pt,a4paper,usenames,dvipsnames]{article}
\usepackage{../tikz-osci}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{hyperref}
\title{TikZ Oscilloscope Package}
\author{Thibault Giauffret}
\def\version{0.3.0}
% Use sans serif font
\renewcommand{\familydefault}{\sfdefault}
% Remove paragraph indentation
\setlength{\parindent}{0pt}
% Listings
\newtcblisting{listing}{
listing only,
hbox,
listing options={
basicstyle=\small\ttfamily,
breaklines=true,
columns=fullflexible
},
}
\begin{document}
\begin{tcolorbox}
\begin{center}
\vspace{0.3cm}
{\huge \textbf{TikZ Oscilloscope Package}}\\[0.3cm]
{\Large Thibault Giauffret}\\[0.3cm]
\textit{Version \version\ of \today}
\vspace{0.3cm}
\end{center}
\end{tcolorbox}
\section{Introduction}
\begin{minipage}{0.5\linewidth}
\begin{center}
\osci[%
scale=0.7
]
\end{center}
\end{minipage}
\begin{minipage}{0.5\linewidth}
\begin{center}
\osci[%
scale=0.7,
rounded corners=0,
second channel=1,
screen offset one=2,
screen offset two=-2,
time div=20,
voltage div one=4,
voltage div two=1,
sample rate=200,
xy mode=0,
func one=2*sin(2*180/0.020*x),
func two=1*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
indicators=0,
color one=D62626,
color two=1053AF,
graph back color=777799,
info back color=333333,
info text color=FFFFFF,
main axis color=DDDDDD,
grid color=CCCCCC,
]
\end{center}
\end{minipage}
\vspace*{0.5cm}
This package is a modest alternative to the \texttt{pst-osci} package (not maintained anymore). It allows you to draw oscilloscope "screen shots" with \LaTeX{}, TikZ and pgfplots.
\subsection*{Contact}
Some features are not implemented yet, but the package is already usable for basic representations. I'm doing this for fun and still learning how to make \LaTeX{} packages. Therefore, I'm open to any suggestion or contribution :
\begin{center}
\texttt{
contact at ensciences dot fr
}
\end{center}
\subsection*{Issues tracker}
An issues tracker is available at :
\begin{center}
\url{https://framagit.org/ThibGiauffret/latex_packages/-/issues}.
\end{center}
Feel free to report any bug you find or send suggestions.\\
\textbf{Important note :} Please indicate the concerned package name in the title of the issue. For example, if you want to report an issue about this package, please use the following title : \texttt{[tikz-osci] My issue report title}.
\section{Usage}
The package is loaded with the command \verb|\usepackage{tikz-osci}|. It defines a single command, \verb|\osci|, which takes a list of options as argument. The options allow you to configure and customize the oscilloscope screen view :
\begin{tcolorbox}[enhanced,breakable,colback=white,colframe=black,width=\textwidth,left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=0mm]
\begin{tabular}{p{0.2\textwidth}|p{0.47\textwidth}|p{0.255\textwidth}}
\texttt{scale} & Scale of the oscilloscope (with \texttt{scalebox}). & Default: \texttt{1} \\\hline
\texttt{rounded corners} & Radius of the oscilloscope corners (in pt). & Default: \texttt{10} \\\hline
\texttt{second channel} & 1 if the second channel is enabled, 0 otherwise. & Default: \texttt{0} \\\hline
\texttt{screen offset one} & Vertical screen offset of the first channel. & Default: \texttt{0} \\\hline
\texttt{screen offset two} & Vertical screen offset of the second channel. & Default: \texttt{0} \\\hline
\texttt{time div} & Time division (in ms). & Default: \texttt{20} \\\hline
\texttt{voltage div one} & Voltage division of the first channel (in V). & Default: \texttt{1} \\\hline
\texttt{voltage div two} & Voltage division of the second channel (in V). & Default: \texttt{1} \\\hline
\texttt{sample rate} & Sample rate. & Default: \texttt{200} \\\hline
\texttt{xy mode} & 1 if the oscilloscope is in XY mode (Lissajou curve), 0 otherwise. & Default : 0 \\\hline
\texttt{math mode} & 1 for addition, 2 for subtraction, 3 for multiplication, 4 for division, 0 otherwise. xy mode option must be set to 0. & Default: \texttt{0} \\\hline
\texttt{math mode hide source} & 0 to display channels CH1 and CH2 with the third channel, 1 to hide them. & Default : \texttt{0} \\\hline
\texttt{func one} & Expression of the first channel (pgf maths format). Trigonometric functions are defined in degrees. & Default: \texttt{2*sin(2*180/0.020*x)} \\\hline
\texttt{func two} & Expression of the second channel (pgf maths format). Trigonometric functions are defined in degrees. & Default: \texttt{1*sin(2*180/0.020*x) + 0.2*sin(2*180/0.040*x)} \\\hline
\texttt{indicators} & 1 if the channel indicators are enabled, 0 otherwise. & Default: \texttt{1} \\\hline
\texttt{color one} & Color of the first channel (in hexadecimal). & Default: \texttt{D62626} \\\hline
\texttt{color text one} & Text color of the first channel (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
\texttt{color two} & Color of the second channel (in hexadecimal). & Default: \texttt{1053AF} \\\hline
\texttt{color text two} & Text color of the second channel (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
\texttt{color three} & Color of the XY mode and the math mode (in hexadecimal). & Default: \texttt{2E8B73} \\\hline
\texttt{color text three} & Text color of the XY mode and the math mode (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
\texttt{graph back color} & Background color of the graph (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
\texttt{info back color} & Background color of the information box (in hexadecimal). & Default: \texttt{D6D6D6} \\\hline
\texttt{info text color} & Text color of the information box (in hexadecimal). & Default: \texttt{000000} \\\hline
\texttt{main axis color} & Color of the main axis (in hexadecimal). & Default: \texttt{000000} \\\hline
\texttt{grid color} & Color of the grid (in hexadecimal). & Default: \texttt{CCCCCC} \\
\end{tabular}
\end{tcolorbox}
A quick documentation in french is available here :
\begin{center}
\url{https://www.ensciences.fr/read.php?article=1220}
\end{center}
\newpage
\section{Examples}
For more examples, see the \texttt{tikz-osci-example.tex} file.
\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Two channels plot with custom background color, sidebyside}
\osci[%
scale=0.7,
second channel=1,
screen offset one=2,
screen offset two=-2,
time div=20,
voltage div one=4,
voltage div two=1,
sample rate=200,
xy mode=0,
func one=2*sin(2*180/0.020*x),
func two=1*sin(2*180/0.020*x) + 0.2*sin(2*180/0.040*x),
color one=D62626,
color two=1053AF,
graph back color=669966,
info back color=D6D6D6,
info text color=000000,
main axis color=000000,
grid color=CCCCCC
]
\end{tcblisting}
\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Lissajou curve (XY mode) and no rounded corner, sidebyside}
\osci[%
scale=0.7,
rounded corners=0,
second channel=1,
time div=300,
voltage div one=1,
voltage div two=0.5,
sample rate=500,
xy mode=1,
func one=sin(7*x),
func two=sin(2*x),
indicators=1,
graph back color=FFFFFF,
info back color=D6D6D6,
info text color=000000,
main axis color=000000,
grid color=CCCCCC,
]
\end{tcblisting}
\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Math mode (multiply) with hidden sources and dark mode, sidebyside}
\osci[%
scale=0.7,
second channel=1,
time div=10,
voltage div one=2,
voltage div two=2,
sample rate=500,
xy mode=0,
math mode=3,
math mode hide source=1,
func one=2*sin(2*180/0.040*x),
func two=3*sin(2*180/0.005*x),
indicators=0,
color three=F0DE25,
color text three=000000,
graph back color=777799,
info back color=333333,
info text color=FFFFFF,
main axis color=DDDDDD,
grid color=CCCCCC,
]
\end{tcblisting}
\section{License}
This package is distributed under the terms of the \textbf{LaTeX Project Public License} (LPPL), version 1.3c or later. The latest version of this license is available at \url{http://www.latex-project.org/lppl.txt}.
\section{Credits}
This package requires the following packages :
\begin{itemize}
\item \texttt{xcolor} maintained by the \textit{LaTeX3 Project} (license LPPL 1.3c) ;
\item tikz maintained by the \textit{TikZ and PGF Project} (license LPPL 1.3c) ;
\item pgfkeys maintained by the \textit{Till Tantau} (license LPPL) ;
\item pgfplots maintained by the \textit{Christian Feuersänger} (license LPPL).
\end{itemize}
\section{Changelog}
\begin{itemize}
\item \textbf{0.3.0} (2023/10/08) :
\subitem Implemented XY mode and math (add, subtract, multiply, divide) functionality.
\item \textbf{0.2.0} (2023/10/07) :
\subitem Added \texttt{color text one}, \texttt{color text two} and \texttt{color text xy} options.
\subitem Added \texttt{indicators} option.
\subitem Added \texttt{rounded corners} option.
\subitem Fixed the main axis color not being applied.
\subitem Reworded the documentation and the example file.
\item \textbf{0.1.1} (2023/10/06) :
\subitem Renamed \texttt{sub axis color} to \texttt{grid color}.
\subitem Renamed \texttt{expr one} and \texttt{expr two} to \texttt{func one} and \texttt{func two}.
\subitem Updated package files names.
\item \textbf{0.1.0} (2023/10/06) : Initial release. XY mode not implemented yet.
\end{itemize}
\end{document}
|