From 0c889bec86ba92853b3923e39de0b6bb17d18486 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 26 Jan 2023 03:00:49 +0000 Subject: CTAN sync 202301260300 --- graphics/pgf/contrib/tangramtikz/README.md | 7 + .../contrib/tangramtikz/doc/TangramTikz-doc-en.pdf | Bin 0 -> 430175 bytes .../contrib/tangramtikz/doc/TangramTikz-doc-en.tex | 563 ++++++++++++++++++++ .../contrib/tangramtikz/doc/TangramTikz-doc-fr.pdf | Bin 0 -> 428860 bytes .../contrib/tangramtikz/doc/TangramTikz-doc-fr.tex | 565 +++++++++++++++++++++ .../pgf/contrib/tangramtikz/tex/TangramTikz.sty | 513 +++++++++++++++++++ 6 files changed, 1648 insertions(+) create mode 100644 graphics/pgf/contrib/tangramtikz/README.md create mode 100644 graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.pdf create mode 100644 graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.tex create mode 100644 graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.pdf create mode 100644 graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.tex create mode 100644 graphics/pgf/contrib/tangramtikz/tex/TangramTikz.sty (limited to 'graphics/pgf') diff --git a/graphics/pgf/contrib/tangramtikz/README.md b/graphics/pgf/contrib/tangramtikz/README.md new file mode 100644 index 0000000000..155e0ffcaf --- /dev/null +++ b/graphics/pgf/contrib/tangramtikz/README.md @@ -0,0 +1,7 @@ +TangramTikz is a package to work with Tangram Puzzle. +-------------------------------------------------------------------- +TangramTikz est un package travailler avec le jeu de Puzzle Tangram. +-------------------------------------------------------------------- +Author : Cédric Pierquet +email : cpierquet@outlook.fr +Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt \ No newline at end of file diff --git a/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.pdf b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.pdf new file mode 100644 index 0000000000..7a65de7e9d Binary files /dev/null and b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.pdf differ diff --git a/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.tex b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.tex new file mode 100644 index 0000000000..91e5e63e25 --- /dev/null +++ b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-en.tex @@ -0,0 +1,563 @@ +% !TeX TXS-program:compile = txs:///arara +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') + +\documentclass{article} +\usepackage[english]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{TangramTikz} +%\usepackage[upright]{fourier} +%\usepackage[scaled=0.875]{helvet} +%\renewcommand\ttdefault{lmtt} +%\usepackage{cabin} +\usepackage{amsmath,amssymb} +\usepackage{fontawesome5} +\usepackage{enumitem} +\usepackage{tabularray} +\usepackage{multicol} +\usepackage{fancyvrb} +\usepackage{fancyhdr} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +\lfoot{\sffamily\small [TangramTikz]} +\cfoot{\sffamily\small - \thepage{} -} +\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} + +%\usepackage{hvlogos} +\usepackage{hologo} +\usepackage{xspace} +\providecommand\tikzlogo{Ti\textit{k}Z} +\providecommand\TeXLive{\TeX{}Live\xspace} +\providecommand\PSTricks{\textsf{PSTricks}\xspace} +\let\pstricks\PSTricks +\let\TikZ\tikzlogo +\newcommand\TableauDocumentation{% + \begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} + {\huge \LaTeX} & & & & &\\ + & {\huge \hologo{pdfLaTeX}} & & & & \\ + & & {\huge \hologo{LuaLaTeX}} & & & \\ + & & & {\huge \TikZ} & & \\ + & & & & {\huge \TeXLive} & \\ + & & & & & {\huge \hologo{MiKTeX}} \\ + \end{tblr} +} + +\usepackage{hyperref} +\urlstyle{same} +\hypersetup{pdfborder=0 0 0} +\usepackage[margin=1.5cm]{geometry} +\setlength{\parindent}{0pt} +\definecolor{LightGray}{gray}{0.9} + +\def\TPversion{0.1.0} +\def\TPdate{23/01/2023} + +\usepackage[most]{tcolorbox} +\tcbuselibrary{minted} +\NewTCBListing{PresentationCode}{ O{blue} m }{% + sharp corners=downhill,enhanced,arc=12pt,skin=bicolor,% + colback=#1!1!white,colframe=#1!75!black,colbacklower=white,% + attach boxed title to top right={yshift=-\tcboxedtitleheight},title=Code \LaTeX,% + boxed title style={% + colframe=#1!75!black,colback=#1!15!white,% + ,sharp corners=downhill,arc=12pt,% + },% + fonttitle=\color{#1!90!black}\itshape\ttfamily\footnotesize,% + listing engine=minted,minted style=colorful, + minted language=tex,minted options={tabsize=4,fontsize=\footnotesize,autogobble}, + #2 +} + +\newcommand\Cle[1]{{\bfseries\sffamily\textlangle #1\textrangle}} + +\begin{document} + +\pagestyle{fancy} + +\thispagestyle{empty} + +\vspace{2cm} + +\begin{center} + \begin{minipage}{0.75\linewidth} + \begin{tcolorbox}[colframe=yellow,colback=yellow!15] + \begin{center} + \begin{tabular}{c} + {\Huge \texttt{TangramTikz [en]}}\\ + \\ + {\LARGE Tangrams, with Ti\textit{k}Z}, \\ + \\ + {\LARGE with solution and/or color.} \\ + \end{tabular} + + \medskip + + {\small \texttt{Version \TPversion{} -- \TPdate}} + \end{center} + \end{tcolorbox} +\end{minipage} +\end{center} + +\vspace{0.5cm} + +\begin{center} + \begin{tabular}{c} + \texttt{Cédric Pierquet}\\ + {\ttfamily c pierquet -- at -- outlook . fr}\\ + \texttt{\url{https://github.com/cpierquet/TangramTikz}} +\end{tabular} +\end{center} + +\vspace{0.5cm} + +{$\blacktriangleright$~~Some commands to display existing Tangrams.} + +\smallskip + +{$\blacktriangleright$~~Create tangram, with postionning manually the pieces.} + +\smallskip + +{$\blacktriangleright$~~Idea(s) from \url{https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex}} + +\vspace{1cm} + +\begin{center} + \tikz {\pic[TangPuzz={blue}] at (0,0) {TangBigTri} ;}~~ + \tikz {\pic[TangPuzz={orange}] at (0,0) {TangBigTri} ;}~~ + \tikz {\pic[TangPuzz={purple}] at (0,0) {TangMedTri} ;}~~ + \tikz {\pic[TangPuzz={yellow}] at (0,0) {TangSqua} ;}~~ + \tikz {\pic[TangPuzz={green}] at (0,0) {TangSmalTri} ;}~~ + \tikz {\pic[TangPuzz={cyan}] at (0,0) {TangSmalTri} ;}~~ + \tikz {\pic[TangPuzz={magenta}] at (0,0) {TangPara} ;}~~ + + \vspace*{1cm} + + \TangramTikz[Couleur=orange]{Maison} + \TangramTikz[Correction]{Maison} + \TangramTikz[CorrectionCouleur]{Maison} + \TangramTikz[ListeCouleurs={blue,red,black,orange,purple},CorrectionCouleur]{Maison} +\end{center} + +\vspace{0.5cm} + +%\hfill{}\textit{Merci aux membres du groupe \faFacebook{} du \og Coin \LaTeX{} \fg{} pour leur aide et leurs idées !} + +%\hfill{}\textit{Merci à Denis Bitouzé et à Patrick Bideault pour leurs retours et idées !} + +\vfill + +\hrule + +\medskip + +\TableauDocumentation + +\medskip + +\hrule + +\medskip + +\newpage + +\phantomsection +\hypertarget{matoc}{} + +\tableofcontents + +\newpage + +\part{Introduction} + +\section{The package TangramTikz} + +\subsection{Source} + +Some of the ideas are coming from \url{https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex}, specially from Andrew Stacey. + +\smallskip + +The package has been \textit{built} around the ideas from Andrew Stacey. + +\subsection{Loading of the package, used packages} + +The package \textsf{TangramTikz} loads into the preamble by : + +\begin{PresentationCode}{listing only} +\usepackage{TangramTikz} +\end{PresentationCode} + +It's fully copatible with usuals compilations, such as \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} or \textsf{xelatex}. + +\medskip + +It loads the packages and libraries : + +\begin{itemize} + \item \texttt{tikz} awith libraries \Cle{calc} ans \Cle{shapes.geometric} ; + \item \texttt{xstring}, \texttt{xparse}, \texttt{simplekv} and \texttt{listofitems}. +\end{itemize} + +\subsection{The package itself} + +The idea is to, thanks to \TikZ, propose \textsf{commands} to display a Tangram Puzzle : + +\begin{itemize} + \item with \textit{full} pieces ; + \item by puzzle with \textit{border} pieces ; + \item by puzzle with \textit{border colored} pieces. +\end{itemize} + +\begin{PresentationCode}{listing only} +%independant command to display a Tangram +\TangramTikz[keys]{tangram_name} +\end{PresentationCode} + +There's also an \textsf{environment} and a special \textsf{command} to build the puzzle, by positionning the pieces. + +\begin{PresentationCode}{listing only} +%environment, with keys, and positionning the pieces +\begin{EnvTangramTikz}[keys] + %positionning the pieces + \PieceTangram[keys](offsetH,offsetV){TangBigTri} + \PieceTangram[keys](offsetH,offsetH){TangBigTri} + \PieceTangram[keys](offsetH,offsetH){TangMedTri} + \PieceTangram[keys](offsetH,offsetH){TangSmalTri} + \PieceTangram[keys](offsetH,offsetH){TangSmalTri} + \PieceTangram[keys](offsetH,offsetH){TangSqua} + \PieceTangram[keys](offsetH,offsetH){TangPara} + %\filldraw[black] (0,0) circle[radius=4pt] ; %help for positionning +\end{EnvTangramTikz} +\end{PresentationCode} + +\pagebreak + +\part{Usage of the package} + +\section{Manually} + +\subsection{The pieces of the Tangram} + +A Tangram is composed by 7 pieces : +\begin{itemize} + \item 2 big triangles ; 1 medium triangle ; 2 small triangles ; + \item 1 square ; + \item 1 parallelogram. +\end{itemize} + +Each piece of the Tangram is defined in \tikzlogo, by an independent \texttt{pic}.. + +\medskip + +A figure to show the 5 pieces : + +\begin{itemize} + \item with the \textcolor{purple}{\texttt{name}} of the \texttt{pic} ; + \item with the initial \textit{orientation} ; + \item with thier initial \textcolor{red}{\textit{origin}} ; + \item with their common \textcolor{blue}{\textit{dimensions}} (given in \textit{unit}). +\end{itemize} + +\begin{center} + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangBigTri} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(2,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {2} ; + \draw[thick,<->,>=latex] (2.25,0)--++(0,2) node[blue,scale=1.5,midway,right,font=\large\sffamily] {2} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(8)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{2\sqrt{2}}$} ; + \draw (1,3) node[scale=1.5,purple,below=1pt,font=\Large\ttfamily] {TangBigTri} ; + \end{tikzpicture} + ~ + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangMedTri} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(2,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {2} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw[thick,<->,>=latex] (2.15,0.15)--++(135:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangMedTri} ; + \end{tikzpicture} + ~ + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangSmalTri} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(1,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw[thick,<->,>=latex] (1.25,0)--++(0,1) node[blue,scale=1.5,midway,right,font=\large\sffamily] {1} ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangSmalTri} ; + \end{tikzpicture} + + \smallskip + + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangSqua} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(1,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (1.25,0)--++(0,1) node[blue,scale=1.5,midway,right,font=\large\sffamily] {1} ; + \draw[thick,dashed] (0,0)--(-0.65,0.65) (1,1)--(0.35,1.65) ; + \draw[thick,<->,>=latex] (-0.65,0.65)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangSqua} ; + \end{tikzpicture} + ~ + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangPara} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(1,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw[thick,<->,>=latex] (2.15,0)--++(0,1) node[blue,scale=1.5,midway,right,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (2.15,1.15)--++(135:{0.5*sqrt(2)}) node[blue,midway,sloped,above,font=\large\sffamily] {$\mathsf{0{,}5\sqrt{2}}$} ; + \draw[thick,dashed] (2,1)--++(0.15,0.15) (1,1)--++(45:{0.5*sqrt(2)+0.2}) ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangPara} ; + \end{tikzpicture} +\end{center} + +Each \textit{piece} can : + +\begin{itemize} + \item rotated, thanks to \tikzlogo' option \texttt{rotate=...} ; + \item fliped vertically or horizontally, thanks to \tikzlogo' option \texttt{xscale=-1} and \texttt{yscale=-1} ; + \item moved, by placing it at point \texttt{(x,y)}. +\end{itemize} + +Each piece comes with a \tikzlogo' style : + +\begin{itemize} + \item \texttt{TangPuzz} : piece of Tangram, \textit{full}, with a color (\Cle{black} by default) ; + \item \texttt{TangSol} : piece of tangram, \textit{with white border}, with a color (\Cle{black} by default). +\end{itemize} + +\pagebreak + +\subsection{Positionning of the pieces} + +A first methodis to use \texttt{pic} syntax in \tikzlogo{} : + +\begin{PresentationCode}{listing only} +%environment or tikz command +\pic[style,rotate=...,xscale=...,yscale=...] at (x,y) {piece_name} ; +\end{PresentationCode} + +The package \textsf{TangramTikz} proposes a specific command to place the pieces : + +\begin{PresentationCode}{listing only} +%environment or tikz command +\PieceTangram[style={color}](x,y){piece_name} +\end{PresentationCode} + +A Tangram is built form the 7 pieces, by : + +\begin{itemize} + \item \textit{putting} pieces at origin ; + \item \textit{rotating/fliping} for the correct orientation ; + \item \textit{translating} for the correct position. +\end{itemize} + +\begin{PresentationCode}{} +%Correction colored version, initial size +\begin{EnvTangramTikz} + \PieceTangram[TangSol={green}]({0},{0}){TangSqua} + \PieceTangram[TangSol={red}]({-1.5},{1}){TangBigTri} + \PieceTangram[TangSol={red}]({0.5},{3}){TangBigTri} + \PieceTangram[TangSol={purple}]({2.5},{2}){TangPara} + \PieceTangram[TangSol={blue}]({-1.5},{2}){TangSmalTri} + \PieceTangram[TangSol={blue}]({-0.5},{2}){TangSmalTri} + \PieceTangram[TangSol={orange}]({-0.5},{3}){TangMedTri} + \filldraw[black] (0,0) circle[radius=2pt] ; %help +\end{EnvTangramTikz} +%Normal version, initial size +\begin{EnvTangramTikz} + \PieceTangram[TangPuzz]({0},{0}){TangSqua} + \PieceTangram[TangPuzz]({-1.5},{1}){TangBigTri} + \PieceTangram[TangPuzz]({0.5},{3}){TangBigTri} + \PieceTangram[TangPuzz]({2.5},{2}){TangPara} + \PieceTangram[TangPuzz]({-1.5},{2}){TangSmalTri} + \PieceTangram[TangPuzz]({-0.5},{2}){TangSmalTri} + \PieceTangram[TangPuzz]({-0.5},{3}){TangMedTri} +\end{EnvTangramTikz} +\end{PresentationCode} + +\pagebreak + +\section{Automatic Method} + +\subsection{Command} + +Some predefined tangrams are present in the package \textsf{TangramTikz}, and thre's an independent \textsf{command} to "call" them : + +\begin{PresentationCode}{listing only} +%independent command to display a Tangram +\TangramTikz[keys]{tangram_name} +\end{PresentationCode} + +\begin{PresentationCode}{} +%independent command to display Cat/Boat/Kangaroo, with options by default +\TangramTikz{Cat}~~\TangramTikz{Boat}~~\TangramTikz{Kangaroo} +\end{PresentationCode} + +\subsection{Keys, options and arguments} + +The first argument, \textit{optional} and between \texttt{[...]}, give the keys : + +\begin{itemize} + \item the boolean \Cle{Puzzle} to display \textit{uni-}color pieces, without border ; \hfill~default : \Cle{true} + \item the boolean \Cle{Correction} to display \textit{uni-}color pieces, with border ; \hfill~default : \Cle{false} + \item \Cle{Color} to configure the \textit{uni-}color with the above bololeans ; \hfill~default : \Cle{black} + \item the boolean \Cle{ColorCorrection} to display colored pieces with border ; \hfill~default : \Cle{false} + \item \Cle{ColorList} which are the colors of the pieces (\texttt{BT,MT,ST,SQUA,PARA}) ; + + \hfill~default : \Cle{red,orange,blue,green,purple} + \item \Cle{Sep}, the width of the border in \Cle{Correction} mode. \hfill~default : \Cle{1pt} +\end{itemize} + +The second argument, \textit{optional} ans between \texttt{<...>}, give options to the \tikzlogo{} environnement, for example : + +\begin{itemize} + \item unit(s) change, scale change ; + \item rotation, vertical alignment ; + \item etc +\end{itemize} + +The third argument, \textit{mandatory} and between \texttt{\{...\}} is the name of the predefined tangram : +% +\texttt{\begin{multicols}{5} + \begin{itemize} + \item Square + \item Pinguin + \item Boat + \item Home + \item FirTree + \item Cat + \item Swan + \item Pyramid + \item Duck + \item Rocket + \item Candle + \item Shirt + \item Fish + \item Sailboat + \item Kangaroo + \item Dog + \end{itemize} +\end{multicols}} + +\pagebreak + +\begin{PresentationCode}{} +\TangramTikz{Rocket}~~ +\TangramTikz[Color=red]{Rocket}~~ +\TangramTikz[Correction]{Rocket}~~ +\TangramTikz[Correction,Color=lightgray]{Rocket}~~ +\TangramTikz[ColorCorrection,ColorList={orange,blue,yellow,green,pink},Sep=1mm]{Rocket} + +\TangramTikz{Rocket}~~ +\TangramTikz{Rocket} +\end{PresentationCode} + +\pagebreak + +\part{Gallery of Tangrams} + +\begin{PresentationCode}{} +\TangramTikz{Square} +\TangramTikz[Correction]{Square} +\TangramTikz[ColorCorrection]{Square} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Pinguin} + \TangramTikz[Correction]{Pinguin} + \TangramTikz[ColorCorrection]{Pinguin} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Boat} + \TangramTikz[Correction]{Boat} + \TangramTikz[ColorCorrection]{Boat} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Home} + \TangramTikz[Correction]{Home} + \TangramTikz[ColorCorrection]{Home} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{FirTree} + \TangramTikz[Correction]{FirTree} + \TangramTikz[ColorCorrection]{FirTree} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Cat} + \TangramTikz[Correction]{Cat} + \TangramTikz[ColorCorrection]{Cat} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Swan} + \TangramTikz[Correction]{Swan} + \TangramTikz[ColorCorrection]{Swan} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Pyramid} + \TangramTikz[Correction]{Pyramid} + \TangramTikz[ColorCorrection]{Pyramid} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Duck} + \TangramTikz[Correction]{Duck} + \TangramTikz[ColorCorrection]{Duck} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Rocket} + \TangramTikz[Correction]{Rocket} + \TangramTikz[ColorCorrection]{Rocket} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Candle} + \TangramTikz[Correction]{Candle} + \TangramTikz[ColorCorrection]{Candle} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Shirt} + \TangramTikz[Correction]{Shirt} + \TangramTikz[ColorCorrection]{Shirt} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Fish} + \TangramTikz[Correction]{Fish} + \TangramTikz[ColorCorrection]{Fish} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Sailboat} + \TangramTikz[Correction]{Sailboat} + \TangramTikz[ColorCorrection]{Sailboat} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Kangaroo} + \TangramTikz[Correction]{Kangaroo} + \TangramTikz[ColorCorrection]{Kangaroo} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Dog} + \TangramTikz[Correction]{Dog} + \TangramTikz[ColorCorrection]{Dog} +\end{PresentationCode} + +\newpage + +\part{History} + +\verb|v0.1.0|~:~~~~Initial version + +\end{document} \ No newline at end of file diff --git a/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.pdf b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.pdf new file mode 100644 index 0000000000..4025111adf Binary files /dev/null and b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.pdf differ diff --git a/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.tex b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.tex new file mode 100644 index 0000000000..19fc03ab70 --- /dev/null +++ b/graphics/pgf/contrib/tangramtikz/doc/TangramTikz-doc-fr.tex @@ -0,0 +1,565 @@ +% !TeX TXS-program:compile = txs:///arara +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} +% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') + +\documentclass{article} +\usepackage[french]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{TangramTikz} +%\usepackage[upright]{fourier} +%\usepackage[scaled=0.875]{helvet} +%\renewcommand\ttdefault{lmtt} +%\usepackage{cabin} +\usepackage{amsmath,amssymb} +\usepackage{fontawesome5} +\usepackage{enumitem} +\usepackage{tabularray} +\usepackage{multicol} +\usepackage{fancyvrb} +\usepackage{fancyhdr} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +\lfoot{\sffamily\small [TangramTikz]} +\cfoot{\sffamily\small - \thepage{} -} +\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} + +%\usepackage{hvlogos} +\usepackage{hologo} +\providecommand\tikzlogo{Ti\textit{k}Z} +\providecommand\TeXLive{\TeX{}Live\xspace} +\providecommand\PSTricks{\textsf{PSTricks}\xspace} +\let\pstricks\PSTricks +\let\TikZ\tikzlogo +\newcommand\TableauDocumentation{% + \begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} + {\huge \LaTeX} & & & & &\\ + & {\huge \hologo{pdfLaTeX}} & & & & \\ + & & {\huge \hologo{LuaLaTeX}} & & & \\ + & & & {\huge \TikZ} & & \\ + & & & & {\huge \TeXLive} & \\ + & & & & & {\huge \hologo{MiKTeX}} \\ + \end{tblr} +} + +\usepackage{hyperref} +\urlstyle{same} +\hypersetup{pdfborder=0 0 0} +\usepackage[margin=1.5cm]{geometry} +\setlength{\parindent}{0pt} +\definecolor{LightGray}{gray}{0.9} + +\def\TPversion{0.1.0} +\def\TPdate{23 Janvier 2023} + +\usepackage[most]{tcolorbox} +\tcbuselibrary{minted} +\NewTCBListing{PresentationCode}{ O{blue} m }{% + sharp corners=downhill,enhanced,arc=12pt,skin=bicolor,% + colback=#1!1!white,colframe=#1!75!black,colbacklower=white,% + attach boxed title to top right={yshift=-\tcboxedtitleheight},title=Code \LaTeX,% + boxed title style={% + colframe=#1!75!black,colback=#1!15!white,% + ,sharp corners=downhill,arc=12pt,% + },% + fonttitle=\color{#1!90!black}\itshape\ttfamily\footnotesize,% + listing engine=minted,minted style=colorful, + minted language=tex,minted options={tabsize=4,fontsize=\footnotesize,autogobble}, + #2 +} + +\newcommand\Cle[1]{{\bfseries\sffamily\textlangle #1\textrangle}} + +\begin{document} + +\pagestyle{fancy} + +\thispagestyle{empty} + +\vspace{2cm} + +\begin{center} + \begin{minipage}{0.75\linewidth} + \begin{tcolorbox}[colframe=yellow,colback=yellow!15] + \begin{center} + \begin{tabular}{c} + {\Huge \texttt{TangramTikz [fr]}}\\ + \\ + {\LARGE Des tangrams, en Ti\textit{k}Z}, \\ + \\ + {\LARGE avec solution et/ou couleur.} \\ + \end{tabular} + + \medskip + + {\small \texttt{Version \TPversion{} -- \TPdate}} + \end{center} + \end{tcolorbox} +\end{minipage} +\end{center} + +\vspace{0.5cm} + +\begin{center} + \begin{tabular}{c} + \texttt{Cédric Pierquet}\\ + {\ttfamily c pierquet -- at -- outlook . fr}\\ + \texttt{\url{https://github.com/cpierquet/TangramTikz}} +\end{tabular} +\end{center} + +\vspace{0.5cm} + +{$\blacktriangleright$~~Des commandes pour afficher des Tangrams prédéfinis.} + +\smallskip + +{$\blacktriangleright$~~Possibilité de créer un Tangram, avec le placement des pièces.} + +\smallskip + +{$\blacktriangleright$~~Idée(s) venant de \url{https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex}} + +\vspace{1cm} + +\begin{center} + \tikz {\pic[TangPuzz={blue}] at (0,0) {TangBigTri} ;}~~ + \tikz {\pic[TangPuzz={orange}] at (0,0) {TangBigTri} ;}~~ + \tikz {\pic[TangPuzz={purple}] at (0,0) {TangMedTri} ;}~~ + \tikz {\pic[TangPuzz={yellow}] at (0,0) {TangSqua} ;}~~ + \tikz {\pic[TangPuzz={green}] at (0,0) {TangSmalTri} ;}~~ + \tikz {\pic[TangPuzz={cyan}] at (0,0) {TangSmalTri} ;}~~ + \tikz {\pic[TangPuzz={magenta}] at (0,0) {TangPara} ;}~~ + + \vspace*{1cm} + + \TangramTikz[Couleur=orange]{Maison} + \TangramTikz[Correction]{Maison} + \TangramTikz[CorrectionCouleur]{Maison} + \TangramTikz[ListeCouleurs={blue,red,black,orange,purple},CorrectionCouleur]{Maison} +\end{center} + +\vspace{0.5cm} + +%\hfill{}\textit{Merci aux membres du groupe \faFacebook{} du \og Coin \LaTeX{} \fg{} pour leur aide et leurs idées !} + +%\hfill{}\textit{Merci à Denis Bitouzé et à Patrick Bideault pour leurs retours et idées !} + +\vfill + +\hrule + +\medskip + +\TableauDocumentation + +\medskip + +\hrule + +\medskip + +\newpage + +\phantomsection +\hypertarget{matoc}{} + +\tableofcontents + +\newpage + +\part{Introduction} + +\section{Le package TangramTikz} + +\subsection{Source} + +Certaines idées viennent de \url{https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex}, avec une proposition de Andrew Stacey. + +\smallskip + +Le package a ensuite été \textit{construit} et \textit{modestement enrichi} autour de styles et méthodes proposées par Andrew Stacey. + +\subsection{Chargement du package, packages utilisés} + +Le package \textsf{TangramTikz} se charge dans le préambule via la commande : + +\begin{PresentationCode}{listing only} +\usepackage{TangramTikz} +\end{PresentationCode} + +Il est compatible avec les compilations usuelles en \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} ou \textsf{xelatex}. + +\medskip + +Il charge les packages et librairies suivantes : + +\begin{itemize} + \item \texttt{tikz} avec les librairies \Cle{calc} et \Cle{shapes.geometric} ; + \item \texttt{xstring}, \texttt{xparse}, \texttt{simplekv} et \texttt{listofitems}. +\end{itemize} + +\subsection{\og Philosophie \fg{} du package} + +L'idée est de proposer, grâce à \TikZ, des \textsf{commandes} pour présenter un jeu de Tangram : + +\begin{itemize} + \item sous forme du puzzle avec pièces \textit{pleines} ; + \item sous forme du puzzle avec pièces \textit{avec une petite bordure} ; + \item sous forme du puzzle coloré avec pièces \textit{avec une petite bordure}. +\end{itemize} + +\begin{PresentationCode}{listing only} +%commande autonome pour afficher un Tangram +\TangramTikz[clés]{nom_du_tangram} +\end{PresentationCode} + +Il est également proposé un \textsf{environnement} ainsi qu'une \textsf{commande} pour construire soi-même le puzzle, en plaçant \textit{manuellement} les pièces. + +\begin{PresentationCode}{listing only} +%environnement, avec clés en français, et placement des pièces +\begin{EnvTangramTikz}[clés] + %placement des pièces + \PieceTangram[clés](decalH,decalV){TangGrandTri} + \PieceTangram[clés](decalH,decalV){TangGrandTri} + \PieceTangram[clés](decalH,decalV){TangMoyTri} + \PieceTangram[clés](decalH,decalV){TangPetTri} + \PieceTangram[clés](decalH,decalV){TangPetTri} + \PieceTangram[clés](decalH,decalV){TangCar} + \PieceTangram[clés](decalH,decalV){TangPara} + %\filldraw[black] (0,0) circle[radius=4pt] ; %repère pour les pièces +\end{EnvTangramTikz} +\end{PresentationCode} + +\pagebreak + +\part{Le fonctionnement} + +\section{Fonctionnement \og manuel \fg} + +\subsection{Les pièces du Tangram} + +Un Tangram est composé de 7 pièces (visibles sur la page de garde): + +\begin{itemize} + \item 2 grands triangles isocèles rectangles ; + \item 1 triangle isocèle rectangle ; + \item 2 petits triangles isocèles rectangles ; + \item 1 carré ; + \item 1 parallélogramme. +\end{itemize} + +Chacune des pièces qui compose le Tangram est définie en langage \tikzlogo, sous forme d'un \texttt{pic} autonome. + +\medskip + +Le schéma suivant propose de visualiser les (5) pièces différentes : + +\begin{itemize} + \item avec leur \textcolor{purple}{\texttt{nom}} en code \tikzlogo{} ; + \item avec leur \textit{orientation} initiale ; + \item leur \textcolor{red}{\textit{origine}} initiale ; + \item leurs \textcolor{blue}{\textit{dimensions}} utiles (qui sont données en \textit{unité}). +\end{itemize} + +\begin{center} + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangGrandTri} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(2,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {2} ; + \draw[thick,<->,>=latex] (2.25,0)--++(0,2) node[blue,scale=1.5,midway,right,font=\large\sffamily] {2} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(8)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{2\sqrt{2}}$} ; + \draw (1,3) node[scale=1.5,purple,below=1pt,font=\Large\ttfamily] {TangGrandTri} ; + \end{tikzpicture} + ~ + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangMoyTri} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(2,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {2} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw[thick,<->,>=latex] (2.15,0.15)--++(135:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangMoyTri} ; + \end{tikzpicture} + ~ + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangPetTri} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(1,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw[thick,<->,>=latex] (1.25,0)--++(0,1) node[blue,scale=1.5,midway,right,font=\large\sffamily] {1} ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangPetTri} ; + \end{tikzpicture} + + \smallskip + + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangCar} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(1,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (1.25,0)--++(0,1) node[blue,scale=1.5,midway,right,font=\large\sffamily] {1} ; + \draw[thick,dashed] (0,0)--(-0.65,0.65) (1,1)--(0.35,1.65) ; + \draw[thick,<->,>=latex] (-0.65,0.65)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangCar} ; + \end{tikzpicture} + ~ + \begin{tikzpicture}[scale=1.25] + \draw[thin,lightgray!50] (-1,-1) grid (3,3) ; + \PieceTangram{TangPara} \filldraw[red] (0,0) circle[radius=2pt] ; + \draw[thick,<->,>=latex] (0,-0.25)--(1,-0.25) node[blue,scale=1.5,midway,below,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (-0.15,0.15)--++(45:{sqrt(2)}) node[blue,scale=1.5,midway,sloped,above,font=\large\sffamily] {$\mathsf{\sqrt{2}}$} ; + \draw[thick,<->,>=latex] (2.15,0)--++(0,1) node[blue,scale=1.5,midway,right,font=\large\sffamily] {1} ; + \draw[thick,<->,>=latex] (2.15,1.15)--++(135:{0.5*sqrt(2)}) node[blue,midway,sloped,above,font=\large\sffamily] {$\mathsf{0{,}5\sqrt{2}}$} ; + \draw[thick,dashed] (2,1)--++(0.15,0.15) (1,1)--++(45:{0.5*sqrt(2)+0.2}) ; + \draw (1,3) node[purple,scale=1.5,below=1pt,font=\Large\ttfamily] {TangPara} ; + \end{tikzpicture} +\end{center} + +Chacune des \textit{pièces} peut donc être : + +\begin{itemize} + \item pivotée, grâce à l'option \tikzlogo{} \texttt{rotate=...} ; + \item retournée horizontalement ou verticalement, grâce aux options \tikzlogo{} \texttt{xscale=-1} et \texttt{yscale=-1} ; + \item déplacée, en la plaçant au point de coordonnées \texttt{(x,y)}. +\end{itemize} + +Chaque pièce peut posséder un style prédéfini : + +\begin{itemize} + \item \texttt{TangPuzz} : pièce de puzzle, \textit{pleine}, pour laquelle on peut choisir une couleur (\Cle{black} par défaut) ; + \item \texttt{TangSol} : pièce de puzzle, \textit{avec bordure blanche}, pour laquelle on peut choisir une couleur (\Cle{black} par défaut). +\end{itemize} + +\pagebreak + +\subsection{Placement des pièces} + +Une première manière de placer les \textit{pièces} est donc d'utiliser une syntaxe des \texttt{pic} en \tikzlogo{} : + +\begin{PresentationCode}{listing only} +%environnement ou commande tikz +\pic[style,rotate=...,xscale=...,yscale=...] at (x,y) {nom_piece} ; +\end{PresentationCode} + +Le package \textsf{TangramTikz} propose également une commande spécifique pour placer les pièces : + +\begin{PresentationCode}{listing only} +%environnement ou commande tikz +\PieceTangram[style={couleur}](x,y){nom_piece} +\end{PresentationCode} + +Un Tangram peut donc être \textit{constuit} manuellement, grâce aux 7 pièces du puzzle, en : + +\begin{itemize} + \item \textit{plaçant} les pièces à l'origine ; + \item en les \textit{pivotant}/\textit{retournant} pour l'orienter correctement ; + \item en les \textit{translatant} pour les placer correctement. +\end{itemize} + +\begin{PresentationCode}{} +%version corrigée et coloriée (taille par défaut) +\begin{EnvTangramTikz} + \PieceTangram[TangSol={green}]({0},{0}){TangCar} + \PieceTangram[TangSol={red}]({-1.5},{1}){TangGrandTri} + \PieceTangram[TangSol={red}]({0.5},{3}){TangGrandTri} + \PieceTangram[TangSol={purple}]({2.5},{2}){TangPara} + \PieceTangram[TangSol={blue}]({-1.5},{2}){TangPetTri} + \PieceTangram[TangSol={blue}]({-0.5},{2}){TangPetTri} + \PieceTangram[TangSol={orange}]({-0.5},{3}){TangMoyTri} + \filldraw[black] (0,0) circle[radius=2pt] ; %repère pour les pièces +\end{EnvTangramTikz} +%version "énoncé" (taille par défaut) +\begin{EnvTangramTikz} + \PieceTangram[TangPuzz]({0},{0}){TangCar} + \PieceTangram[TangPuzz]({-1.5},{1}){TangGrandTri} + \PieceTangram[TangPuzz]({0.5},{3}){TangGrandTri} + \PieceTangram[TangPuzz]({2.5},{2}){TangPara} + \PieceTangram[TangPuzz]({-1.5},{2}){TangPetTri} + \PieceTangram[TangPuzz]({-0.5},{2}){TangPetTri} + \PieceTangram[TangPuzz]({-0.5},{3}){TangMoyTri} +\end{EnvTangramTikz} +\end{PresentationCode} + +\pagebreak + +\section{Fonctionnement \og automatique \fg} + +\subsection{Commande} + +Un certain nombre de Tangrams sont prédéfinis dans le package \textsf{TangramTikz}, qui peuvent être \textit{appelés} grâce à une commande autonome. + +\begin{PresentationCode}{listing only} +%commande autonome pour afficher un Tangram +\TangramTikz[clés]{nom_du_tangram} +\end{PresentationCode} + +\begin{PresentationCode}{} +%commande autonome pour afficher le Tangram du Chat/Bateau/Kangourou, avec options par défaut +\TangramTikz{Chat}~~\TangramTikz{Bateau}~~\TangramTikz{Kangourou} +\end{PresentationCode} + +\subsection{Clés, options et arguments} + +Le premier argument, \textit{optionnel} et entre \texttt{[...]}, correspond aux clés et options : + +\begin{itemize} + \item le booléen \Cle{Puzzle} qui affiche les pièces (monochromes) de puzzle, sans bordure ; \hfill~défaut : \Cle{true} + \item le booléen \Cle{Correction} qui affiche les pièces (monochromes) du puzzle, avec bordure ; \hfill~défaut : \Cle{false} + \item \Cle{Couleur} qui paramètre la couleur globale du puzzle avec les booléens précédents ; \hfill~défaut : \Cle{black} + \item le booléen \Cle{CorrectionCouleur} qui affiche les pièces (colorées) du puzzle, avec bordure ; \hfill~défaut : \Cle{false} + \item \Cle{ListeCouleurs} qui est la couleur des pièces (\texttt{GT,MT,PT,CAR,PARA}) ; + + \hfill~défaut : \Cle{red,orange,blue,green,purple} + \item \Cle{Sep} qui est l'épaisseur de la bordure des pièces en mode \Cle{Correction} \hfill~défaut : \Cle{1pt} +\end{itemize} + +Le deuxième argument, \textit{optionnel} et entre \texttt{<...>}, correspond aux options qui sont passés à l'environnement \tikzlogo{} qui sert de base à la commande, comme par exemple : + +\begin{itemize} + \item un changement d'unité(s), un changement d'échelle ; + \item une rotation, un alignement vertical ; + \item etc +\end{itemize} + +Le troisième argument, \textit{obligatoire} et entre \texttt{\{...\}} est quant à lui le nom du Tangram issu de la \textit{base de données} présente dans le package : + +\texttt{\begin{multicols}{5} + \begin{itemize} + \item Carre + \item Pingouin + \item Bateau + \item Maison + \item Sapin + \item Chat + \item Cygne + \item Pyramide + \item Canard + \item Fusee + \item Bougie + \item Chemise + \item Poisson + \item Voilier + \item Kangourou + \item Chien + \end{itemize} +\end{multicols}} + +\pagebreak + +\begin{PresentationCode}{} +\TangramTikz{Fusee}~~ +\TangramTikz[Couleur=red]{Fusee}~~ +\TangramTikz[Correction]{Fusee}~~ +\TangramTikz[Correction,Couleur=lightgray]{Fusee}~~ +\TangramTikz[CorrectionCouleur,ListeCouleurs={orange,blue,yellow,green,pink},Sep=1mm]{Fusee} + +\TangramTikz{Fusee}~~ +\TangramTikz{Fusee} +\end{PresentationCode} + +\pagebreak + +\part{Galerie de Tangrams disponibles} + +\begin{PresentationCode}{} +\TangramTikz{Carre} +\TangramTikz[Correction]{Carre} +\TangramTikz[CorrectionCouleur]{Carre} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Pingouin} + \TangramTikz[Correction]{Pingouin} + \TangramTikz[CorrectionCouleur]{Pingouin} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Bateau} + \TangramTikz[Correction]{Bateau} + \TangramTikz[CorrectionCouleur]{Bateau} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Maison} + \TangramTikz[Correction]{Maison} + \TangramTikz[CorrectionCouleur]{Maison} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Sapin} + \TangramTikz[Correction]{Sapin} + \TangramTikz[CorrectionCouleur]{Sapin} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Chat} + \TangramTikz[Correction]{Chat} + \TangramTikz[CorrectionCouleur]{Chat} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Cygne} + \TangramTikz[Correction]{Cygne} + \TangramTikz[CorrectionCouleur]{Cygne} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Pyramide} + \TangramTikz[Correction]{Pyramide} + \TangramTikz[CorrectionCouleur]{Pyramide} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Canard} + \TangramTikz[Correction]{Canard} + \TangramTikz[CorrectionCouleur]{Canard} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Fusee} + \TangramTikz[Correction]{Fusee} + \TangramTikz[CorrectionCouleur]{Fusee} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Bougie} + \TangramTikz[Correction]{Bougie} + \TangramTikz[CorrectionCouleur]{Bougie} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Chemise} + \TangramTikz[Correction]{Chemise} + \TangramTikz[CorrectionCouleur]{Chemise} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Poisson} + \TangramTikz[Correction]{Poisson} + \TangramTikz[CorrectionCouleur]{Poisson} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Voilier} + \TangramTikz[Correction]{Voilier} + \TangramTikz[CorrectionCouleur]{Voilier} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Kangourou} + \TangramTikz[Correction]{Kangourou} + \TangramTikz[CorrectionCouleur]{Kangourou} +\end{PresentationCode} + +\begin{PresentationCode}{} + \TangramTikz{Chien} + \TangramTikz[Correction]{Chien} + \TangramTikz[CorrectionCouleur]{Chien} +\end{PresentationCode} + +\newpage + +\part{Historique} + +\verb|v0.1.0|~:~~~~Version initiale + +\end{document} \ No newline at end of file diff --git a/graphics/pgf/contrib/tangramtikz/tex/TangramTikz.sty b/graphics/pgf/contrib/tangramtikz/tex/TangramTikz.sty new file mode 100644 index 0000000000..90e772d99c --- /dev/null +++ b/graphics/pgf/contrib/tangramtikz/tex/TangramTikz.sty @@ -0,0 +1,513 @@ +% Author.........: C. Pierquet +% licence........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf +% Inspiration....: https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{TangramTikz}[2023/01/22 v0.1.0 Tangram Puzzles with TikZ] +% 0.1.0 Version initiale + quelques modèles + +%------Packages utiles +\RequirePackage{tikz} +\RequirePackage{xparse} +\RequirePackage{simplekv} +\RequirePackage{xstring} +\RequirePackage{listofitems} +%librairies tikz +\usetikzlibrary{calc,shapes.geometric} + +%pieces and styles, [en] and [fr], and keys +%https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex +\tikzset{ + TangBigTri/.pic={\path[pic actions] (0,0)--(2,0)--(2,2)--cycle;}, + TangGrandTri/.pic={\path[pic actions] (0,0)--(2,0)--(2,2)--cycle;}, + TangMedTri/.pic={\path[pic actions] (0,0)--(1,1)--(2,0)--cycle;}, + TangMoyTri/.pic={\path[pic actions] (0,0)--(1,1)--(2,0)--cycle;}, + TangSqua/.pic={\path[pic actions] (0,0)--(1,0)--(1,1)--(0,1)--cycle;}, + TangCar/.pic={\path[pic actions] (0,0)--(1,0)--(1,1)--(0,1)--cycle;}, + TangSmalTri/.pic={\path[pic actions] (0,0)--(1,0)--(1,1)--cycle;}, + TangPetTri/.pic={\path[pic actions] (0,0)--(1,0)--(1,1)--cycle;}, + TangPara/.pic={\path[pic actions] (0,0)--(1,0)--(2,1)--(1,1)--cycle;} +} +\tikzset{% + TangPuzz/.style={transform shape,fill=#1,draw=#1}, + TangPuzz/.default=black, + TangSol/.style={transform shape,fill=#1,draw=white,line width=\TangBorder}, + TangSol/.default=black +} + +%the square / le carre +\NewDocumentCommand\TangramSquare{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \pic[TangSol={\TanGListeCouleurs[1]}] at (0,0) {TangBigTri};% + \pic[TangSol={\TanGListeCouleurs[1]},rotate=-90] at (2,2) {TangBigTri};% + \pic[TangSol={\TanGListeCouleurs[4]},rotate=-90] at (2,0) {TangSqua};% + \pic[TangSol={\TanGListeCouleurs[3]},rotate=180] at (4,0) {TangSmalTri};% + \pic[TangSol={\TanGListeCouleurs[3]},rotate=90] at (2,-1) {TangSmalTri};% + \pic[TangSol={\TanGListeCouleurs[5]},xscale=-1] at (2,-1) {TangPara};% + \pic[TangSol={\TanGListeCouleurs[2]},rotate=180] at (3,-1) {TangMedTri};% + }% + {% + \pic[#2] at (0,0) {TangBigTri};% + \pic[#2,rotate=-90] at (2,2) {TangBigTri};% + \pic[#2,rotate=-90] at (2,0) {TangSqua};% + \pic[#2,rotate=180] at (4,0) {TangSmalTri};% + \pic[#2,rotate=90] at (2,-1) {TangSmalTri};% + \pic[#2,xscale=-1] at (2,-1) {TangPara};% + \pic[#2,rotate=180] at (3,-1) {TangMedTri};% + }% +} + +%the pinguin / le pingouin +%https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex +\NewDocumentCommand\TangramPinguin{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \path (0,-1) pic[TangSol={\TanGListeCouleurs[3]}] {TangSmalTri} + ++(1,0) pic[TangSol={\TanGListeCouleurs[4]}] {TangSqua} + ++(1,1) pic[TangSol={\TanGListeCouleurs[1]},rotate=-45,yscale=-1] {TangBigTri} + ++(-45:2) pic[TangSol={\TanGListeCouleurs[1]},rotate=-135] {TangBigTri} + +({-sqrt(2)},0) pic[TangSol={\TanGListeCouleurs[5]},rotate=-135] {TangPara} + ++(-2,{-2*sqrt(2)}) pic[TangSol={\TanGListeCouleurs[2]}] {TangMedTri} + ++(2,1) pic[TangSol={\TanGListeCouleurs[3]},rotate=-90] {TangSmalTri} ; + }% + {% + \path (0,-1) pic[#2] {TangSmalTri} + ++(1,0) pic[#2] {TangSqua} + ++(1,1) pic[#2,rotate=-45,yscale=-1] {TangBigTri} + ++(-45:2) pic[#2,rotate=-135] {TangBigTri} + +({-sqrt(2)},0) pic[#2,rotate=-135] {TangPara} + ++(-2,{-2*sqrt(2)}) pic[#2] {TangMedTri} + ++(2,1) pic[#2,rotate=-90] {TangSmalTri} ; + }% +} + +%the boat / le bateau +%https://tex.stackexchange.com/questions/407449/typesetting-tangram-figures-in-latex +\NewDocumentCommand\TangramBoat{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \path (0,0) pic[TangSol={\TanGListeCouleurs[2]},rotate=180] {TangMedTri} + ++(-1,-1) pic[TangSol={\TanGListeCouleurs[5]}] {TangPara} + ++(1,0) pic[TangSol={\TanGListeCouleurs[3]}] {TangSmalTri} + ++(1,0) pic[TangSol={\TanGListeCouleurs[4]}] {TangSqua} + ++(2,1) pic[TangSol={\TanGListeCouleurs[3]},rotate=180] {TangSmalTri} + ++(-2.5,0) pic[TangSol={\TanGListeCouleurs[1]},rotate=80] {TangBigTri} + ++(80:4) + ++(170:2) pic[TangSol={\TanGListeCouleurs[1]},rotate=-100] {TangBigTri} ; + }% + {% + \path (0,0) pic[#2,rotate=180] {TangMedTri} + ++(-1,-1) pic[#2] {TangPara} + ++(1,0) pic[#2] {TangSmalTri} + ++(1,0) pic[#2] {TangSqua} + ++(2,1) pic[#2,rotate=180] {TangSmalTri} + ++(-2.5,0) pic[#2,rotate=80] {TangBigTri} + ++(80:4) + ++(170:2) pic[#2,rotate=-100] {TangBigTri} ; + }% +} + +%the house / la maison +\NewDocumentCommand\TangramHome{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({sqrt(8)},0){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}](0,0){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}](-0.5,{sqrt(2)}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0.5+sqrt(8)},{sqrt(2)}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}](0.5,{sqrt(2)+1}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({sqrt(2)},{sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({sqrt(8)},0){TangPetTri} + }% + {% + \PieceTangram[#2]({sqrt(8)},0){TangGrandTri} + \PieceTangram[#2](0,0){TangMoyTri} + \PieceTangram[#2](-0.5,{sqrt(2)}){TangPara} + \PieceTangram[#2]({0.5+sqrt(8)},{sqrt(2)}){TangGrandTri} + \PieceTangram[#2](0.5,{sqrt(2)+1}){TangCar} + \PieceTangram[#2]({sqrt(2)},{sqrt(2)}){TangPetTri} + \PieceTangram[#2]({sqrt(8)},0){TangPetTri} + }% +} + +%the fir tree / le sapin +\NewDocumentCommand\TangramFirTree{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({0},{0}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({-1.5},{1}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0.5},{3}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({2.5},{2}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({-1.5},{2}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({-0.5},{2}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({-0.5},{3}){TangMoyTri} + }% + {% + \PieceTangram[#2]({0},{0}){TangCar} + \PieceTangram[#2]({-1.5},{1}){TangGrandTri} + \PieceTangram[#2]({0.5},{3}){TangGrandTri} + \PieceTangram[#2]({2.5},{2}){TangPara} + \PieceTangram[#2]({-1.5},{2}){TangPetTri} + \PieceTangram[#2]({-0.5},{2}){TangPetTri} + \PieceTangram[#2]({-0.5},{3}){TangMoyTri} + }% +} + +%the cat / le chat +\NewDocumentCommand\TangramCat{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({2-sqrt(2)},{2+sqrt(2)}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}](0,0){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({2-sqrt(2)},{2-sqrt(2)}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({2},{0}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({2-1.5*sqrt(2)},{2+1.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({2-0.5*sqrt(2)},{2+2.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({2-sqrt(2)},{sqrt(2)}){TangMoyTri} + }% + {% + \PieceTangram[#2]({2-sqrt(2)},{2+sqrt(2)}){TangCar} + \PieceTangram[#2](0,0){TangGrandTri} + \PieceTangram[#2]({2-sqrt(2)},{2-sqrt(2)}){TangGrandTri} + \PieceTangram[#2]({2},{0}){TangPara} + \PieceTangram[#2]({2-1.5*sqrt(2)},{2+1.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({2-0.5*sqrt(2)},{2+2.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({2-sqrt(2)},{sqrt(2)}){TangMoyTri} + }% +} + +%the swan / le cygne +\NewDocumentCommand\TangramSwan{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({sqrt(2)},{sqrt(2)}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({sqrt(2)},{sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({sqrt(2)+1},{sqrt(2)}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({0},{0}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({0},{2+sqrt(2)}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({-1},{1+sqrt(2)}){TangPetTri} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({sqrt(2)},{sqrt(2)}){TangGrandTri} + \PieceTangram[#2]({sqrt(2)},{sqrt(2)}){TangPetTri} + \PieceTangram[#2]({sqrt(2)+1},{sqrt(2)}){TangCar} + \PieceTangram[#2]({0},{0}){TangMoyTri} + \PieceTangram[#2]({0},{2+sqrt(2)}){TangPara} + \PieceTangram[#2]({-1},{1+sqrt(2)}){TangPetTri} + }% +} + +%the duck / le canard +\NewDocumentCommand\TangramDuck{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({sqrt(2)},{sqrt(2)}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({2*sqrt(2)},{0}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({sqrt(2)},{sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({2.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({sqrt(8)+0.5*sqrt(2)},{1+0.5*sqrt(2)}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({2.5*sqrt(2)-2},{2+0.5*sqrt(2)}){TangMoyTri} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({sqrt(2)},{sqrt(2)}){TangGrandTri} + \PieceTangram[#2]({2*sqrt(2)},{0}){TangCar} + \PieceTangram[#2]({sqrt(2)},{sqrt(2)}){TangPetTri} + \PieceTangram[#2]({2.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({sqrt(8)+0.5*sqrt(2)},{1+0.5*sqrt(2)}){TangPara} + \PieceTangram[#2]({2.5*sqrt(2)-2},{2+0.5*sqrt(2)}){TangMoyTri} + }% +} + +%the pyramid / la pyramide +\NewDocumentCommand\TangramPyramid{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({-0.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({-sqrt(2)},{sqrt(2)}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({0},{2*sqrt(2)}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0},{sqrt(2)}){TangPetTri} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({-0.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({-sqrt(2)},{sqrt(2)}){TangPara} + \PieceTangram[#2]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangCar} + \PieceTangram[#2]({0},{2*sqrt(2)}){TangMoyTri} + \PieceTangram[#2]({0},{sqrt(2)}){TangPetTri} + }% +} + +%the rocket / la fusee +\NewDocumentCommand\TangramRocket{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({2},{2}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({0},{2}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({0.5},{-1}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({-0.5},{-1}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0.5},{-1}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({1.5},{0}){TangPara} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({2},{2}){TangGrandTri} + \PieceTangram[#2]({0},{2}){TangMoyTri} + \PieceTangram[#2]({0.5},{-1}){TangCar} + \PieceTangram[#2]({-0.5},{-1}){TangPetTri} + \PieceTangram[#2]({0.5},{-1}){TangPetTri} + \PieceTangram[#2]({1.5},{0}){TangPara} + }% +} + +%the candle / la bougie +\NewDocumentCommand\TangramCandle{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({1.5*sqrt(2)},{1.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({1.5*sqrt(2)},{2.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({sqrt(2)-1},{1+2*sqrt(2)}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({sqrt(2)-0.5},{1+2*sqrt(2)}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({sqrt(2)},{2+2*sqrt(2)}){TangPara} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangGrandTri} + \PieceTangram[#2]({1.5*sqrt(2)},{1.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({1.5*sqrt(2)},{2.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({sqrt(2)-1},{1+2*sqrt(2)}){TangMoyTri} + \PieceTangram[#2]({sqrt(2)-0.5},{1+2*sqrt(2)}){TangCar} + \PieceTangram[#2]({sqrt(2)},{2+2*sqrt(2)}){TangPara} + }% +} + +%the shirt / la chemise +\NewDocumentCommand\TangramShirt{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{2}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({2},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({-1},{2}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({1},{2}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({1},{2}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0},{2}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({2},{3}){TangPara} + }% + {% + \PieceTangram[#2]({0},{2}){TangGrandTri} + \PieceTangram[#2]({2},{0}){TangGrandTri} + \PieceTangram[#2]({-1},{2}){TangMoyTri} + \PieceTangram[#2]({1},{2}){TangPetTri} + \PieceTangram[#2]({1},{2}){TangCar} + \PieceTangram[#2]({0},{2}){TangPetTri} + \PieceTangram[#2]({2},{3}){TangPara} + }% +} + +%the fish / le poisson +\NewDocumentCommand\TangramFish{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0},{0}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({0},{0}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({-1},{1}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({sqrt(2)},{0}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({1.5*sqrt(2)-2},{2+0.5*sqrt(2)}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({1.5*sqrt(2)},{-0.5*sqrt(2)}){TangGrandTri} + }% + {% + \PieceTangram[#2]({0},{0}){TangPetTri} + \PieceTangram[#2]({0},{0}){TangPara} + \PieceTangram[#2]({-1},{1}){TangMoyTri} + \PieceTangram[#2]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({sqrt(2)},{0}){TangCar} + \PieceTangram[#2]({1.5*sqrt(2)-2},{2+0.5*sqrt(2)}){TangGrandTri} + \PieceTangram[#2]({1.5*sqrt(2)},{-0.5*sqrt(2)}){TangGrandTri} + }% +} + +%the sailboat / le voilier +\NewDocumentCommand\TangramSailboat{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({-2},{0.35}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0},{0}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({-2+sqrt(2)},{0}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0},{1+2*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({-1-2+sqrt(2)},{0}){TangPara} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({-2},{0.35}){TangGrandTri} + \PieceTangram[#2]({0},{0}){TangPetTri} + \PieceTangram[#2]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangCar} + \PieceTangram[#2]({-2+sqrt(2)},{0}){TangMoyTri} + \PieceTangram[#2]({0},{1+2*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({-1-2+sqrt(2)},{0}){TangPara} + }% +} + +%the kangaroo / le kangourou +\NewDocumentCommand\TangramKangaroo{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({2},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({2},{-0.5}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({2},{3}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({0},{-2}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({-0.5*sqrt(2)},{-2-0.5*sqrt(2)}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({1-0.5*sqrt(2)},{-1-0.5*sqrt(2)}){TangCar} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({2},{0}){TangGrandTri} + \PieceTangram[#2]({2},{-0.5}){TangPetTri} + \PieceTangram[#2]({2},{3}){TangPetTri} + \PieceTangram[#2]({0},{-2}){TangPara} + \PieceTangram[#2]({-0.5*sqrt(2)},{-2-0.5*sqrt(2)}){TangMoyTri} + \PieceTangram[#2]({1-0.5*sqrt(2)},{-1-0.5*sqrt(2)}){TangCar} + }% +} + +%the dog / le chien +\NewDocumentCommand\TangramDog{ s O{TangPuzz} }{%*=colorcorrection,[key for pic] + \IfBooleanTF{#1}% + {% + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0},{0}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[5]}]({0},{1.75}){TangPara} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[TangSol={\TanGListeCouleurs[1]}]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangGrandTri} + \PieceTangram[TangSol={\TanGListeCouleurs[2]}]({2-0.5*sqrt(2)},{0.5*sqrt(2)}){TangMoyTri} + \PieceTangram[TangSol={\TanGListeCouleurs[4]}]({2.5},{2.5}){TangCar} + \PieceTangram[TangSol={\TanGListeCouleurs[3]}]({2.5},{2.5+sqrt(2)}){TangPetTri} + }% + {% + \PieceTangram[#2]({0},{0}){TangGrandTri} + \PieceTangram[#2]({0},{1.75}){TangPara} + \PieceTangram[#2]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangPetTri} + \PieceTangram[#2]({0.5*sqrt(2)},{0.5*sqrt(2)}){TangGrandTri} + \PieceTangram[#2]({2-0.5*sqrt(2)},{0.5*sqrt(2)}){TangMoyTri} + \PieceTangram[#2]({2.5},{2.5}){TangCar} + \PieceTangram[#2]({2.5},{2.5+sqrt(2)}){TangPetTri} + }% +} + +%macros for tangram creation / commandes pour créer le tangram +\NewDocumentCommand\TangramTikzCreateEN{ m }{% + \readlist*\TanGListeCouleurs{\TangColors}% + \ifboolKV[TGRMTikz]{Puzzle}{#1[TangPuzz={\TangColor}]}{}% + \ifboolKV[TGRMTikz]{Correction}{#1[TangSol={\TangColor}]}{}% + \ifboolKV[TGRMTikz]{ColorCorrection}{#1*}{}% +} +\NewDocumentCommand\TangramTikzCreateFR{ m }{% + \readlist*\TanGListeCouleurs{\TangCouleurs}% + \ifboolKV[TGRMTikz]{Puzzle}{#1[TangPuzz={\TangCouleur}]}{}% + \ifboolKV[TGRMTikz]{Correction}{#1[TangSol={\TangCouleur}]}{}% + \ifboolKV[TGRMTikz]{CorrectionCouleur}{#1*}{}% +} + +\defKV[TGRMTikz]{%keys [en] and [fr] + ListeCouleurs=\xdef\TangCouleurs{#1}, + ColorList=\xdef\TangColors{#1},% + Couleur=\xdef\TangCouleur{#1},% + Color=\xdef\TangColor{#1},% + Sep=\xdef\TangBorder{#1} +} +\setKVdefault[TGRMTikz]{%keys by default [en] and [fr] + Puzzle=true,% + Correction=false,% + ColorCorrection=false,% + CorrectionCouleur=false,% + ListeCouleurs={red,orange,blue,green,purple},% + ColorList={red,orange,blue,green,purple},% + Couleur=black,% + Color=black,% + Sep=1pt +} + +%the independent command / la commande autonome +\NewDocumentCommand\TangramTikz{ O{} D<>{} m }{% + \useKVdefault[TGRMTikz]% + \setKV[TGRMTikz]{#1}% + \begin{tikzpicture}[line join=bevel,#2]% + %SQUARE + \IfStrEq{#3}{Square}{\TangramTikzCreateEN{\TangramSquare}}{}% + \IfStrEq{#3}{Carre}{\TangramTikzCreateFR{\TangramSquare}}{}% + %PINGUIN + \IfStrEq{#3}{Pinguin}{\TangramTikzCreateEN{\TangramPinguin}}{}% + \IfStrEq{#3}{Pingouin}{\TangramTikzCreateFR{\TangramPinguin}}{}% + %BOAT + \IfStrEq{#3}{Boat}{\TangramTikzCreateEN{\TangramBoat}}{}% + \IfStrEq{#3}{Bateau}{\TangramTikzCreateFR{\TangramBoat}}{}% + %HOME + \IfStrEq{#3}{Home}{\TangramTikzCreateEN{\TangramHome}}{}% + \IfStrEq{#3}{Maison}{\TangramTikzCreateFR{\TangramHome}}{}% + %FIRTREE + \IfStrEq{#3}{FirTree}{\TangramTikzCreateEN{\TangramFirTree}}{}% + \IfStrEq{#3}{Sapin}{\TangramTikzCreateFR{\TangramFirTree}}{}% + %CAT + \IfStrEq{#3}{Cat}{\TangramTikzCreateEN{\TangramCat}}{}% + \IfStrEq{#3}{Chat}{\TangramTikzCreateFR{\TangramCat}}{}% + %SWAN + \IfStrEq{#3}{Swan}{\TangramTikzCreateEN{\TangramSwan}}{}% + \IfStrEq{#3}{Cygne}{\TangramTikzCreateFR{\TangramSwan}}{}% + %PYRAMID + \IfStrEq{#3}{Pyramid}{\TangramTikzCreateEN{\TangramPyramid}}{}% + \IfStrEq{#3}{Pyramide}{\TangramTikzCreateFR{\TangramPyramid}}{}% + %DUCK + \IfStrEq{#3}{Duck}{\TangramTikzCreateEN{\TangramDuck}}{}% + \IfStrEq{#3}{Canard}{\TangramTikzCreateFR{\TangramDuck}}{}% + %ROCKET + \IfStrEq{#3}{Rocket}{\TangramTikzCreateEN{\TangramRocket}}{}% + \IfStrEq{#3}{Fusee}{\TangramTikzCreateFR{\TangramRocket}}{}% + %CANDLE + \IfStrEq{#3}{Candle}{\TangramTikzCreateEN{\TangramCandle}}{}% + \IfStrEq{#3}{Bougie}{\TangramTikzCreateFR{\TangramCandle}}{}% + %SHIRT + \IfStrEq{#3}{Shirt}{\TangramTikzCreateEN{\TangramShirt}}{}% + \IfStrEq{#3}{Chemise}{\TangramTikzCreateFR{\TangramShirt}}{}% + %FISH + \IfStrEq{#3}{Fish}{\TangramTikzCreateEN{\TangramFish}}{}% + \IfStrEq{#3}{Poisson}{\TangramTikzCreateFR{\TangramFish}}{}% + %SAILBOAT + \IfStrEq{#3}{Sailboat}{\TangramTikzCreateEN{\TangramSailboat}}{}% + \IfStrEq{#3}{Voilier}{\TangramTikzCreateFR{\TangramSailboat}}{}% + %KANGAROO + \IfStrEq{#3}{Kangaroo}{\TangramTikzCreateEN{\TangramKangaroo}}{}% + \IfStrEq{#3}{Kangourou}{\TangramTikzCreateFR{\TangramKangaroo}}{}% + %DOG + \IfStrEq{#3}{Dog}{\TangramTikzCreateEN{\TangramDog}}{}% + \IfStrEq{#3}{Chien}{\TangramTikzCreateFR{\TangramDog}}{}% + \end{tikzpicture}% +} + +%manual creation / creation manuelle +\NewDocumentCommand\PieceTangram{ O{TangPuzz} D<>{} D(){0,0} m }{%booléen+options pic+place pic+nom piece + \pic[#1,#2] at (#3) {#4};% +} +\NewDocumentEnvironment{EnvTangramTikz}{ O{} D<>{} }% +{% + \useKVdefault[TGRMTikz]% + \setKV[TGRMTikz]{#1}% + \begin{tikzpicture}[line join=bevel,#2]% +}% +{% + \end{tikzpicture}% +} + +\endinput \ No newline at end of file -- cgit v1.2.3