\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.1.0}

\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}

% Remove paragraph indentation
\setlength{\parindent}{0pt}

% Listings
\newtcblisting{listing}{
    listing only,
    hbox,
    listing options={
            basicstyle=\small\ttfamily,
            breaklines=true,
            columns=fullflexible
        },
}


\section{Introduction}

\begin{center}
    \osci[%
        scale=0.8
    ]
\end{center}



This package is modest alternative to the \texttt{pst-osci} package, not maintained anymore.

Some features are not implemented yet, but the package is already usable with the basic options. I'm doing this for fun and to learn how to make a \LaTeX{} package. Therefore, I'm open to any suggestion or contribution :

\begin{center}
    \texttt{
        contact at ensciences dot fr
    }
\end{center}



\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]
    \begin{tabular}{lp{7cm}p{3cm}}
        \texttt{scale}             & Scale of the oscilloscope (with \texttt{scalebox}).                                     & Default: \texttt{1}.                                             \\
        \texttt{second channel}    & 1 if the second channel is enabled, 0 otherwise.                                        & Default: \texttt{0}.                                             \\
        \texttt{screen offset one} & Vertical screen offset of the first channel.                                            & Default: \texttt{0}.                                             \\
        \texttt{screen offset two} & Vertical screen offset of the second channel.                                           & Default: \texttt{0}.                                             \\
        \texttt{time div}          & Time division (in ms).                                                                  & Default: \texttt{20}.                                            \\
        \texttt{voltage div one}   & Voltage division of the first channel (in V).                                           & Default: \texttt{1}.                                             \\
        \texttt{voltage div two}   & Voltage division of the second channel (in V).                                          & Default: \texttt{1}.                                             \\
        \texttt{sample rate}       & Sample rate (in Hz).                                                                    & Default: \texttt{200}.                                           \\
        \texttt{xy mode}           & 1 if the oscilloscope is in XY mode, 0 otherwise. \textbf{\color{red}Not working yet !} & Default: 0.                                                      \\
        \texttt{expr one}          & Expression of the first channel (pgf maths format).                                     & Default: \texttt{2*sin(2*180/0.020*x)}.                          \\
        \texttt{expr two}          & Expression of the second channel (pgf maths format).                                    & Default: \texttt{1*sin(2*180/0.020*x) + 0.2*sin(2*180/0.040*x)}. \\
        \texttt{color one}         & Color of the first channel (in hexadecimal).                                            & Default: \texttt{D62626}.                                        \\
        \texttt{color two}         & Color of the second channel (in hexadecimal).                                           & Default: \texttt{1053AF}.                                        \\
        \texttt{color xy}          & Color of the XY mode (in hexadecimal).                                                  & Default: \texttt{2E8B73}.                                        \\
        \texttt{graph back color}  & Background color of the graph (in hexadecimal).                                         & Default: \texttt{FFFFFF}.                                        \\
        \texttt{info back color}   & Background color of the information box (in hexadecimal).                               & Default: \texttt{D6D6D6}.                                        \\
        \texttt{info text color}   & Text color of the information box (in hexadecimal).                                     & Default: \texttt{000000}.                                        \\
        \texttt{main axis color}   & Color of the main axis (in hexadecimal).                                                & Default: \texttt{000000}.                                        \\
        \texttt{sub axis color}    & Color of the sub axis (in hexadecimal).                                                 & Default: \texttt{CCCCCC}.                                        \\
    \end{tabular}
\end{tcolorbox}


\section{Examples}

\begin{tcblisting}{enhanced,breakable,colback=white,colframe=black,width=\textwidth}
    \osci[%
        scale=0.8,
        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,
        expr one=2*sin(2*180/0.020*x),
        expr two=1*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
        color one=D62626,
        color two=1053AF,
        color xy=2E8B73,
        graph back color=669966,
        info back color=D6D6D6,
        info text color=000000,
        main axis color=000000,
        sub axis color=CCCCCC
    ]
    \end{tcblisting}

% \begin{center}
%     \osci[%
%         scale=0.8,
%         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,
%         expr one=2*sin(2*180/0.020*x),
%         expr two=1*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
%         color one=D62626,
%         color two=1053AF,
%         color xy=2E8B73,
%         graph back color=669966,
%         info back color=D6D6D6,
%         info text color=000000,
%         main axis color=000000,
%         sub axis color=CCCCCC
%     ]
% \end{center}

\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.1.0} : Initial release. XY mode not implemented yet.
\end{itemize}

\end{document}
