From 2a4061ee287eedaef3db0027a06e8a20d707b4a4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 1 Feb 2016 23:06:34 +0000 Subject: pas-tableur (2feb16) git-svn-id: svn://tug.org/texlive/trunk@39542 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/pas-tableur/README | 4 +- .../texmf-dist/doc/latex/pas-tableur/doc.codes.tex | 144 ++++ .../doc/latex/pas-tableur/doc.styles.tex | 73 +++ .../doc/latex/pas-tableur/pas-tableur.tex | 564 +++++++--------- .../tex/latex/pas-tableur/pas-tableur.sty | 724 +++++++++------------ 5 files changed, 764 insertions(+), 745 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/pas-tableur/doc.codes.tex create mode 100644 Master/texmf-dist/doc/latex/pas-tableur/doc.styles.tex diff --git a/Master/texmf-dist/doc/latex/pas-tableur/README b/Master/texmf-dist/doc/latex/pas-tableur/README index 13fa4f3b946..001719afbb6 100644 --- a/Master/texmf-dist/doc/latex/pas-tableur/README +++ b/Master/texmf-dist/doc/latex/pas-tableur/README @@ -1,4 +1,4 @@ -********* README file for pas-crosswords ****************** +********* README file for pas-tableur ****************** ********************* ENGLISH ***************************** This package uses TikZ to imitate spreadsheet. @@ -18,7 +18,7 @@ directory /doc/ in french language. Thanks to use pas-tableur.sty. -********* Fichier README pour pas-crosswords ****************** +********* Fichier README pour pas-tableur ****************** ********************** FRANCAIS ******************************* Cette extension utilise TikZ pour imiter les feuilles de calculs sous tableur. diff --git a/Master/texmf-dist/doc/latex/pas-tableur/doc.codes.tex b/Master/texmf-dist/doc/latex/pas-tableur/doc.codes.tex new file mode 100644 index 00000000000..429b0cad3c6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pas-tableur/doc.codes.tex @@ -0,0 +1,144 @@ +\tcbuselibrary{listings} +\usetikzlibrary{decorations.pathmorphing} + +% Couleurs utilisées dans la documentation + +\definecolor{codeTitleFont}{cmyk}{0.04,0,0.03,0.16} +\definecolor{codeTitleBackLeft}{cmyk}{0.08,0,0.06,0.76} +\definecolor{codeTitleBackRight}{cmyk}{0.07,0,0.05,0.42} +\definecolor{listingTitleFont}{cmyk}{0,0.31,0.91,0.38} +\definecolor{listingTitleBackLeft}{cmyk}{0,0.05,0.64,0} +\definecolor{listingTitleBackRight}{cmyk}{0,0.03,0.31,0.02} + + +% Code LaTeX + +\tcbset{codeTEX/.style={ + sharp corners=all, + before skip=1em, + after skip=1em, + enhanced, + frame style={ + left color=codeTitleBackLeft, + right color=codeTitleBackRight}, + interior style={ + top color=codeTitleBackLeft!50, + bottom color=codeTitleBackRight!20}, + boxrule=0.7pt, + fonttitle={\sffamily\bfseries\color{codeTitleFont}}, + colback=codeTitleFont, + listing only, + left=6mm, + listing options={ + basicstyle=\ttfamily\fontsize{7}{9}\selectfont, + keywordstyle=\color{blue}, + numbers=left, + language=TeX, + breaklines=true, + morekeywords={definecolor,tcbset,begin, newtcbtheorem,newenvironment,newcommand,bfseries,color, sffamily,tcblower,ttfamily,setlength}, + numberstyle=\tiny\color{red!75!black}}, + breakable + } +} + +% Listing exemples + +\tcbset{listing/.style={ + sharp corners=all, + before skip=1em, + after skip=1em, + enhanced, + frame style={ + left color=listingTitleBackLeft, + right color=listingTitleBackRight}, + boxrule=0.7pt, + fonttitle={\sffamily\bfseries\color{listingTitleFont}}, + colback=listingTitleBackRight, + breakable, + listing options={ + basicstyle=\ttfamily\fontsize{7}{9}\selectfont, + keywordstyle=\color{listingTitleFont}, + numbers=left, + language=TeX, + breaklines=true, + numbersep=5pt, + morekeywords={ifelse,begin,definecolor,tcbset}, + numberstyle=\tiny\color{red!75!black}}, + }, + interior style={ + draw=listingTitleBackLeft, + top color=listingTitleBackLeft!50, + bottom color=listingTitleBackRight!20}, + segmentation style={ + draw=listingTitleFont, + solid, + decorate, + decoration={random steps,segment length=2mm} + } +} + +% Titre de la documentation + +\tcbset{head/.style={ + enhanced, + hbox, + tikznode, + left=8mm, + right=8mm, + boxrule=0.4pt, + colback=white, + colframe=gray, + drop lifted shadow=black!50!yellow, + before=\par\vspace*{5mm}, + after=\par\bigskip, + interior style={ + draw=white, + top color=white, + bottom color=white} + } +} + +% TOC + +\tcbset{toc/.style={ + breakable, + enhanced jigsaw, + title={\color{red!50!black}Sommaire}, + fonttitle=\bfseries\Large, + colback=yellow!10!white, + colframe=red!50!black, + before=\par\bigskip\noindent, + interior style={ + fill overzoom image=goldshade.png, + fill image opacity=0.25}, + colbacktitle=yellow!20, + enlargepage flexible=\baselineskip, + pad at break*=3mm, + attach boxed title to top center={ + yshift=-0.25mm-\tcboxedtitleheight/2, + yshifttext=2mm-\tcboxedtitleheight/2}, + boxed title style={ + enhanced, + boxrule=0.5mm, + frame code={ + \path[tcb fill frame] ([xshift=-4mm]frame.west) -- (frame.north west) + -- (frame.north east) -- ([xshift=4mm]frame.east) + -- (frame.south east) -- (frame.south west) -- cycle; }, + interior code={ + \path[tcb fill interior] ([xshift=-2mm]interior.west) + -- (interior.north west) -- (interior.north east) + -- ([xshift=2mm]interior.east) -- (interior.south east) -- (interior.south west) + -- cycle;} }, + drop fuzzy shadow + } +} + +% Historique de l'extension + +\tcbset{histo/.style={ + enhanced, + breakable, + sidebyside, + lefthand width=1.5cm + } +} \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/pas-tableur/doc.styles.tex b/Master/texmf-dist/doc/latex/pas-tableur/doc.styles.tex new file mode 100644 index 00000000000..8d41016dc12 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pas-tableur/doc.styles.tex @@ -0,0 +1,73 @@ +\makeatletter + +\def\@dottedtocline#1#2#3#4#5{% + \ifnum #1>\c@tocdepth \else + \vskip \z@ \@plus.2\p@ + {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip + \parindent #2\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \@tempdima #3\relax + \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip + {#4}\nobreak + \leaders\hbox{$\m@th + \mkern \@dotsep mu\hbox{.}\mkern \@dotsep + mu$}\hfill + \nobreak + \hb@xt@\@pnumwidth{\hfil\helvbx #5}% + \par}% + \fi} + +\renewcommand*\l@section +{% +\helvbx\color{red!50!black}\bfseries +\def\@linkcolor{red!50!black}\@dottedtocline{1}{1.5em}{1.5em} +} + +\renewcommand*\l@subsection +{% +\helvbx\color{green!50!black} +\def\@linkcolor{green!50!black} +\@dottedtocline{1}{2.3em}{2.6em} +} + +\renewcommand*\l@subsubsection +{% +\helvbx\color{orange!80!black} +\def\@linkcolor{orange!80!black} +\@dottedtocline{1}{3em}{3.3em} +} + +\def\contentsline#1#2#3#4{% + \ifx\\#4\\% + \csname l@#1\endcsname{#2}{#3}% + \else + \csname l@#1\endcsname{\hyper@linkstart{link}{#4}{#2}\hyper@linkend}{% + \hyper@linkstart{link}{#4}{#3}\hyper@linkend + }% + \fi +} + +% -------------------- +% TITRES DES SECTIONS +% -------------------- + +\titleformat{\section}[block] +{\helvbx\Large\color{red!50!black}} +{\fcolorbox{red!50!black}{red!50!black}{\textcolor{white}{\bfseries\thesection}}} +{1em} +{\helvbx} + +\titleformat{\subsection}[block] +{\helvbx\large\color{green!50!black}} +{\thesubsection} +{1em} +{\helvbx} + +\titleformat{\subsubsection}[block] +{\helvbx\large\color{orange!50!black}} +{\thesubsubsection} +{1em} +{\helvbx} + +\makeatother \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/pas-tableur/pas-tableur.tex b/Master/texmf-dist/doc/latex/pas-tableur/pas-tableur.tex index 60d08675c60..33e85c2bb4f 100644 --- a/Master/texmf-dist/doc/latex/pas-tableur/pas-tableur.tex +++ b/Master/texmf-dist/doc/latex/pas-tableur/pas-tableur.tex @@ -1,114 +1,50 @@ -\documentclass[12pt]{article} +\documentclass[a4paper,french]{article} \usepackage[latin1]{inputenc} -\usepackage[french]{babel} -\usepackage[T1]{fontenc} -\usepackage{listings} + \usepackage[T1]{fontenc} +\usepackage{babel} +\usepackage{etex} +\usepackage{fourier} +\usepackage[table]{xcolor} +\usepackage{tabularx} +\usepackage{cellspace} + \setlength{\cellspacetoplimit}{4pt} + \setlength{\cellspacebottomlimit}{4pt} \usepackage[colorlinks=true,urlcolor=blue]{hyperref} -\usepackage[vmargin=2cm,hmargin=2cm]{geometry} -\usepackage{titlesec} \usepackage{pas-tableur} -\usetikzlibrary{arrows} -\usepackage{kpfonts} - -\makeatletter -% ------------------- -% TABLE DES MATIERES -% ------------------- - -\def\@dottedtocline#1#2#3#4#5{% - \ifnum #1>\c@tocdepth \else - \vskip \z@ \@plus.2\p@ - {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip - \parindent #2\relax\@afterindenttrue - \interlinepenalty\@M - \leavevmode - \@tempdima #3\relax - \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip - {#4}\nobreak - \leaders\hbox{$\m@th - \mkern \@dotsep mu\hbox{.}\mkern \@dotsep - mu$}\hfill - \nobreak - \hb@xt@\@pnumwidth{\hfil\normalfont #5}% - \par}% - \fi} - -\renewcommand*\l@section -{% -\color{blueSelecCellBottom} -\def\@linkcolor{blueSelecCellBottom}\@dottedtocline{1}{1.5em}{2.3em} -} - -\renewcommand*\l@subsection -{% -\color{blueSelecCellTop} -\def\@linkcolor{blueSelecCellTop} -\@dottedtocline{1}{2.3em}{2.6em} -} - -\def\contentsline#1#2#3#4{% - \ifx\\#4\\% - \csname l@#1\endcsname{#2}{#3}% - \else - \csname l@#1\endcsname{\hyper@linkstart{link}{#4}{#2}\hyper@linkend}{% - \hyper@linkstart{link}{#4}{#3}\hyper@linkend - }% - \fi -} - -% -------------------- -% TITRES DES SECTIONS -% -------------------- - -\titleformat{\section}[block] -{\helvbx\Large\color{blueSelecCellBottom}} -{\fcolorbox{blueSelecCellBottom}{blueSelecCellBottom}{\textcolor{white}{\bfseries\thesection}}} -{1em} -{\helvbx} - -\titleformat{\subsection}[block] -{\helvbx\large\color{blueSelecCellTop}} -{\thesubsection} -{1em} -{\helvbx} +\usepackage{titlesec} +\usepackage{tcolorbox} + \tcbuselibrary{skins} + \tcbuselibrary{theorems} + \tcbuselibrary{breakable} +\usepackage{listings} +% ---------------------- +\usetikzlibrary{arrows} -\makeatother +\setlength{\parindent}{0pt} -\title{pas-tableur.sty\\\small v2.00} -\date{\today} -\author{Stéphane PASQUET\\\href{mailto:contact@mathweb.fr}{contact@mathweb.fr}} - -\lstset{ - numbers=left, - numberstyle=\tiny, - stepnumber=1, - numbersep=3pt, - language=[LaTeX]TeX, - backgroundcolor=\color{blueSelec}, - frame=shadowbox, - rulesepcolor=\color{blueSelecCellBottom}, - rulecolor=\color{blueSelecCellBottom}, - framexleftmargin=10pt, - keywordstyle=\color{blueSelecCellBottom}\bfseries, - basicstyle=\ttfamily, - columns=flexible, - keepspaces=true, - upquote=true, - commentstyle=\color{gray}, - morekeywords={tableur,celtxt,selecCell,definecolor,colminwidth,lineminheight, multiSelec,tabcolwidth,tabnumlinewidth,tablineheight,helvbx,draw} -} +\input{doc.codes.tex} +\input{doc.styles.tex} -\setlength{\parindent}{0pt} -\begin{document} +\begin{document} -\maketitle +\begin{center} +\begin{tcolorbox}[head] +{\bfseries\LARGE Documentation \texttt{pas-tableur} }\\[3mm] +{\large Version 2.01 -- \today} +\end{tcolorbox} -\tableofcontents +{\large +\href{http://www.mathweb.fr/contact.html}{St\'ephane Pasquet}} +\end{center} -\section{Introduction} +\begin{tcolorbox}[toc] +\makeatletter +\@starttoc{toc} +\makeatother +\end{tcolorbox} -\subsection{Résumé} +\section{Introduction et installation} L'extension \texttt{pas-tableur.sty} a pour but d'imiter l'apparence des tableurs. @@ -116,126 +52,133 @@ Il ne permet en aucun cas d'effectuer des calculs type tableur. \medskip -Pour cette version 2 de l'extension, j'ai souhaité utiliser une syntaxe dans le fichier sty plus intuitive et plus pratique pour effectuer d'autres opérations par rapport à la version 1. +Pour cette version 2 de l'extension, j'ai souhait\'e utiliser une syntaxe dans le fichier sty plus intuitive et plus pratique pour effectuer d'autres op\'erations par rapport \`a la version 1. -\subsection{Installation} +\medskip -Dans le fichier zip, l'arborescence \LaTeX a été conservée pour vous permettre une installation plus facile. +Cette extension charge automatiquement les extensions suivantes : -Ainsi, \texttt{pas-tableur.sty} devra \^etre installée dans le répertoire \og latex \fg{} de votre arborescence \LaTeX, et les fichiers \og pas-tableur.tex \fg{} et \og pas-tableur.pdf \fg{} dans son répertoire \og doc \fg. +\medskip -\subsection{Les extensions chargées} +\begin{quote} +tikz (avec la librairie : calc) \\ +xkeyval\\ +xstring +\end{quote} -Afin de fonctionner correctement, \texttt{pas-tableur.sty} chargent les extensions suivantes : +\newpage -\medskip +On pourra d\'ecompresser \texttt{pas-tableur.zip} +de sorte \`a avoir : \begin{itemize} -\item TiKZ, avec la librairie \og calc \fg{} ; -\item xstring ; -\item xkeyval. +\item Sous Ubuntu : + +\begin{verbatim} +./texlive/texmf-local/tex/latex/pas-tableur/pas-tableur.sty +./texlive/texmf-local/doc/latex/pas-tableur/pas-tableur.tex +./texlive/texmf-local/doc/latex/pas-tableur/pas-tableur.pdf +./texlive/texmf-local/doc/latex/pas-tableur/doc.codes.tex +./texlive/texmf-local/doc/latex/pas-tableur/doc.styles.tex +\end{verbatim} + +\item Sous Windows : + +\begin{verbatim} +C:\texmf\latex\pas-tableur\pas-tableur.sty +C:\texmf\doc\pas-tableur\pas-tableur.tex +C:\texmf\doc\pas-tableur\pas-tableur.pdf +C:\texmf\doc\pas-tableur\doc.codes.tex +C:\texmf\doc\pas-tableur\doc.styles.tex +\end{verbatim} \end{itemize} +\medskip + +Apr\`es installation, n'oubliez pas de taper la commande \texttt{texhash} dans le terminal pour mettre \`a jour la base de donn\'ees des extensions. + +\bigskip + +Sous Mac OS, j'imagine que l'arborescence ressemble \`a ce qui est \'ecrit pr\'ec\'edemment. + + \section{\textbackslash tableur et \textbackslash tableur* : construire un tableur} -Pour créer un tableur, il faudra se mettre dans un environnement \texttt{tikzpicture} et utiliser la commande \textbackslash tableur ou sa version étoilée. +Pour cr\'eer un tableur, il faudra se mettre dans un environnement \texttt{tikzpicture} et utiliser la commande \textbackslash tableur ou sa version \'etoil\'ee. \subsection{\textbackslash tableur} -\begin{lstlisting} +\begin{tcblisting}{codeTEX} \begin{tikzpicture} \tableur[]{} \end{tikzpicture} -\end{lstlisting} +\end{tcblisting} \bigskip -L'argument \og colonnes \fg{} peut se présenter de deux façons différentes : +L'argument \og colonnes \fg{} peut se pr\'esenter de deux fa\c cons diff\'erentes : \bigskip -\begin{minipage}{6cm} -~\par -\begin{lstlisting} -\begin{tikzpicture} -\tableur[2]{A,B,C} -\end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-6.5cm} +\begin{tcblisting}{listing,title=Exemple 1} \begin{tikzpicture} \tableur[2]{A,B,C} \end{tikzpicture} -\end{minipage} +\end{tcblisting} \bigskip -\begin{minipage}{6cm} -~\par -\begin{lstlisting} +\begin{tcblisting}{listing,title=Exemple 2} \begin{tikzpicture} \tableur[2]{A-D} \end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-6.5cm} -\begin{tikzpicture} -\tableur[2]{A-C} -\end{tikzpicture} -\end{minipage} +\end{tcblisting} \bigskip -Pour cette macro, les valeurs par défaut sont : +Pour cette macro, les valeurs par d\'efaut sont : \medskip \begin{itemize} \item la hauteur de chaque ligne : 1.57em ; \item la largeur de chaque colonne : 7em ; -\item la largeur de la 1\iere{} colonne (contenant le numéros des lignes) : 3em ; -\item le nombre de lignes : si l'option entre crochets n'est pas informée, il y aura 1 ligne. +\item la largeur de la 1\iere{} colonne (contenant le num\'eros des lignes) : 3em ; +\item le nombre de lignes : si l'option entre crochets n'est pas inform\'ee, il y aura 1 ligne. \end{itemize} \medskip -Pour changer ces valeurs par défaut, on utilisera les commandes : +Pour changer ces valeurs par d\'efaut, on utilisera les commandes : \medskip -\begin{lstlisting} +\begin{tcblisting}{codeTEX} \tabcolwidth{2cm} % pour que chaque colonne ait une largeur de 2 cm -\tabnumlinewidth{1cm} % pour que la 1ère colonne fasse 1 cm de large +\tabnumlinewidth{1cm} % pour que la 1\`ere colonne fasse 1 cm de large \tablineheight{15mm} % pour que chaque ligne ait une hauteur de 15 mm -\end{lstlisting} +\end{tcblisting} -\paragraph*{Attention :} il faut impérativement mettre l'unité (cm, mm, em, ex ou pt). +\paragraph*{Attention :} il faut imp\'erativement mettre l'unit\'e (cm, mm, em, ex ou pt). \subsection{\textbackslash tableur*} -La version étoilée de \textbackslash\texttt{tableur} permet de construire un tableur dont les colonnes n'ont pas les m\^emes dimensions. - -%\medskip% +La version \'etoil\'ee de \textbackslash\texttt{tableur} permet de construire un tableur dont les colonnes n'ont pas les m\^emes dimensions. -\begin{lstlisting} -\tableur*{A/2cm,B/4cm,C/1cm,D/4cm} -\end{lstlisting} -\begin{center} +\begin{tcblisting}{listing} \begin{tikzpicture} -\tableur*{A/2cm,B/4cm,C/1cm,D/4cm} +\tableur*[2]{A/2cm,B/4cm,C/1cm,D/3cm} \end{tikzpicture} -\end{center} +\end{tcblisting} + +\newpage \subsection{Les noms de colonnes} -Les colonnes peuvent porter n'importe quelle lettre majuscule de l'alphabet latin :\\ ABCDEFGHIJKLMNOPKRSTUVWXYZ. +Les colonnes peuvent porter n'importe quelle lettre majuscule de l'alphabet latin : + +ABCDEFGHIJKLMNOPKRSTUVWXYZ. On ne peut pas nommer les colonnes par \og AA \fg{} par exemple. @@ -243,87 +186,77 @@ On ne peut pas nommer les colonnes par \og AA \fg{} par exemple. Quant aux lignes, elles commencent toujours par \og 1 \fg. -\subsection{Les couleurs par défaut} -Deux couleurs sont utilisées pour les cases \og en-t-\^etes \fg{} : +\subsection{Les couleurs par d\'efaut} + +Deux couleurs sont utilis\'ees pour les cases \og en-t-\^etes \fg{} : \medskip -\begin{lstlisting} +\begin{tcblisting}{codeTEX} \definecolor{grayTopCell}{cmyk}{0.08,0.05,0.06,0} \definecolor{grayBottomCell}{cmyk}{0.1,0.07,0.08,0} -\end{lstlisting} +\end{tcblisting} \medskip -Pour les changer, vous pouvez les redéfinir après avoir appelé \texttt{pas-tableur}. +Pour les changer, vous pouvez les red\'efinir apr\`es avoir appel\'e \texttt{pas-tableur}. \medskip -Le gris de séparation des cellules est, quant à lui, défini par : +Le gris de s\'eparation des cellules est, quant \`a lui, d\'efini par : \medskip -\begin{lstlisting} +\begin{tcblisting}{codeTEX} \definecolor{graySepCell}{cmyk}{0.29,0.21,0.21,0} -\end{lstlisting} +\end{tcblisting} -\subsection{La police de caractère des en-t\^ete} +\subsection{La police de caract\`ere des en-t\^ete} -\begin{lstlisting} +\begin{tcblisting}{codeTEX} \newcommand{\helvbx}{\usefont{T1}{phv}{m}{n}} -\end{lstlisting} +\end{tcblisting} \medskip -Ainsi, si vous souhaitez insérer le nom d'une cellule dans votre document, vous pouvez utiliser la syntaxe suivante : +Ainsi, si vous souhaitez ins\'erer le nom d'une cellule dans votre document, vous pouvez utiliser la syntaxe suivante : \medskip -\begin{minipage}{8cm} -\begin{lstlisting} +\begin{tcblisting}{listing} Dans la cellule {\helvbx A3}, nous -avons inséré la formule ... -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-8.5cm} -Dans la cellule {\helvbx A3}, nous avons inséré la formule ... -\end{minipage} +avons ins\'er\'e la formule... +\end{tcblisting} + \subsection{Nomination des cellules} -Toujours dans un logique de simplifier la rédaction des documents, j'ai souhaité nommer chaque cellule de façon intuitive. +Toujours dans un logique de simplifier la r\'edaction des documents, j'ai souhait\'e nommer chaque cellule de fa\c con intuitive. -Ainsi, la cellule {\helvbx A1} est nommée : cellA-1. +Ainsi, la cellule {\helvbx A1} est nomm\'ee : cellA-1. -Cette précision est utile lorsque l'on souhaite ajouter des flèches vers certaines cellules comme dans l'exemple suivant : +Cette pr\'ecision est utile lorsque l'on souhaite ajouter des fl\`eches vers certaines cellules comme dans l'exemple suivant : \medskip -\begin{lstlisting} +\begin{tcblisting}{listing} \begin{tikzpicture} -\tableur[3]{A-E} -\draw[<-] (cellB-2.center) to[bend right=30] ($(cellB-2)+(2,-1.7)$) +\tableur[3]{A-D} +\draw[<-,>=latex'] (cellB-2.center) to[bend right=30] ($(cellB-2)+(2,-1.7)$) node[right] {C'est la cellule {\helvbx B2}}; \end{tikzpicture} -\end{lstlisting} - -\begin{tikzpicture} -\tableur[3]{A-E} -\draw[<-,>=stealth'] (cellB-2.center) to[bend right=30] ($(cellB-2)+(2,-1.7)$) node[right] {C'est la cellule {\helvbx B2}}; -\end{tikzpicture} +\end{tcblisting} -\section{\textbackslash celtxt : insérer du texte dans une cellule} +\section{\textbackslash celtxt et \textbackslash celtxt* : ins\'erer du texte dans une cellule} -\subsection{Syntaxe générale} - -\begin{lstlisting} +\begin{tcblisting}{codeTEX} +% Ins\'erer une formule ou un texte \celtxt[}{}{}{} -\end{lstlisting} +% Ins\'erer un texte en mode math\'ematiques ou non +\celtxt*[}{}{}{} +\end{tcblisting} \medskip @@ -333,60 +266,38 @@ Les options sont : \begin{itemize} \item \texttt{c} : pour centrer le texte ; -\item \texttt{l} : pour positionner le texte à gauche (c'est cette valeur qui est désignée par défaut) ; -\item \texttt{r} : pour positionner le texte à droite ; -\item \texttt{width=} : pour spécifier la largeur de la colonne dans le cas où nous avons utiliser la commande \textbackslash\texttt{tableur*}. Par défaut, la largeur est 7em (largeur par défaut de chaque colonne) ; -\item \texttt{color=} : couleur du texte. Par défaut, la couleur est noire. +\item \texttt{l} : pour positionner le texte \`a gauche (c'est cette valeur qui est d\'esign\'ee par d\'efaut) ; +\item \texttt{r} : pour positionner le texte \`a droite ; + +\item \texttt{width=} : pour sp\'ecifier la largeur de la colonne dans le cas o\`u nous avons utilis\'e la commande \texttt{\textbackslash tableur*}. Par d\'efaut,la largeur est 7em (largeur par d\'efaut de chaque colonne) ; + +\item \texttt{color=} : couleur du texte. Par d\'efaut, la couleur est noire. \end{itemize} \medskip -Le texte peut \^etre formatté de deux façons différentes selon qu'il désigne une formule ou un texte normal, comme le montre l'exemple suivant : +Le texte peut \^etre format\'e de deux fa\c cons diff\'erentes selon qu'il d\'esigne une formule ou un texte normal, comme le montre l'exemple suivant : \bigskip -\begin{minipage}{7cm} -\begin{lstlisting} -\begin{tikzpicture} -\tableur[2]{M-O} -\celtxt{M}{1}{=B1^2} -\celtxt[r]{N}{2}{Du texte ici} -\end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-7.5mm} +\begin{tcblisting}{listing,title=Exemple 1} \begin{tikzpicture} \tableur[2]{M-O} \celtxt{M}{1}{=B1^2} \celtxt[r]{N}{2}{Du texte ici} \end{tikzpicture} -\end{minipage} +\end{tcblisting} \medskip -\begin{minipage}{7cm} -\begin{lstlisting} +\begin{tcblisting}{listing,title=Exemple 2} \begin{tikzpicture} \tableur*[2]{M/13mm,N/3cm} \celtxt[width=13mm]{M}{1}{=B1^2} \celtxt[r,width=3cm]{N}{2} {Du texte ici} \end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-7.5mm} -\begin{tikzpicture} -\tableur*[2]{M/13mm,N/3cm} -\celtxt[width=13mm]{M}{1}{=B1^2} -\celtxt[r,width=3cm]{N}{2}{Du texte ici} -\end{tikzpicture} -\end{minipage} +\end{tcblisting} \subsection{Formater le texte} @@ -394,26 +305,14 @@ On peut mettre en italique : \medskip -\begin{minipage}{7cm} -\begin{lstlisting} +\begin{tcblisting}{listing,title=\'Ecrire en italique} \begin{tikzpicture} \tableur[2]{M-O} \celtxt{M}{1}{=B1^2} \celtxt[r]{N}{2} {\itshape Du texte ici} \end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-7.5mm} -\begin{tikzpicture} -\tableur[2]{M-O} -\celtxt{M}{1}{=B1^2} -\celtxt[r]{N}{2}{\itshape Du texte ici} -\end{tikzpicture} -\end{minipage} +\end{tcblisting} \medskip @@ -421,139 +320,150 @@ ou m\^eme en gras : \medskip -\begin{minipage}{7cm} -\begin{lstlisting} +\begin{tcblisting}{listing,title=\'Ecrire en gras} \begin{tikzpicture} \tableur[2]{M-O} \celtxt{M}{1}{=B1^2} \celtxt[r]{N}{2} {\bfseries Du texte ici} \end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-7.5mm} -\begin{tikzpicture} -\tableur[2]{M-O} -\celtxt{M}{1}{=B1^2} -\celtxt[r]{N}{2}{\bfseries Du texte ici} -\end{tikzpicture} -\end{minipage} - -\medskip +\end{tcblisting} voire m\^eme en petites majuscules : \medskip - -\begin{minipage}{7cm} -\begin{lstlisting} +\begin{tcblisting}{listing,title=\'Ecrire en petites majuscules} \begin{tikzpicture} \tableur[2]{M-O} \celtxt{M}{1}{=B1^2} \celtxt[r,color=red]{N}{2} {\scshape Du texte ici} \end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-7.5mm} +\end{tcblisting} + +\subsection{Mode math\'ematique dans une cellule} + +G\'en\'eration des premiers termes de la suite d\'efinie par $\left\{\begin{array}{l} +u_0=5\\ +u_{n+1}=au_n+0,1 +\end{array} +\right.$ o\`u $a$ est une valeur mise dans la cellule \helvbx{ +C1}. + +\begin{tcblisting}{listing,title=\'Ecrire en mode math\'ematique} \begin{tikzpicture} -\tableur[2]{M-O} -\celtxt{M}{1}{=B1^2} -\celtxt[r,color=red]{N}{2}{\scshape Du texte ici} +\tableur*[3]{A/2cm,B/3cm,C/2cm} +\celtxt*[c]{A}{1}{$n$} +\celtxt*[c]{B}{1}{$u_n$} +\celtxt[c]{C}{1}{0.85} +\celtxt[c]{A}{2}{0} +\celtxt[c]{B}{2}{5} +\celtxt{A}{3}{=A2+1} +\celtxt{B}{3}{=$C$1*B2+0.1} \end{tikzpicture} -\end{minipage} +\end{tcblisting} + +\paragraph*{Remarque :} les commandes \texttt{\textbackslash celtxt} et sa version \'etoil\'ee (introduites dans la version 2.01 du 31 janvier 2016) ont \'et\'e r\'e-\'ecrites et imagin\'ees sur la page \url{https://groups.google.com/forum/#!topic/fr.comp.text.tex/7K1r9fUd_Rs}. J'ai donc d\'ecid\'e d'introduire ce nouveau code car il semblerait que certains utilisateurs aient express\'ement envie d'ins\'erer du texte en mode math\'ematique dans certaines cellules. -\section{Sélection de cellules} +\section{S\'election de cellules} -\subsection{\textbackslash selecCell : sélection d'une cellule} +\subsection{\textbackslash selecCell : s\'election d'une cellule} -\begin{lstlisting} +\begin{tcblisting}{codeTEX} \selecCell{}{} -\end{lstlisting} +\end{tcblisting} \medskip -Permet de simuler le cas où une cellule est sélectionnée, comme le montre l'exemple suivant : +Permet de simuler le cas o\`u une cellule est s\'electionn\'ee, comme le montre l'exemple suivant : \medskip -\begin{minipage}{7cm} -~\par -\begin{lstlisting} -\begin{tikzpicture} -\tableur[3]{M-O} -\selecCell{N}{2} -\end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-7.5mm} +\begin{tcblisting}{listing} \begin{tikzpicture} -\tableur[3]{M-O} +\tableur[2]{M-O} \selecCell{N}{2} \end{tikzpicture} -\end{minipage} +\end{tcblisting} + -\subsection{\textbackslash multiSelec : sélection de plusieurs colonnes} +\subsection{\textbackslash multiSelec : s\'election de plusieurs colonnes} Voyons un exemple pour comprendre la syntaxe : \medskip -\begin{minipage}{7cm} -~\par -\begin{lstlisting} -\begin{tikzpicture} -\tableur[3]{M-O} -\multiSelec{N-2}{O-3} -\end{tikzpicture} -\end{lstlisting} -\end{minipage} -\begin{minipage}{5mm} -~\par -\end{minipage} -\begin{minipage}{\dimexpr\linewidth-7.5mm} +\begin{tcblisting}{listing} \begin{tikzpicture} \tableur[3]{M-O} \multiSelec{N-2}{O-3} \end{tikzpicture} -\end{minipage} +\end{tcblisting} + +\newpage -\subsection{Les couleurs par défaut} +\subsection{Les couleurs par d\'efaut} -\begin{lstlisting} +\begin{tcblisting}{codeTEX} % Pour les en-tetes \definecolor{blueSelecCellTop}{cmyk}{0.52,0.17,0,0} \definecolor{blueSelecCellBottom}{cmyk}{0.75,0.34,0,0} -% Pour les cellules sélectionnées +% Pour les cellules s\'electionn\'ees \definecolor{blueSelec}{cmyk}{0.23,0.06,0,0} -\end{lstlisting} +\end{tcblisting} \medskip -\`A noter qu'une opacité de 50\% est appliquée pour les cellules sélectionnées (afin de voir les traits de séparation des cellules). - -\section{Suggestions et remarques} - -Je suis bien entendu ouvert à toute suggestion d'évolution et remarques. C'est d'ailleurs à l'aide de vos remarques que j'ai pu faire évoluer cette extension. - -N'hésitez donc pas à m'envoyer un mail ou a poster votre soucis sur le forum de \href{http://forum.mathematex.net}{mathematex}. - -\medskip - -J'attire toutefois votre attention sur le fait que toute demande concernant un problème de compilation doit \^etre postée sur le forum (en non envoyée par mail) et accompagnée d'un code précis afin que cela serve aux multiples utilisateurs de cette extension. - -\medskip +\`A noter qu'une opacit\'e de 50\,\% est appliqu\'ee pour les cellules s\'electionn\'ees (afin de voir les traits de s\'eparation des cellules). + +\section{R\'esum\'e des commandes \`a travers des exemples} + +\begin{tabularx}{\linewidth}{|Sl|X|} +\hline +\texttt{\textbackslash tableur[3]\{A-F\}} & Trace un tableur sur 3 lignes, avec les colonnes A, B, C, D, E, F. +\\ +\hline +\texttt{\textbackslash tableur[2]\{A,B,C\}} & Trace un tableur sur 2 lignes, avec les colonnes A, B, C.\\ +\hline +\texttt{\textbackslash tableur*[3]\{A/2cm,B/5cm\}} & Trace un tableur sur 3 lignes, avec des colonnes A et B de largeur diff\'erente.\\ +\hline +\texttt{\textbackslash celtxt[c]\{A\}\{1\}\{=B2*2\}} & Affiche la formule \og =B2*2 \fg{} dans la cellule A1 centr\'ee horizontalement.\\ +\hline +\texttt{\textbackslash celtxt[color=red]\{A\}\{1\}\{=B2*2\}} & Affiche en rouge la formule \og =B2*2 \fg{} dans la cellule A1.\\ +\hline +\texttt{\textbackslash celtxt[width=5cm]\{A\}\{1\}\{=B2*2\}} & Affiche la formule \og =B2*2 \fg{} dans la cellule A1, de largeur 5 cm.\\ +\hline +\texttt{\textbackslash celtxt*[r]\{A\}\{1\}\{\verb+$+u\verb+_+n\verb+$+\}} & Affiche \og $u_n$ \fg{} dans la cellule A1, align\'e \`a droite.\\ +\hline +\texttt{\textbackslash selecCell\{A\}\{1\}} & Dessine un cadre autour de la cellule A1.\\ +\hline +\texttt{\textbackslash multiSelec\{A-1\}\{C-2\}} & Simule la s\'election des cellules allant de A1 \`a C2.\\ +\hline +\texttt{\textbackslash helvbx\{A1\}} & Affiche \helvbx{A1}.\\ +\hline +\end{tabularx} + +\newpage +\section{Implantation} + +\lstset{% +numbers=left, +numberstyle=\tiny, +tabsize=2, +stepnumber=5, +numbersep=5pt, +language=TeX, +breaklines=true, +basicstyle=\small,% +keywordstyle=\color{red!50!black},% +identifierstyle=, % +commentstyle=\color{gray},% +stringstyle=\ttfamily,% +showstringspaces=true, +morekeywords={newcommand,definecolor,RequirePackage, usetikzlibrary,fill,node,draw,tikzstyle,StrChar,StrBetween, foreach,IfSubStr,StrBefore,StrBehind,StrLen,IfBeginWith,makebox, dimexpr,StrGobbleLeft,setlength}} + +\lstinputlisting{pas-tableur.sty} -Je ne répondrai par mail qu'aux questions concernant directement \texttt{pas-tableur}, et non aux problèmes de compilation, qui sont plus d'ordre technique. \end{document} \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/pas-tableur/pas-tableur.sty b/Master/texmf-dist/tex/latex/pas-tableur/pas-tableur.sty index f1422a6f9f2..e98aa208bcb 100644 --- a/Master/texmf-dist/tex/latex/pas-tableur/pas-tableur.sty +++ b/Master/texmf-dist/tex/latex/pas-tableur/pas-tableur.sty @@ -1,461 +1,353 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% pas-tableur.sty v2.00 encodage : UTF8 % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% Créé par Stéphane PASQUET % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% pas-tableur.sty v2.01 encodage : UTF8 % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% Cree par Stephane PASQUET % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -\def\fileversion{2.00} -\def\filedate{2014/08/16} +\def\fileversion{2.1} +\def\filedate{2016/01/31} \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesClass{pas-tableur}[% \filedate\space v\fileversion\space LaTeX package by Stephane PASQUET] -\@ifpackageloaded{tikz}{}{\RequirePackage{tikz}} +\RequirePackage{tikz} \usetikzlibrary{calc} -\@ifpackageloaded{xstring}{}{\RequirePackage{xstring}} -\@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}} - - -% Définition des couleurs - +\RequirePackage{xstring} +\RequirePackage{xkeyval} +% +% Definition des couleurs +% \definecolor{grayTopCell}{cmyk}{0.08,0.05,0.06,0} \definecolor{grayBottomCell}{cmyk}{0.1,0.07,0.08,0} \definecolor{graySepCell}{cmyk}{0.29,0.21,0.21,0} \definecolor{blueSelecCellTop}{cmyk}{0.52,0.17,0,0} \definecolor{blueSelecCellBottom}{cmyk}{0.75,0.34,0,0} \definecolor{blueSelec}{cmyk}{0.23,0.06,0,0} - -% Définition des dimensions par défaut - +% +% Definition des dimensions par defaut +% \def\col@width{7em} -\def\numline@width{3em} % largeur de la colonne indiquant le numéros des lignes +\def\numline@width{3em} % largeur de la colonne indiquant le numeros des lignes \def\line@height{1.57em} - - %==> Changer les valeurs par défaut +% + %==> Changer les valeurs par defaut \newcommand*{\tabcolwidth}[1]{\def\col@width{#1}} \newcommand*{\tabnumlinewidth}[1]{\def\numline@width{#1}} \newcommand*{\tablineheight}[1]{\def\line@height{#1}} - -% Définition des polices de caractères - +% +% Definition des polices de caracteres +% \newcommand{\helvbx}{\usefont{T1}{phv}{m}{n}} - -% Construction du tableur - - %==> Style des cellules - \tikzstyle{celempty} = [outer sep=0pt] - \tikzstyle{celhead} = [draw=black,rectangle,outer sep=0pt] - - %==> Macro de redirection : étoilée ou pas étoilée ? - \newcommand{\tableur}{\@ifstar{\tableur@star}{\tableur@nostar}} - - %==> Macro étoilée : \tableur*{A/,B/,...}. Tableur avec colonnes de largeurs différentes - \newcommand{\tableur@star}[2][1] +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Construction du tableur % +%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%==> Macro intermediaire : trace de la premiere cellule +% +\newcommand{\pastab@draw@cell}[5] +% #1 : \first@width, #2 : \first@name, #3 : 0=colonne1 / 1=autres colonnes / +% 2 = ligne 1, #4 : coord., #5 : contenu {% - \xdef\list@of@col{#2} - % Placement de la première cellule en-tête - \StrChar{#2}{1}[\first@name] - \StrBetween{#2}{/}{,}[\first@width] - \node[minimum width={\first@width},minimum height=\line@height,celhead] (\first@name) {\helvbx\first@name}; - \fill[grayBottomCell] - (\first@name.south west) -- - (\first@name.south east) -- - ($0.5*(\first@name.south east)+0.5*(\first@name.north east)$) -- - ($0.5*(\first@name.south west)+0.5*(\first@name.north west)$) -- - cycle; - \fill[grayTopCell] - (\first@name.north west) -- - (\first@name.north east) -- - ($0.5*(\first@name.south east)+0.5*(\first@name.north east)$) -- - ($0.5*(\first@name.south west)+0.5*(\first@name.north west)$) -- - cycle; - \node[minimum width={\first@width},minimum height=\line@height,celhead] at (\first@name) {\helvbx\first@name}; - - % Placement des autres en-têtes de colonnes - - \foreach \name/\w [remember=\name as \lastname,count=\colnumber] in {#2} - { - \ifx\name\first@name + \ifnum#3=0% + \tikzstyle{cellstyle} = [celhead,minimum width={#1},minimum height=\line@height]% + \def\pastableur@coord{(0,0)}% + \else% + \ifnum#3=1% + \tikzstyle{cellstyle} = [celhead,right,minimum width={#1},minimum height=\line@height]% \else - \node[minimum width={\w},minimum height=\line@height,celhead,right] (\name) at (\lastname.east) {\helvbx\name}; - \fill[grayBottomCell] - (\name.south west) -- - (\name.south east) -- - ($0.5*(\name.south east)+0.5*(\name.north east)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)$) -- - cycle; - \fill[grayTopCell] - (\name.north west) -- - (\name.north east) -- - ($0.5*(\name.south east)+0.5*(\name.north east)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)$) -- - cycle; - \node[minimum width={\w},minimum height=\line@height,celhead,right] at (\lastname.east) {\helvbx\name}; - \fi - } - - % Placement des en-têtes de lignes - - \node[below left,celhead,minimum width=\numline@width,minimum height=\line@height] (numline1) at (\first@name.south west) {\helvbx 1}; + \ifnum#3=2% + \tikzstyle{cellstyle} = [below left,celhead,minimum width={#1},minimum height=\line@height] + \else% + \tikzstyle{cellstryle} = [below,celhead,minimum width={#1},minimum height=\line@height] + \fi% + \fi% + \def\pastableur@coord{(#4)}% + \fi% + \node[cellstyle] (#2) at \pastableur@coord {\helvbx#5};% \fill[grayBottomCell] - (numline1.south west) -- - (numline1.south east) -- - ($0.5*(numline1.south east)+0.5*(numline1.north east)$) -- - ($0.5*(numline1.south west)+0.5*(numline1.north west)$) -- - cycle; + (#2.south west) -- + (#2.south east) -- + ($0.5*(#2.south east)+0.5*(#2.north east)$) -- + ($0.5*(#2.south west)+0.5*(#2.north west)$) -- + cycle;% \fill[grayTopCell] - (numline1.north west) -- - (numline1.north east) -- - ($0.5*(numline1.south east)+0.5*(numline1.north east)$) -- - ($0.5*(numline1.south west)+0.5*(numline1.north west)$) -- - cycle; - \node[below left,celhead,minimum width=\numline@width,minimum height=\line@height] (numline1) at (\first@name.south west) {\helvbx1}; - \ifnum#1>1 - \foreach \num@line [remember=\num@line as \lastnum (initially 1)] in {2,...,#1} - { - \node[below,celhead,minimum width=\numline@width,minimum height=\line@height] (numline\num@line) at (numline\lastnum.south) {\helvbx\num@line}; - \fill[grayBottomCell] - (numline\num@line.south west) -- - (numline\num@line.south east) -- - ($0.5*(numline\num@line.south east)+0.5*(numline\num@line.north east)$) -- - ($0.5*(numline\num@line.south west)+0.5*(numline\num@line.north west)$) -- - cycle; - \fill[grayTopCell] - (numline\num@line.north west) -- - (numline\num@line.north east) -- - ($0.5*(numline\num@line.south east)+0.5*(numline\num@line.north east)$) -- - ($0.5*(numline\num@line.south west)+0.5*(numline\num@line.north west)$) -- - cycle; - \node[below,celhead,minimum width=\numline@width,minimum height=\line@height] (numline\num@line) at (numline\lastnum.south) {\helvbx\num@line}; - } - \fi - - % Tracé de la grille - - \foreach \name/\w in {#2} - { - \node[celempty,below,minimum height=\line@height,minimum width=\w] (cell\name-1) at (\name.south) {}; - \draw[graySepCell] ($(cell\name-1.south west)+(0.25pt,0)$) -- (cell\name-1.south east) -- ($(cell\name-1.north east)+(0,-0.25pt)$); - } - \ifnum#1>1 - \foreach\numline [remember=\numline as \lastnumline (initially 1)] in {2,...,#1} - { - \foreach \name/\w in {#2} - { - \node[celempty,below,minimum height=\line@height,minimum width=\w] (cell\name-\numline) at (cell\name-\lastnumline.south) {}; - \draw[graySepCell] ($(cell\name-\numline.south west)+(0.25pt,0)$) -- (cell\name-\numline.south east) -- ($(cell\name-\numline.north east)+(0,-0.25pt)$); - } - } - \fi + (#2.north west) -- + (#2.north east) -- + ($0.5*(#2.south east)+0.5*(#2.north east)$) -- + ($0.5*(#2.south west)+0.5*(#2.north west)$) -- + cycle;% + \node[minimum width={#1},minimum height=\line@height,cellstyle] at \pastableur@coord {\helvbx#5};% + } +% +%==> Macro intermediaire : trace de la grille +% +\newcommand{\pastableur@grid}[4] % #1 : width, #2 : name, #3 : numline, #4 : coord. + {% + \node[celempty,below,minimum height=\line@height,minimum width=#1] (cell#2-#3) at (#4) {};% + \draw[graySepCell] ($(cell#2-#3.south west)+(0.25pt,0)$) -- (cell#2-#3.south east) -- ($(cell#2-#3.north east)+(0,-0.25pt)$);% + } +% +%==> Style des cellules +% +\tikzstyle{celempty} = [outer sep=0pt] +\tikzstyle{celhead} = [draw=black,rectangle,outer sep=0pt] +% +%==> Macro de redirection : etoilee ou pas etoilee ? +% +\newcommand{\tableur}{\@ifstar{\tableur@star}{\tableur@nostar}} +% +%==> Macro etoilee : \tableur*{A/,B/,...}. Tableur avec colonnes de largeurs differentes +% +\newcommand{\tableur@star}[2][1] + {% + \xdef\list@of@col{#2}% + % Placement de la premiere cellule en-tête + \StrChar{#2}{1}[\first@name]% + \StrBetween{#2}{/}{,}[\first@width]% + \pastab@draw@cell{\first@width}{\first@name}{0}{}{\first@name} + % Placement des autres en-têtes de colonnes + \foreach \name/\w [remember=\name as \lastname,count=\colnumber] in {#2} + {% + \ifx\name\first@name% + \else% + \pastab@draw@cell{\w}{\name}{1}{\lastname.east}{\name} + \fi% + }% + % Placement des en-têtes de lignes + \pastab@draw@cell{\numline@width}{numline1}{2}{\first@name.south west}{1} + \ifnum#1>1% + \foreach \num@line [remember=\num@line as \lastnum (initially 1)] in {2,...,#1} + {% + \pastab@draw@cell{\numline@width}{numline\num@line}{3}{numline\lastnum.south east}{\num@line}% + }% + \fi% + % Trace de la grille + \foreach \name/\w in {#2} + {% + \pastableur@grid{\w}{\name}{1}{\name.south}% + }% + \ifnum#1>1% + \foreach\numline [remember=\numline as \lastnumline (initially 1)] in {2,...,#1} + {% + \foreach \name/\w in {#2} + {% + \pastableur@grid{\w}{\name}{\numline}{cell\name-\lastnumline.south}% + }% + }% + \fi% } % --> Fin de \tableur* - - %==> Macro non étoilée : \tableur{A,B,C,...} ou \tableur{A-C} - - %----------> Liste des noms de colonnes <---------- - \xdef\col@names{ABCDEFGHIJKLMNOPQRSTUVWXYZ} - - \newcommand{\tableur@nostar}[2][1] % [#1] -> nombre de lignes (par défaut, "1"), #2 -> A,B,...,Z +% +%==> Macro non etoilee : \tableur{A,B,C,...} ou \tableur{A-C} +% +\xdef\col@names{ABCDEFGHIJKLMNOPQRSTUVWXYZ} %----------> Liste des noms de colonnes <---------- +% +\newcommand{\tableur@nostar}[2][1] % [#1] -> nombre de lignes (par defaut, "1"), #2 -> A,B,...,Z {% \IfSubStr{#2}{-} {% - \StrBefore{#2}{-}[\str@start] % 1ère lettre, par ex. "G" - \StrBehind{#2}{-}[\str@end] % 2ème lettre, par ex. "L" + \StrBefore{#2}{-}[\str@start] % 1ere lettre, par ex. "G" + \StrBehind{#2}{-}[\str@end] % 2eme lettre, par ex. "L" \StrBetween{\col@names}{\str@start}{\str@end}[\str@col] % retourne par exemple "HIJK" \edef\str@col{\str@start\str@col\str@end} % retourne alors "GHIJKL" \StrLen{\str@col}[\nb@columns] % nombre de colonnes - % --> On place la première cellule en-tête - \node[minimum width={\col@width},minimum height=\line@height,celhead] (\str@start) {\helvbx\str@start}; - \fill[grayBottomCell] - (\str@start.south west) -- - (\str@start.south east) -- - ($0.5*(\str@start.south east)+0.5*(\str@start.north east)$) -- - ($0.5*(\str@start.south west)+0.5*(\str@start.north west)$) -- - cycle; - \fill[grayTopCell] - (\str@start.north west) -- - (\str@start.north east) -- - ($0.5*(\str@start.south east)+0.5*(\str@start.north east)$) -- - ($0.5*(\str@start.south west)+0.5*(\str@start.north west)$) -- - cycle; - \node[minimum width={\col@width},minimum height=\line@height,celhead] at (\str@start) {\helvbx\str@start}; + % --> On place la premiere cellule en-tête + \pastab@draw@cell{\col@width}{\str@start}{0}{}{\str@start}% % --> On place les autres en-têtes \foreach \i [remember=\i as \lasti (initially 1)] in {2,...,\nb@columns} - { - \StrChar{\str@col}{\i}[\name] - \StrChar{\str@col}{\lasti}[\lastname] - \node[minimum width={\col@width},minimum height=\line@height,celhead,right] (\name) at (\lastname.east) {\helvbx\name}; - \fill[grayBottomCell] - (\name.south west) -- - (\name.south east) -- - ($0.5*(\name.south east)+0.5*(\name.north east)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)$) -- - cycle; - \fill[grayTopCell] - (\name.north west) -- - (\name.north east) -- - ($0.5*(\name.south east)+0.5*(\name.north east)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)$) -- - cycle; - \node[minimum width={\col@width},minimum height=\line@height,celhead] at (\name) {\helvbx\name}; - } - } - { - \StrChar{#2}{1}[\str@start] - \node[minimum width={\col@width},minimum height=\line@height,celhead] (\str@start) {\helvbx\str@start}; - \fill[grayBottomCell] - (\str@start.south west) -- - (\str@start.south east) -- - ($0.5*(\str@start.south east)+0.5*(\str@start.north east)$) -- - ($0.5*(\str@start.south west)+0.5*(\str@start.north west)$) -- - cycle; - \fill[grayTopCell] - (\str@start.north west) -- - (\str@start.north east) -- - ($0.5*(\str@start.south east)+0.5*(\str@start.north east)$) -- - ($0.5*(\str@start.south west)+0.5*(\str@start.north west)$) -- - cycle; - \node[minimum width={\col@width},minimum height=\line@height,celhead] at (\str@start) {\helvbx\str@start}; - + {% + \StrChar{\str@col}{\i}[\name]% + \StrChar{\str@col}{\lasti}[\lastname]% + \pastab@draw@cell{\col@width}{\name}{1}{\lastname.east}{\name}% + }% + }% + {% + \StrChar{#2}{1}[\str@start]% + \pastab@draw@cell{\col@width}{\str@start}{0}{}{\str@start}% \foreach \name [remember=\name as \lastname] in {#2} - { - \ifx\name\str@start - \else - \node[minimum width={\col@width},minimum height=\line@height,celhead,right] (\name) at (\lastname.east) {\helvbx\name}; - \fill[grayBottomCell] - (\name.south west) -- - (\name.south east) -- - ($0.5*(\name.south east)+0.5*(\name.north east)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)$) -- - cycle; - \fill[grayTopCell] - (\name.north west) -- - (\name.north east) -- - ($0.5*(\name.south east)+0.5*(\name.north east)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)$) -- - cycle; - \node[minimum width={\col@width},minimum height=\line@height,celhead] at (\name) {\helvbx\name}; - \fi - } - } - - + {% + \ifx\name\str@start% + \else% + \pastab@draw@cell{\col@width}{\name}{1}{\lastname.east}{\name}% + \fi% + }% + }% % Placement des en-têtes de lignes - - \StrChar{#2}{1}[\first@name] - \node[below left,celhead,minimum width=\numline@width,minimum height=\line@height] (numline1) at (\first@name.south west) {\helvbx 1}; - \fill[grayBottomCell] - (numline1.south west) -- - (numline1.south east) -- - ($0.5*(numline1.south east)+0.5*(numline1.north east)$) -- - ($0.5*(numline1.south west)+0.5*(numline1.north west)$) -- - cycle; - \fill[grayTopCell] - (numline1.north west) -- - (numline1.north east) -- - ($0.5*(numline1.south east)+0.5*(numline1.north east)$) -- - ($0.5*(numline1.south west)+0.5*(numline1.north west)$) -- - cycle; - \node[below left,celhead,minimum width=\numline@width,minimum height=\line@height] (numline1) at (\first@name.south west) {\helvbx1}; - \ifnum#1>1 - \foreach \num@line [remember=\num@line as \lastnum (initially 1)] in {2,...,#1} - { - \node[below,celhead,minimum width=\numline@width,minimum height=\line@height] (numline\num@line) at (numline\lastnum.south) {\helvbx\num@line}; - \fill[grayBottomCell] - (numline\num@line.south west) -- - (numline\num@line.south east) -- - ($0.5*(numline\num@line.south east)+0.5*(numline\num@line.north east)$) -- - ($0.5*(numline\num@line.south west)+0.5*(numline\num@line.north west)$) -- - cycle; - \fill[grayTopCell] - (numline\num@line.north west) -- - (numline\num@line.north east) -- - ($0.5*(numline\num@line.south east)+0.5*(numline\num@line.north east)$) -- - ($0.5*(numline\num@line.south west)+0.5*(numline\num@line.north west)$) -- - cycle; - \node[below,celhead,minimum width=\numline@width,minimum height=\line@height] (numline\num@line) at (numline\lastnum.south) {\helvbx\num@line}; + \StrChar{#2}{1}[\first@name]% + \pastab@draw@cell{\numline@width}{numline1}{2}{\first@name.south west}{1} + \ifnum#1>1% + \foreach \num@line [remember=\num@line as \lastnum (initially 1)] in {2,...,#1} + {% + \pastab@draw@cell{\numline@width}{numline\num@line}{3}{numline\lastnum.south east}{\num@line}% + }% + \fi% + % Trace de la grille + \IfSubStr{#2}{-} + {% + \foreach \i in {1,...,\nb@columns} + {% + \StrChar{\str@col}{\i}[\name]% + \pastableur@grid{\col@width}{\name}{1}{\name.south}% + }% + \ifnum#1>1% + \foreach\numline [remember=\numline as \lastnumline (initially 1)] in {2,...,#1} + {% + \foreach \i in {1,...,\nb@columns} + {% + \StrChar{\str@col}{\i}[\name]% + \pastableur@grid{\col@width}{\name}{\numline}{cell\name-\lastnumline.south}% + }% + }% + \fi% } - \fi - - % Tracé de la grille - - \IfSubStr{#2}{-} - {% - \foreach \i in {1,...,\nb@columns} - { - \StrChar{\str@col}{\i}[\name] - \node[celempty,below,minimum height=\line@height,minimum width=\col@width] (cell\name-1) at (\name.south) {}; - \draw[graySepCell] ($(cell\name-1.south west)+(0.25pt,0)$) -- (cell\name-1.south east) -- ($(cell\name-1.north east)+(0,-0.25pt)$); - } - \ifnum#1>1 - \foreach\numline [remember=\numline as \lastnumline (initially 1)] in {2,...,#1} - { - \foreach \i in {1,...,\nb@columns} - { - \StrChar{\str@col}{\i}[\name] - \node[celempty,below,minimum height=\line@height,minimum width=\col@width] (cell\name-\numline) at (cell\name-\lastnumline.south) {}; - \draw[graySepCell] ($(cell\name-\numline.south west)+(0.25pt,0)$) -- (cell\name-\numline.south east) -- ($(cell\name-\numline.north east)+(0,-0.25pt)$); - } - } - \fi - } - {% - \foreach \name in {#2} - { - \node[celempty,below,minimum height=\line@height,minimum width=\col@width] (cell\name-1) at (\name.south) {}; - \draw[graySepCell] ($(cell\name-1.south west)+(0.25pt,0)$) -- (cell\name-1.south east) -- ($(cell\name-1.north east)+(0,-0.25pt)$); - } - \ifnum#1>1 - \foreach\numline [remember=\numline as \lastnumline (initially 1)] in {2,...,#1} - { - \foreach \name in {#2} - { - \node[celempty,below,minimum height=\line@height,minimum width=\col@width] (cell\name-\numline) at (cell\name-\lastnumline.south) {}; - \draw[graySepCell] ($(cell\name-\numline.south west)+(0.25pt,0)$) -- (cell\name-\numline.south east) -- ($(cell\name-\numline.north east)+(0,-0.25pt)$); - } - } - \fi - } -} - -% Insérer quelque chose dans une cellule - + {% + \foreach \name in {#2} + {% + \pastableur@grid{\col@width}{\name}{1}{\name.south}% + }% + \ifnum#1>1% + \foreach\numline [remember=\numline as \lastnumline (initially 1)] in {2,...,#1} + {% + \foreach \name in {#2} + {% + \pastableur@grid{\col@width}{\name}{\numline}{cell\name-\lastnumline.south}% + }% + }% + \fi% + }% + } % --> Fin de \tableur +% +% Inserer quelque chose dans une cellule : \celtxt [modif. du 2016/01/21 due \`a "Un bon petit"] +% \define@cmdkey [PAS] {celtxt} {width}{} \define@cmdkey [PAS] {celtxt} {color}{} \define@boolkey [PAS] {celtxt} {l}[true]{} \define@boolkey [PAS] {celtxt} {r}[true]{} \define@boolkey [PAS] {celtxt} {c}[true]{} \presetkeys [PAS] {celtxt} {width = \col@width, color=black}{} - -\newcommand*{\celtxt}[1][]{\cel@txt[#1]} - -\newcommand\cel@txt[3][]{% - \setkeys[PAS]{celtxt}{#1} - \begingroup - \@makeother\^% - \@makeother\$% - \@celtxt@[#1]{#2}{#3}% -} -\newcommand\@celtxt@[4][]{% - \endgroup - \setkeys[PAS]{celtxt}{#1} - \StrPosition{#4}{=}[\@equalPos] - \ifnum\@equalPos=1 - %\def\@scale{1}% - \let\@style\texttt - \else - %\def\@scale{0.9}% - \let\@style\@empty - \fi - \ifPAS@celtxt@c - \def\pos@align{c} - \else - \ifPAS@celtxt@r - \def\pos@align{r} - \else - \def\pos@align{l} - \fi - \fi - \node at (cell#2-#3) {\makebox[\dimexpr\cmdPAS@celtxt@width-2pt][\pos@align]{\@style{\textcolor{\cmdPAS@celtxt@color}{#4}}}}; -} - -% Cellule sélectionnée : \selecCell - +% +\newcommand*\celtxt@catcoderegime@begin{} +\newcommand*\celtxt@catcoderegime@end{} +% +\newcommand*\celtxt + {% + \@ifstar{% + \let\celtxt@catcoderegime@end\@empty + \let\celtxt@catcoderegime@begin\@empty + \celtxt@i + }{% + \def\celtxt@catcoderegime@begin{% + \begingroup + \@makeother\^% + \@makeother\$% + }% + \let\celtxt@catcoderegime@end\endgroup + \celtxt@i + }% + } +% +\newcommand*{\celtxt@i}[1][]{\celtxt@ii{#1}} +% +\newcommand*\celtxt@ii[3] + {% + \setkeys[PAS]{celtxt}{#1}% + \celtxt@catcoderegime@begin + \celtxt@iii{#1}{#2}{#3}% + } +% +\newcommand*\celtxt@iii[4] + {% + \celtxt@catcoderegime@end + \IfBeginWith{#4}{=}{\let\pastab@style\texttt}{\let\pastab@style\@empty} + \ifPAS@celtxt@c + \def\pos@align{c}% + \else + \ifPAS@celtxt@r + \def\pos@align{r}% + \else + \def\pos@align{l}% + \fi + \fi + \node at (cell#2-#3) {\makebox[\dimexpr\cmdPAS@celtxt@width-2pt][\pos@align]{\pastab@style{\textcolor{\cmdPAS@celtxt@color}{#4}}}};% + } +% +% Cellule selectionnee : \selecCell +% \newcommand*\selecCell[2] -{% - %==> En-tête ligne - - \fill[blueSelecCellBottom] - (numline#2.south west) -- - (numline#2.south east) -- - ($0.5*(numline#2.south east)+0.5*(numline#2.north east)$) -- - ($0.5*(numline#2.south west)+0.5*(numline#2.north west)$) -- - cycle; - \fill[blueSelecCellTop] - (numline#2.north west) -- - (numline#2.north east) -- - ($0.5*(numline#2.south east)+0.5*(numline#2.north east)$) -- - ($0.5*(numline#2.south west)+0.5*(numline#2.north west)$) -- - cycle; - \node[celhead,minimum width=\numline@width,minimum height=\line@height] at (numline#2) {\helvbx#2}; - - %==> En-tête colonne - - \fill[blueSelecCellBottom] - ($(#1.south west)+(0.25pt,0.25pt)$) -- - ($(#1.south east)+(-0.25pt,0.25pt)$) -- - ($0.5*(#1.south east)+0.5*(#1.north east)+(-0.25pt,0)$) -- - ($0.5*(#1.south west)+0.5*(#1.north west)+(0.25pt,0)$) -- - cycle; - \fill[blueSelecCellTop] - ($(#1.north west)+(0.25pt,-0.25pt)$) -- - ($(#1.north east)+(-0.25pt,-0.25pt)$) -- - ($0.5*(#1.south east)+0.5*(#1.north east)+(-0.25pt,0)$) -- - ($0.5*(#1.south west)+0.5*(#1.north west)+(0.25pt,0)$) -- - cycle; - \node at (#1) {\helvbx#1}; - - %==> Cellule cell#1-#1 - - \draw[very thick] (cell#1-#2.south west) rectangle (cell#1-#2.north east); - \fill[black] ($(cell#1-#2.south east)+(-1pt,1pt)$) rectangle +(3pt,-3pt); -} - -% Sélection de plusieurs cellules : \multiSelec{A-1}{B-2} _/!\_ Nouvelle syntaxe 2014 - + {% + %==> En-tête ligne + % + \pastableur@colorcell{numline#2}{0} + \node[celhead,minimum width=\numline@width,minimum height=\line@height] at (numline#2) {\helvbx#2};% + % + %==> En-tête colonne + % + \pastableur@colorcell{#1}{1} + \node at (#1) {\helvbx#1};% + % + %==> Cellule cell#1-#1 + % + \draw[very thick] (cell#1-#2.south west) rectangle (cell#1-#2.north east);% + \fill[black] ($(cell#1-#2.south east)+(-1pt,1pt)$) rectangle +(3pt,-3pt);% + } % fin de \selecCell +% +% Selection de plusieurs cellules : \multiSelec{A-1}{B-2} _/!\_ Nouvelle syntaxe 2014 +% \newcommand*\multiSelec[2] -{% - \fill[blueSelec,opacity=0.5] ($(cell#1.north west)+(0.25pt,-0.25pt)$) rectangle ($(cell#2.south east)+(-0.25pt,0.25pt)$); - \draw[very thick] (cell#1.south west) rectangle (cell#1.north east); - \fill[black] ($(cell#2.south east)+(-0.5pt,0.5pt)$) rectangle +(3pt,-3pt); - - %==> On colorie les en-têtes "colonnes" - - \StrChar{#1}{1}[\str@start] % par exemple, "G" - \StrChar{#2}{1}[\str@end] % par exemple, "L" - \StrBetween{\col@names}{\str@start}{\str@end}[\str@col] % retourne par exemple "HIJK" - \edef\str@col{\str@start\str@col\str@end} % retourne alors "GHIJKL" - \StrLen{\str@col}[\nb@columns] % nombre d'en-têtes "colonnes" à colorier - \foreach \i in {1,...,\nb@columns} - { - \StrChar{\str@col}{\i}[\name] - \fill[blueSelecCellBottom] - ($(\name.south west)+(0.25pt,0.25pt)$) -- - ($(\name.south east)+(-0.25pt,0.25pt)$) -- - ($0.5*(\name.south east)+0.5*(\name.north east)+(-0.25pt,0)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)+(0.25pt,0)$) -- - cycle; - \fill[blueSelecCellTop] - ($(\name.north west)+(0.25pt,-0.25pt)$) -- - ($(\name.north east)+(-0.25pt,-0.25pt)$) -- - ($0.5*(\name.south east)+0.5*(\name.north east)+(-0.25pt,0)$) -- - ($0.5*(\name.south west)+0.5*(\name.north west)+(0.25pt,0)$) -- - cycle; - \node at (\name) {\helvbx\name}; - } - - %==> On colorie les en-têtes "lignes" - - \StrGobbleLeft{#1}{2}[\first@num] - \StrGobbleLeft{#2}{2}[\second@num] - \foreach \i in {\first@num,...,\second@num} - { + {% + \fill[blueSelec,opacity=0.5] ($(cell#1.north west)+(0.25pt,-0.25pt)$) rectangle ($(cell#2.south east)+(-0.25pt,0.25pt)$);% + \draw[very thick] (cell#1.south west) rectangle (cell#1.north east);% + \fill[black] ($(cell#2.south east)+(-0.5pt,0.5pt)$) rectangle +(3pt,-3pt);% + % + %==> On colorie les en-têtes "colonnes" + % + \StrChar{#1}{1}[\str@start] % par exemple, "G" + \StrChar{#2}{1}[\str@end] % par exemple, "L" + \StrBetween{\col@names}{\str@start}{\str@end}[\str@col] % retourne par exemple "HIJK" + \edef\str@col{\str@start\str@col\str@end} % retourne alors "GHIJKL" + \StrLen{\str@col}[\nb@columns] % nombre d'en-têtes "colonnes" \`a colorier + \foreach \i in {1,...,\nb@columns} + {% + \StrChar{\str@col}{\i}[\name]% + \pastableur@colorcell{\name}{1} + \node at (\name) {\helvbx\name};% + }% + % + %==> On colorie les en-têtes "lignes" + % + \StrGobbleLeft{#1}{2}[\first@num]% + \StrGobbleLeft{#2}{2}[\second@num]% + \foreach \i in {\first@num,...,\second@num} + {% + \pastableur@colorcell{numline\i}{0} + \node[celhead,minimum width=\numline@width,minimum height=\line@height] at (numline\i) {\helvbx\i};% + }% + }% fin de \multiSelec +% +% +% +\newlength\pastableur@decal +\newcommand{\pastableur@colorcell}[2] % #1 : name, #2 : 0=en-tetes "lignes" / 1=en-tetes "colonnes" + {% + \ifnum#2=0% + \setlength\pastableur@decal{0pt}% + \else% + \setlength\pastableur@decal{0.25pt}% + \fi% \fill[blueSelecCellBottom] - (numline\i.south west) -- - (numline\i.south east) -- - ($0.5*(numline\i.south east)+0.5*(numline\i.north east)$) -- - ($0.5*(numline\i.south west)+0.5*(numline\i.north west)$) -- - cycle; + ($(#1.south west)+(\pastableur@decal,-\pastableur@decal)$) -- + ($(#1.south east)+(-\pastableur@decal,\pastableur@decal)$) -- + ($0.5*(#1.south east)+0.5*(#1.north east)+(-\pastableur@decal,0)$) -- + ($0.5*(#1.south west)+0.5*(#1.north west)+(\pastableur@decal,0)$) -- + cycle;% \fill[blueSelecCellTop] - (numline\i.north west) -- - (numline\i.north east) -- - ($0.5*(numline\i.south east)+0.5*(numline\i.north east)$) -- - ($0.5*(numline\i.south west)+0.5*(numline\i.north west)$) -- - cycle; - \node[celhead,minimum width=\numline@width,minimum height=\line@height] at (numline\i) {\helvbx\i}; - } -} + ($(#1.north west)+(\pastableur@decal,-\pastableur@decal)$) -- + ($(#1.north east)+(-\pastableur@decal,-\pastableur@decal)$) -- + ($0.5*(#1.south east)+0.5*(#1.north east)+(-\pastableur@decal,0)$) -- + ($0.5*(#1.south west)+0.5*(#1.north west)+(\pastableur@decal,0)$) -- + cycle;% + }% \endinput -- cgit v1.2.3