\documentclass[a4paper,titlepage]{article}
\usepackage{piano}
\usepackage[utf8]{inputenc}

\title{piano Package Documentation and Examples}
\author{Émile Daneault, maintained by Ruslan López Carro}
\date{Version 1.2}

\begin{document}

\maketitle

\section{Introduction}

The \texttt{piano} package provides commands to draw piano keyboard diagrams in LaTeX documents. It supports various keyboard ranges (1 octave, 1.5 octaves, and 2 octaves) with the ability to highlight up to 7 keys.

\section{Key Naming Convention}

Keys are named using the following convention:
\begin{itemize}
    \item \textbf{White keys (first octave)}: Co, Do, Eo, Fo, Go, Ao, Bo
    \item \textbf{Black keys (first octave)}: Cso, Dso, Fso, Gso, Aso
    \item \textbf{White keys (second octave)}: Ct, Dt, Et, Ft, Gt, At, Bt
    \item \textbf{Black keys (second octave)}: Cst, Dst, Fst, Gst, Ast
\end{itemize}

Where:
\begin{itemize}
    \item \texttt{o} = first octave (lower)
    \item \texttt{t} = second octave (higher)
    \item \texttt{s} = sharp (black key)
\end{itemize}

\section{Available Commands}

\subsection{\texttt{\textbackslash keyboard}}

Draws a 1-octave keyboard starting with C, with up to 7 highlighted keys.
\vspace{1cm}
\begin{figure}[h]
\centering
\keyboard[Co][Eo][Go]
\caption{C major triad (1-octave keyboard)}
\end{figure}

\textbf{Example usage:}
\begin{verbatim}
\keyboard[Co][Eo][Go]
\end{verbatim}

\subsection{\texttt{\textbackslash keyboardf}}

Draws a 1-octave keyboard starting with F, with up to 7 highlighted keys.
\vspace{2cm}
\begin{figure}[h]
\centering
\keyboardf[Fo][Ao][Co]
\caption{F major triad (1-octave keyboard starting with F)}
\end{figure}

\textbf{Example usage:}
\begin{verbatim}
\keyboardf[Fo][Ao][Co]
\end{verbatim}

Please note that using \texttt{Ct} instead of \texttt{Co} would place the highlight on the second octave's C key, which is not rendered in this keyboard type.

\subsection{\texttt{\textbackslash keyboardoneandahalfoctaves}}

Draws a 1.5-octave keyboard starting with C, with up to 7 highlighted keys.

\begin{figure}[h]
\centering
\keyboardoneandahalfoctaves[Co][Eo][Go][Ct]
\caption{C major chord with octave (1.5-octave keyboard)}
\end{figure}

\textbf{Example usage:}
\begin{verbatim}
\keyboardoneandahalfoctaves[Co][Eo][Go][Ct]
\end{verbatim}

Please note that using \texttt{Gt} instead of \texttt{Go} would place the highlight on the second octave's G key, which is not rendered in this keyboard type.

\subsection{\texttt{\textbackslash keyboardoneandahalfoctavesf}}

Draws a 1.5-octave keyboard starting with F, with up to 7 highlighted keys.

\begin{figure}[h]
\centering
\keyboardoneandahalfoctavesf[Fo][Ao][Co][Ft]
\caption{F major chord with octave (1.5-octave keyboard starting with F)}
\end{figure}

\textbf{Example usage:}
\begin{verbatim}
\keyboardoneandahalfoctavesf[Fo][Ao][Co][Ft]
\end{verbatim}

\subsection{\texttt{\textbackslash keyboardtwooctaves}}

Draws a 2-octave keyboard starting with C, with up to 7 highlighted keys.

\begin{figure}[h]
\centering
\keyboardtwooctaves[Co][Eo][Gso][Ct][Et]
\caption{C augmented chord (2-octave keyboard)}
\end{figure}

\textbf{Example usage:}
\begin{verbatim}
\keyboardtwooctaves[Co][Eo][Gso][Ct][Et]
\end{verbatim}

\subsection{\texttt{\textbackslash keyboardftwooctaves}}

Draws a 2-octave keyboard starting with F, with up to 7 highlighted keys.

\begin{figure}[h]
\centering
\keyboardftwooctaves[Fo][Ao][Ct][Et][Gt]
\caption{F major 9th chord (2-octave keyboard starting with F)}
\end{figure}

\textbf{Example usage:}
\begin{verbatim}
\keyboardftwooctaves[Fo][Ao][Ct][Et][Gt]
\end{verbatim}

\section{Chord Examples}

\subsection{Major Chords}

\begin{figure}[h]
\centering
\keyboard[Co][Eo][Go]
\caption{C Major}
\end{figure}

\begin{verbatim}
\keyboard[Co][Eo][Go]
\end{verbatim}

\begin{figure}[h]
\centering
\keyboardf[Fo][Ao][Co]
\caption{F Major}
\end{figure}

\begin{verbatim}
\keyboardf[Fo][Ao][Co]
\end{verbatim}
\begin{figure}[h]
\centering
\vspace{1cm}
\keyboardf[Go][Bo][Do]
\caption{G Major}
\end{figure}

\begin{verbatim}
\keyboardf[Go][Bo][Do]
\end{verbatim}

\subsection{Minor Chords}

\begin{figure}[h]
\centering
\keyboard[Co][Dso][Go]
\caption{C Minor}
\end{figure}

\begin{verbatim}
\keyboard[Co][Dso][Go]
\end{verbatim}

\begin{figure}[h]
\centering
\vspace{1cm}
\keyboardf[Fo][Aso][Co]
\caption{F Minor}
\end{figure}

\begin{verbatim}
\keyboardf[Fo][Aso][Co]
\end{verbatim}

\begin{figure}[h]
\centering
\keyboardf[Go][Aso][Do]
\caption{G Minor}
\end{figure}

\begin{verbatim}
\keyboardf[Go][Aso][Do]
\end{verbatim}

\subsection{Seventh Chords}

\begin{figure}[h]
\centering
\keyboardoneandahalfoctaves[Co][Eo][Go][Aso]
\caption{C Major 7th}
\end{figure}

\begin{verbatim}
\keyboardoneandahalfoctaves[Co][Eo][Go][Aso]
\end{verbatim}

\begin{figure}[h]
\centering
\keyboardoneandahalfoctaves[Co][Dso][Go][Aso]
\caption{C Minor 7th}
\end{figure}

\begin{verbatim}
\keyboardoneandahalfoctaves[Co][Dso][Go][Aso]
\end{verbatim}

\subsection{Scales}

\begin{figure}[h]
\centering
\keyboardoneandahalfoctaves[Co][Do][Eo][Fo][Go][Ao][Bo]
\caption{C Major Scale}
\end{figure}

\begin{verbatim}
\keyboardoneandahalfoctaves[Co][Do][Eo][Fo][Go][Ao][Bo]
\end{verbatim}

\begin{figure}[h]
\centering
\keyboardoneandahalfoctaves[Co][Dso][Eo][Fo][Gso][Ao][Bso]
\caption{C Minor Scale (natural)}
\end{figure}

\begin{verbatim}
\keyboardoneandahalfoctaves[Co][Dso][Eo][Fo][Gso][Ao][Bso]
\end{verbatim}

Here please note that you can't add more than seven notes to a diagram.

\begin{figure}[h]
\centering
\keyboardoneandahalfoctaves[Co][Cso][Do][Dso][Eo][Fo][Fso]
\caption{Chromatic Scale}
\end{figure}

\begin{verbatim}
\keyboardoneandahalfoctaves[Co][Cso][Do][Dso][Eo][Fo][Fso]
\end{verbatim}

Here please note that you can't add more than seven notes to a diagram.

\section{Usage Tips}

\begin{itemize}
    \item All commands accept up to 7 optional arguments for highlighted keys
    \item Arguments can be omitted if you want fewer highlighted keys
    \item The highlighting color is orange (RGB: 255, 127, 0)
    \item Keyboard size is fixed and cannot be customized
\end{itemize}

\section{Complete Example}

Here's a complete example showing how to use the package in a document:

\begin{verbatim}
\documentclass{article}
\usepackage{piano}

\begin{document}

\begin{figure}[thpb]
    \centering
    \keyboard[Co][Eo][Gso][Ct][Et]
    \caption{C augmented chord}
    \label{Chord1}
\end{figure}

\end{document}
\end{verbatim}

\section{License}

This package is released under the LaTeX Project Public Licence version 1.3c.

\section{Package Maintainer}

Ruslan López Carro \\
\url{https://ctan.org/home/javatlacati}

\end{document}
