\documentclass[a4paper,french]{article}
\usepackage{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{etex}
\usepackage{fourier}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\usepackage{titlesec}
\usepackage{tcolorbox}
	\tcbuselibrary{skins}
	\tcbuselibrary{theorems}
	\tcbuselibrary{breakable}
\usepackage{tikz-tabular}
	\newcommand{\globalpath}{"c:/texmf/doc/tikz-tabular/"}
	\usetikzlibrary{calc}

\setlength{\parindent}{0pt}

\input{doc.codes.tex}
\input{doc.styles.tex}

\begin{document}

\begin{center}
\begin{tcolorbox}[head]
{\bfseries\LARGE Documentation \texttt{tikz-tabular} }\\[3mm]
{\large Version 0.1 -- \today}\\[3mm]
\textit{English version}
\end{tcolorbox}

{\large
\href{https://www.mathweb.fr/euclide/contact/}{Stéphane Pasquet}}
\end{center}

\begin{tcolorbox}[toc]
\makeatletter
\@starttoc{toc}
\makeatother
\end{tcolorbox}

\newpage

\section{Introduction}

\subsection{Purpose of this package}

This package allows creating a table in graphical mode (based on TiKZ) using a simplified syntax.

\subsection{Python}

It is necessary to have Python installed.

If it is not already done, simply go to the page:
\begin{center}
\url{https://www.python.org/downloads/}
\end{center}
and download the latest version.

\paragraph*{Windows Users:}

Ensure that the path to \texttt{python.exe} is included in the Windows system PATH (if you are using this operating system).

\begin{verbatim}
environment variables > system variables > path to python.exe
\end{verbatim}

The path is of the form:

\begin{verbatim}
C:\Users\<you>\AppData\Local\Programs\Python\Python3xx
\end{verbatim}

\section{Installation}

If you perform a manual installation of this package, you must respect the \LaTeX{} directory structure. If, for example, your manually installed packages are in:
\begin{verbatim}
c:\texmf\
\end{verbatim}
you will need to ensure you have:
\begin{verbatim}
c:\texmf\doc\tikz-tabular\
c:\texmf\latex\tikz-tabular\
\end{verbatim}

\paragraph*{Important Note:} After placing the files in the correct folders, it is necessary to change a line in the \texttt{tikz-tabular.sty} file:
\begin{verbatim}
22 \immediate\write18{python "c:/texmf/tex/latex/tikz-tabular
/tikztabular.py" num-\thetikz@tabular-dir-\globalpath}%
\end{verbatim}
This line must contain the exact path to the Python file in the same directory.

\paragraph*{Windows Users and MikTeX:} Refresh the database once the package is installed.

In the MiKTeX Console,
\begin{verbatim}
Tasks > Refresh file name database
\end{verbatim}

\section{Usage}

\subsection{A Basic Example}

\begin{tikzpicture}
\begin{tikztabular}
<columns=5
[tabulartitle]
\fontfamily{lmss}\selectfont\Large\textbf{My Table}
[endtabulartitle]

[tabularhead]
\textbf{Header 1} & \textbf{Header 2} & \textbf{Header 3} & \textbf{Header 4} &
[endtabularhead]

Cell 1.1 & Cell 1.2 & Cell 1.3 & Cell 1.4 & Cell 1.5
Cell 2.1 & Cell 2.2 & Cell 2.3 & Cell 2.4 & Cell 2.5

[tabularfoot]
\textbf{Foot 1} & \textbf{Foot 2} & \textbf{Foot 3} & \textbf{Foot 4} &
\end{tikztabular}
\end{tikzpicture}

\subsection{The Corresponding \LaTeX{} Code}

\begin{tcblisting}{codeTEX,title={Minimal Code}}
\documentclass{article}
\usepackage{tikz-tabular}
	\newcommand{\globalpath}{"c:/texmf/doc/tikz-tabular/"}

\setlength{\parindent}{0pt}

\begin{document}

\begin{tikzpicture}
\begin{tikztabular}
<columns=5
(*@\ttfamily\color{red}[tabulartitle]@*)
\fontfamily{lmss}\selectfont\Large\textbf{My Table}
(*@\ttfamily\color{red}[endtabulartitle]@*)

(*@\ttfamily\color{red}[tabularhead]@*)
\textbf{Header 1} & \textbf{Header 2} & \textbf{Header 3} & \textbf{Header 4} &
(*@\ttfamily\color{red}[endtabularhead]@*)

Cell 1.1 & Cell 1.2 & Cell 1.3 & Cell 1.4 & Cell 1.5
Cell 2.1 & Cell 2.2 & Cell 2.3 & Cell 2.4 & Cell 2.5

(*@\ttfamily\color{red}[tabularfoot]@*)
\textbf{Foot 1} & \textbf{Foot 2} & \textbf{Foot 3} & \textbf{Foot 4} &
\end{tikztabular}
\end{tikzpicture}

\end{document}
\end{tcblisting}

\newpage

\subsection{Syntax}

\subsubsection{The \textbackslash globalpath Variable}

It is necessary to declare the path of the current file.

Without this, the auxiliary files built for the tables will not be created.

\begin{tcblisting}{codeTEX,title={Minimal Code}}
\newcommand{\globalpath}{"c:/texmf/doc/tikz-tabular/"}
\end{tcblisting}

\subsubsection{The tikztabular Environment}

\begin{tcblisting}{codeTEX,title={Minimal Code}}
\begin{tikzpicture}

\begin{(*@\ttfamily\color{red}tikztabular@*)}
...
\end{(*@\ttfamily\color{red}tikztabular@*)}

\end{tikzpicture}
\end{tcblisting}

It must be within a \texttt{tikzpicture} environment. Indeed, it is built within a \texttt{scope} environment.

\subsubsection{The Table Title (Optional)}

\begin{tcblisting}{codeTEX,title={Minimal Code}}
(*@\ttfamily\color{red}[tabulartitle]@*)
My Title
(*@\ttfamily\color{red}[endtabulartitle]@*)
\end{tcblisting}

It allows declaring that the table has a title. It is displayed across the entire width of the table.

\subsubsection{The Table Column Headers (Optional)}

\begin{tcblisting}{codeTEX,title={Minimal Code}}
(*@\ttfamily\color{red}[tabularhead]@*)
Headers separated by "&"
(*@\ttfamily\color{red}[endtabularhead]@*)
\end{tcblisting}

This allows displaying the column headers differently from other cells.

\subsubsection{The Column Footers (Optional)}

\begin{tcblisting}{codeTEX,title={Minimal Code}}
(*@\ttfamily\color{red}[tabularfoot]@*)
Footers separated by "&"
\end{tcblisting}

This allows displaying the column footers differently from other cells.

Since the footers are supposed to be at the end of the table, there is no \texttt{[endtabularfoot]} command.

\subsubsection{The First Columns}

\begin{tikzpicture}

\begin{tikztabular}
<columns=5
<firstcolumncolor=orange!75!black
[tabulartitle]
My Table
[endtabulartitle]
Cell 1.1 & Cell 1.2 & Cell 1.3 & Cell 1.4 & Cell 1.5
Cell 2.1 & Cell 2.2 & Cell 2.3 & Cell 2.4 & Cell 2.5
\end{tikztabular}

\end{tikzpicture}

\begin{tcblisting}{codeTEX,title={Minimal Code}}
\begin{tikztabular}
<columns=5
<(*@\ttfamily\color{red}firstcolumncolor@*)=orange!75!black
[tabulartitle]
My Table
[endtabulartitle]
Cell 1.1 & Cell 1.2 & Cell 1.3 & Cell 1.4 & Cell 1.5
Cell 2.1 & Cell 2.2 & Cell 2.3 & Cell 2.4 & Cell 2.5
\end{tikztabular}
\end{tcblisting}

\subsubsection{The Last Columns}
\enlargethispage*{2em}

\begin{tikzpicture}

\begin{tikztabular}
<columns=5
<lastcolumncolor=orange!75!black
Cell 1.1 & Cell 1.2 & Cell 1.3 & Cell 1.4 & Cell 1.5
Cell 2.1 & Cell 2.2 & Cell 2.3 & Cell 2.4 & Cell 2.5
\end{tikztabular}

\end{tikzpicture}

\begin{tcblisting}{codeTEX,title={Minimal Code}}
\begin{tikztabular}
<columns=5
<(*@\ttfamily\color{red}lastcolumncolor@*)=orange!75!black
Cell 1.1 & Cell 1.2 & Cell 1.3 & Cell 1.4 & Cell 1.5
Cell 2.1 & Cell 2.2 & Cell 2.3 & Cell 2.4 & Cell 2.5
\end{tikztabular}
\end{tcblisting}

\newpage

\section{Options}

Options should be placed in the \texttt{tikztabular} environment \textit{before} the content of the cells.

They must be placed \textit{necessarily} in the form:
\begin{verbatim}
<option = value (with or without space but with the chevron)
\end{verbatim}

\begin{tikzpicture}
\begin{tikztabular}
<columns=3
<marginv=0.75mm
<cellheight=2.5em

[tabulartitle]
The Options
[endtabulartitle]

[tabularhead]
Option Name & Designation & Example
[endtabularhead]

\texttt{columns} & number of columns & \texttt{columns = 5}

\texttt{corners} & size of rounded corners & \texttt{corners = 1mm}

\texttt{colorcell} & color of cells & \texttt{colorcell = red}

\texttt{tabularwidth} & width of the table & \texttt{tabularwidth = 20cm}

\texttt{cellheight} & height of cells & \texttt{cellheight = 2em}

\texttt{marginh} & \small horizontal margin between two columns & \texttt{marginh = 1em}

\texttt{marginv} & \small vertical margin between two lines & \texttt{marginv = 1em}

\texttt{marginvtitle} & \small vertical margin between the title and the next line & \texttt{marginvtitle = 1em}

\texttt{tabulartitlecolor} & background color of the title & \texttt{tabulartitlecolor = black}

\texttt{texttitlecolor} & color of the title & \texttt{texttitlecolor = white}

\texttt{firstcolumncolor} & \small color of the first column & \texttt{firstcolumncolor = black}

\texttt{lastcolumncolor} & \small color of the last column & \texttt{lastcolumncolor = black}

\texttt{tabularheadcolor} & \small background color of headers & \texttt{tabularheadcolor = orange}

\texttt{textheadcolor} & \small color of header text & \texttt{textheadcolor = white}

\texttt{tabularfootcolor} & \small background color of footers & \texttt{tabularfootcolor = white}

\texttt{textfootcolor} & \small color of footer text & \texttt{textfootcolor = white}

\texttt{textcolor} & \small color of cell text & \texttt{textcolor = black}
\end{tikztabular}
\end{tikzpicture}

\section{F.A.Q.}

\subsection{Why define the environment in a scope?}

I wanted to be able to act on the table, for example by adding arrows.

Each cell has a name in the form:
\begin{verbatim}
(cell-<row>-<column>)
\end{verbatim}
Thus, to join two cells with an arrow, you can write:
\begin{verbatim}
\draw[->,>=latex] (cell-1-1) to[bend left=10] (cell-3-4);
\end{verbatim}

\subsection{Why are options preceded by a chevron?}

Once the processing of options by Python is complete, the program deletes all lines containing the option names.

Imagine that the options are written without any special symbol (like the chevron). If a cell in the table contains a word like "columns" (which is an option), the line containing the word is deleted...

I could have adopted another logic and put, for example, \texttt{[start]} to indicate that the table begins, but this seemed more restrictive.

\subsection{Why declare the \textbackslash globalpath variable?}

\LaTeX{} cannot transmit (to my knowledge) the path of the compiled file.

However, this path is necessary for the Python program.

Therefore, this variable must be defined manually.
\end{document}
