diff options
author | Norbert Preining <norbert@preining.info> | 2023-04-30 03:01:09 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-04-30 03:01:09 +0000 |
commit | 7932c8102a8f5298d7d36caa6df233c356f96e56 (patch) | |
tree | 29f63548f8a9aded2b185da657ef12a769870028 /graphics | |
parent | 76a6fd547d47614b546d7e566bae544de7b88efc (diff) |
CTAN sync 202304300301
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/pgf/contrib/playcards/README.md | 11 | ||||
-rw-r--r-- | graphics/pgf/contrib/playcards/playcards-en.pdf | bin | 0 -> 304943 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/playcards/playcards-en.tex | 94 | ||||
-rw-r--r-- | graphics/pgf/contrib/playcards/playcards-fr.pdf | bin | 0 -> 323724 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/playcards/playcards-fr.tex | 93 | ||||
-rw-r--r-- | graphics/pgf/contrib/playcards/playcards.sty | 177 |
6 files changed, 375 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/playcards/README.md b/graphics/pgf/contrib/playcards/README.md new file mode 100644 index 0000000000..958a6ea032 --- /dev/null +++ b/graphics/pgf/contrib/playcards/README.md @@ -0,0 +1,11 @@ +# Playcards package +Tiny LaTeX package to draw playcards. +## Version +0.1, 2023/04/29 +## Licence +GNU LGPL v3.0 https://www.gnu.org/licenses/lgpl-3.0.html + + +Author : Clément PAGÈS +Maintainer: Clément PAGÈS +E-mail : contact -- arobase -- clementpages point fr diff --git a/graphics/pgf/contrib/playcards/playcards-en.pdf b/graphics/pgf/contrib/playcards/playcards-en.pdf Binary files differnew file mode 100644 index 0000000000..9c95df3a27 --- /dev/null +++ b/graphics/pgf/contrib/playcards/playcards-en.pdf diff --git a/graphics/pgf/contrib/playcards/playcards-en.tex b/graphics/pgf/contrib/playcards/playcards-en.tex new file mode 100644 index 0000000000..60ab32903b --- /dev/null +++ b/graphics/pgf/contrib/playcards/playcards-en.tex @@ -0,0 +1,94 @@ +%% Packages indispensables +\documentclass[a4paper, 12pt]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[english]{babel} + +\usepackage[a4paper]{geometry} +\usepackage{graphicx} + +\newcommand{\package}[1]{\texttt{#1}} +\newcommand{\kv}[2]{\textit{<#1>}\texttt=\textit{<#2>}} +\newcommand{\key}[3]{\textbf{\texttt{#1} (default value: \texttt{#2})} #3} +\newcommand{\commande}[1]{\texttt{\textbackslash#1}} + + +\usepackage{hyperref} +\hypersetup{ + colorlinks=true, + linkcolor=blue, + urlcolor=blue, +} + +\title{Package \texttt{playcards.sty} for \LaTeX} +\date{\today} +\author{Clément Pagès \texttt{contact -- arobase -- clementpages point fr}} + +\begin{document} +\maketitle + +This small package provides commands to draw playcards, with witdh 59 mm and height 89 mm, which are typicall cards dimensions. + +\tableofcontents +\section*{Thanks} +Thanks to Christophe Poulain for his amazing \href{https://ctan.org/pkg/profcollege}{ProfCollege} package, which source code was useful to design syntax commands we use here. And more generally, thank you you for this amazing package! + +Also thanks to \href{https://tex.stackexchange.com/users/1948/didest}{didest} who asked a question on \href{https://tex.stackexchange.com/questions/47924/creating-playing-cards-using-tikz}{StackExchange}. I used it to built this package. + +\section{Download, installation, requirements} + +Package available on CTAN. It contains one single file : \texttt{playcards.sty}. + +Some package are automatically loaded. They are installed by default on most configurations : +\begin{description} + \item[\package{tikz}] and some libraries. + \item[\package{simplekv}] dot manage optional parameters whit a \kv{key}{value} system. + \item[\package{graphicx}] for pictures. + \item[\package{contour}] for text shadows and borders. + \item[\package{geometry}] configured to draw 9 cards on an A4 paper. +\end{description} + +\section{Generalities} +Commands are based on a key/value system, with model \texttt{\textbackslash command[\kv{key1}{value1}, \kv{key2}{value2}, …,]\{param1\}\{param2\}}. + +All the keys are optional and if one does not fill them, they get a default value. + +All length are given in millimeters. + +\section{Provided commands} + \subsection{\commande{drawcardsrecto} command} +This command has one required parameter : text written in the center of the card. It fills an A4 paper with 9 identical cards. This command only draws front side of the card. There is an example figure \ref{fig:recto}. +\begin{figure}[h]\begin{center} + \caption{\commande{drawcardsrecto[trame=false]\{5\}}} + \includegraphics{screen01.png}\label{fig:recto} +\end{center}\end{figure} + +Optional parameters: +\begin{itemize} + \item \key{borders}{true}{Removes borders.} + \item \key{trame}{true}{If \texttt{true}, fills an A4 paper with cards.. Si \texttt{false}, draws one only card.} + \item \key{corners}{true}{If \texttt{true}, card contends is reproduced in corners. If \texttt{false}, it is not.} + \item \key{backgroundImg}{true}{Si \texttt{true}, prints background. If \texttt{false}, no background.} + \item \key{backgroundColor}{red}{Specifies background color. Ignored if \texttt{backgroundImg=false}. Uses colored defined in the \href{https://www.ctan.org/pkg/xcolor}{xcolor} package.} + \item \key{contentsFontSize}{120}{Font size (int pt) of text in card center.} + \item \key{cicleRay}{20}{Ray of the white circle the center of the card. Value \texttt 0 means no circle.} +\end{itemize} + + + \subsection{\commande{drawcardsverso} command} +It is possible, but not required, to draw card back side. Front sides must be on one page and back sides on an other. You must have as many front sides as back sides. There is an example figure \ref{fig:verso}. + +To get a correct alignment, place commands in a \verb!\begin{center}...\end{center}! environment. +\begin{figure}[h]\begin{center} + \caption{\commande{drawcardsverso[trame=false,contentsFontSize=40]\{Exemple\}}} + \includegraphics{screen02.png}\label{fig:verso} +\end{center}\end{figure} + +Optional parameters: +\begin{itemize} + \item \key{backgroundImg}{true}{Si \texttt{true}, prints background. If \texttt{false}, no background.} + \item \key{trame}{true}{If \texttt{true}, fills an A4 paper with cards.. Si \texttt{false}, draws one only card.} + \item \key{contentsFontSize}{120}{Font size (int pt) of text in card center.} +\end{itemize} + +\end{document} diff --git a/graphics/pgf/contrib/playcards/playcards-fr.pdf b/graphics/pgf/contrib/playcards/playcards-fr.pdf Binary files differnew file mode 100644 index 0000000000..a06a7cc09b --- /dev/null +++ b/graphics/pgf/contrib/playcards/playcards-fr.pdf diff --git a/graphics/pgf/contrib/playcards/playcards-fr.tex b/graphics/pgf/contrib/playcards/playcards-fr.tex new file mode 100644 index 0000000000..7860a9b1e5 --- /dev/null +++ b/graphics/pgf/contrib/playcards/playcards-fr.tex @@ -0,0 +1,93 @@ +%% Packages indispensables +\documentclass[a4paper, 12pt]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[francais]{babel} + +\usepackage[a4paper]{geometry} +\usepackage{graphicx} + +\newcommand{\package}[1]{\texttt{#1}} +\newcommand{\kv}[2]{\textit{<#1>}\texttt=\textit{<#2>}} +\newcommand{\key}[3]{\textbf{\texttt{#1} (valeur par défaut : \texttt{#2})} #3} +\newcommand{\commande}[1]{\texttt{\textbackslash#1}} + + +\usepackage{hyperref} +\hypersetup{ + colorlinks=true, + linkcolor=blue, + urlcolor=blue, +} + +\title{Package \texttt{playcards.sty} pour \LaTeX} +\date{\today} +\author{Clément \bsc{Pagès} \texttt{contact -- arobase -- clementpages point fr}} + +\begin{document} +\maketitle + +Ce petit package fournit des commandes pour dessiner des cartes à jouer, de largeur 59 mm et de hauteur 89 mm. Ce sont les dimensions des cartes classiques. + +\tableofcontents + +\section*{Remerciements} +Je remercie Christophe \bsc{Poulain} pour son génial package \href{https://ctan.org/pkg/profcollege}{ProfCollege}, dont le code m'a servi d'inspiration pour la syntaxe des commandes utilisées ici. Et plus globalement pour ce package exceptionnel, devenu indispensable ! + +Merci également à \href{https://tex.stackexchange.com/users/1948/didest}{didest}, dont la question posée sur \href{https://tex.stackexchange.com/questions/47924/creating-playing-cards-using-tikz}{StackExchange} m'a servi de base. + +\section{Téléchargement, installation, prérequis} +Le package est disponible sur CTAN : <lien à venir>. Il contient un unique fichier : \texttt{playcards.sty} + +Certains packages sont chargés automatiquement. Ils sont installés par défaut sur la majorités des installations classiques : +\begin{description} + \item[\package{tikz}] et certaines de ses librairies. + \item[\package{simplekv}] pour gérer les paramètres facultatifs des commandes par système \kv{clé}{valeur}. + \item[\package{graphicx}] pour les images. + \item[\package{contour}] pour les ombres et contours de textes. + \item[\package{geometry}] configuré pour optimiser l'occupation d'une feuille A4 en la remplissant de cartes convenablement alignées. +\end{description} + +\section{Principe général} +Les principales commandes sont construites sur un système de clés/valeurs, sur le modèle \texttt{\textbackslash commande[\kv{cle1}{valeur1}, \kv{cle2}{valeur2}, …,]\{param1\}\{param2\}}. + +Toutes les clés sont facultatives et si elles ne sont pas renseignées, il leur est attribué une valeur par défaut. + +Sauf précision contraire, les longueurs sont mentionnées en millimètres. + +\section{Commandes fournies} + \subsection{Commande \commande{drawcardsrecto}} +Cette commande prend un paramètre obligatoire : le texte qui apparaîtra au centre de la carte et remplit une feuille A4 avec 9 cartes identiques. Cette commande trace le recto des cartes. Un exemple est donné figure \ref{fig:recto}. +\begin{figure}[h]\begin{center} + \caption{\commande{drawcardsrecto[trame=false]\{5\}}} + \includegraphics{screen01.png}\label{fig:recto} +\end{center}\end{figure} + +Paramètres optionnels : +\begin{itemize} + \item \key{borders}{true}{Retire les bordures.} + \item \key{trame}{true}{Si \texttt{true}, remplit une feuille A4 avec les cartes. Si \texttt{false}, dessine une seule carte.} + \item \key{corners}{true}{Si \texttt{true}, le texte de la carte est reporté à l'endroit à et à l'envers dans les coins. Si \texttt{false}, les coins ne sont pas affichés.} + \item \key{backgroundImg}{true}{Si \texttt{true}, affiche l'arrière-plan. Si \texttt{false}, pas d'arrière-plan.} + \item \key{backgroundColor}{red}{Spécifie la couleur de l'arrière-plan. Sera ignoré si \texttt{backgroundImg=false}. Utilise les couleurs du package \href{https://www.ctan.org/pkg/xcolor}{xcolor}.} + \item \key{contentsFontSize}{120}{Taille (en pt) du texte au centre de la carte.} + \item \key{cicleRay}{20}{Rayon du cercle blanc au centre de la carte. La valeur \texttt 0 équivaut à ne pas tracer le cercle.} +\end{itemize} + + \subsection{Commande \commande{drawcardsverso}} +Il est possible, mais ce n'est pas obligatoire, de dessiner le verso des cartes. Les rectos devront être sur une page et les versos sur une autre et d'avoir autant de rectos que de versos. Un exemple est donné figure \ref{fig:verso}. + +Pour avoir le bon alignement, il est recommandé de placer les commandes dans un environnement \verb!\begin{center}...\end{center}!. +\begin{figure}[h]\begin{center} + \caption{\commande{drawcardsverso[trame=false,contentsFontSize=40]\{Exemple\}}} + \includegraphics{screen02.png}\label{fig:verso} +\end{center}\end{figure} + +Paramètres optionnels : +\begin{itemize} + \item \key{backgroundImg}{true}{Si \texttt{true}, affiche l'arrière-plan. Si \texttt{false}, pas d'arrière-plan.} + \item \key{trame}{true}{Si \texttt{true}, remplit une feuille A4 avec les cartes. Si \texttt{false}, dessine une seule carte.} + \item \key{contentsFontSize}{50}{Taille (en pt) du texte au centre de la carte.} +\end{itemize} + +\end{document} diff --git a/graphics/pgf/contrib/playcards/playcards.sty b/graphics/pgf/contrib/playcards/playcards.sty new file mode 100644 index 0000000000..aa5218f241 --- /dev/null +++ b/graphics/pgf/contrib/playcards/playcards.sty @@ -0,0 +1,177 @@ +% Clément PAGÈS <contact@clementpages.fr> +% +% Version 0.1 +% +% Draws basic playcards with Tikz. Inspired by https://tex.stackexchange.com/questions/47924/creating-playing-cards-using-tikz +% +% Provides cards for a4paper format +% +% Licence Gnu Lesser General Public Licence https://www.gnu.org/licenses/lgpl-3.0.html + + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{playcards}[2023/04/29, Personal commands] + + +\RequirePackage[scale=0.950]{geometry} + +\RequirePackage{simplekv} +\RequirePackage{anttor} +\RequirePackage{graphicx} +\RequirePackage{tikz} +\usetikzlibrary{patterns} +\usetikzlibrary{shadows} +\usepgflibrary {shadings} +\tikzset{ + x=1mm,y=1mm, + cardcorners/.style={ + rounded corners=4 + }, +} + +\RequirePackage[outline]{contour} + +\pgfmathsetmacro{\cardwidth}{59} +\pgfmathsetmacro{\cardheight}{89} +\pgfmathsetmacro{\cardmargin}{4} +\pgfmathsetmacro{\cardwidthbody}{\cardwidth-\cardmargin} +\pgfmathsetmacro{\cardheightbody}{\cardheight-\cardmargin} +\pgfmathsetmacro{\stripwidth}{10} +\pgfmathsetmacro{\strippadding}{2} + + +\def\shapeCard{(0,0) rectangle (\cardwidth,\cardheight)} +\def\shapeCardBody{(0,0) rectangle (\cardwidthbody,\cardheightbody)} +\def\shapeMargin{(\cardmargin,\cardmargin) rectangle (\cardwidthbody,\cardheightbody)} + + + +\newcommand{\carddebug}{ + \draw [step=1,help lines] (0,0) grid (\cardwidth,\cardheight); +} + +\newcommand{\cardborder}{ + \draw[lightgray,cardcorners] \shapeCard; + \draw[black,cardcorners,line width=1pt] \shapeMargin; +} + +\newcommand{\cardpadding}{ + \draw[white,cardcorners] {(0,0) rectangle (\cardwidth+2,\cardheight+2)}; +} + + +\setKVdefault[RectoKeys]{borders=true, trame=true, corners=true, backgroundImg=true, textColor=black, backgroundColor=red, contentsFontSize=120, circleRay=20} +\setKVdefault[VersoKeys]{backgroundImg=true, trame=true, contentsFontSize=50} + + + +\newcommand{\cardbackgroundverso}[2][]{ + \pgfmathsetmacro{\textsize}{\useKV[VersoKeys]{contentsFontSize}} + \pgfmathsetmacro{\textlineskip}{1.2*\textsize} + \clip[cardcorners] \shapeCard; + \ifboolKV[VersoKeys]{backgroundImg} {% + \begin{scope} % Draw background + \draw[shading=color wheel,opacity=0.6] (0,0) rectangle (\cardwidth,\cardheight); + \end{scope} + }{% + \draw[cardcorners, line width=1pt] \shapeCard;% + }% + \begin{scope}[shift={(0.5*\cardwidth,0.5*\cardheight)}] % White text + \node[rotate=45, color=white] at (0,0) {\contourlength{1pt}\contour{black!}{\fontsize{\textsize}{\textlineskip pt}\selectfont #2}}; + \end{scope} +} + + +\newcommand{\cardcontent}[2][]{ + \pgfmathsetmacro{\textsize}{\useKV[RectoKeys]{contentsFontSize}} + \pgfmathsetmacro{\textlineskip}{1.2*\textsize} + \showKV[RectoKeys]{backgroundImg} + \showKV[RectoKeys]{backgroundColor} + \begin{scope} + \ifboolKV[RectoKeys]{borders} { + \clip[cardcorners] \shapeMargin; + }{ + \clip[cardcorners] \shapeCard; + } + \ifboolKV[RectoKeys]{backgroundImg} { + \shade[xshift=29.5mm, yshift=44.5mm, inner color={\useKV[RectoKeys]{backgroundColor}}, outer color=white] circle (\cardwidth) circle({\useKV[RectoKeys]{circleRay}}); + } + {} + \draw[color=white] (0,0) -- (60,70); + \draw[color=white] (0,20) -- (60,15); + \draw[color=white] (0,24) -- (60,30); + \draw[color=white] (0,37) -- (60,36); + \draw[color=white] (0,40) -- (60,60); + \draw[color=white] (0,47) -- (60,5); + \draw[color=white] (0,55) -- (60,45); + \draw[color=white] (0,70) -- (40,0); + \draw[color=white] (0,76) -- (60,65); + \draw[color=white] (0,80) -- (25,0); + \draw[color=white] (20,80) -- (15,0); + \draw[color=white] (35,90) -- (0,80); + \draw[color=white] (40,90) -- (60,-20); + \draw[color=white] (0,5) -- (60,90); + \draw[xshift=29.5mm, yshift=44.5mm, fill=white, color=white] circle(({\useKV[RectoKeys]{circleRay}}); + \end{scope} + \node[align=center, text width=5 cm] at (0.5*\cardwidth,0.5*\cardheight) {{\color{\useKV[RectoKeys]{textColor}}\fontsize{\textsize}{\textlineskip}\selectfont #2}}; +} + +\newcommand{\cardcorner}[1]{ + \begin{scope}[shift={(13,76)}] + \draw[rotate=30, fill=white, color=white] (0,0) ellipse (8 and 5) node[color=black, rotate=30]{{\color{\useKV[RectoKeys]{textColor}}{\fontsize{36pt}{43pt}\selectfont #1}}}; + \end{scope} + \begin{scope}[shift={(\cardwidth-13,\cardheight-76)}] + \draw[rotate=30, fill=white, color=white] (0,0) ellipse (8 and 5) node[rotate=210, color=black]{{\color{\useKV[RectoKeys]{textColor}}{\fontsize{36pt}{43pt}\selectfont #1}}}; + \end{scope} +} + + +\newcommand{\drawcardrecto}[2][]{ + \begin{tikzpicture} + \cardborder + \cardpadding + \cardcontent{#2} + \ifboolKV[RectoKeys]{corners}{ + \cardcorner{#2} + }{ + } + \end{tikzpicture}% +} + + +\newcommand{\drawcardverso}[2][]{ + \begin{tikzpicture}% + \cardpadding + \cardbackgroundverso{#2} + \end{tikzpicture} +} + + +\newcommand{\drawcardsverso}[2][]{ + \useKVdefault[VersoKeys]% + \setKV[VersoKeys]{#1}% + \ifboolKV[VersoKeys]{trame}{% + \foreach \k in {0,...,2}{% + \foreach \n in {0,...,2}{% + \noindent\drawcardverso{#2}% + }\\% + }% + }{% + \noindent\drawcardverso{#2}% + }% +} + +\newcommand{\drawcardsrecto}[2][] { + \useKVdefault[RectoKeys]% + \setKV[RectoKeys]{#1}% + \ifboolKV[RectoKeys]{trame}{ + \foreach \k in {0,...,2}{% + \foreach \n in {0,...,2}{% + \noindent\drawcardrecto{#2}% + }\\% + }% + }{ + \noindent\drawcardrecto{#2}% + }% +} |