From d49cf9a739fd1bdc969d4b21c88c068ef4438537 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 1 Aug 2022 20:22:14 +0000 Subject: customdice (1aug22) git-svn-id: svn://tug.org/texlive/trunk@64021 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/customdice/customdice.sty | 363 +++++++++++++++++++++ 1 file changed, 363 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/customdice/customdice.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/customdice/customdice.sty b/Master/texmf-dist/tex/latex/customdice/customdice.sty new file mode 100644 index 00000000000..870fb3ff141 --- /dev/null +++ b/Master/texmf-dist/tex/latex/customdice/customdice.sty @@ -0,0 +1,363 @@ +%% +%% This is file `customdice.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% customdice.dtx (with options: `customdice') +%% Copyright (c) 2022 Peter Rowlett +%% +%% The package is licenced under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ +\ProvidesPackage{customdice}[2022/07/31 customdice 1.0] + +\RequirePackage{tikz} +\RequirePackage{etoolbox} + +\makeatletter +\@ifundefined{customdicecoldefault}{} +{\PackageWarning{customdice}{command `customdicecoldefault' already defined}} +\@ifundefined{customdicebg}{} +{\PackageWarning{customdice}{command `customdicebg' already defined}} +\@ifundefined{customdicefg}{} +{\PackageWarning{customdice}{command `customdicefg' already defined}} +\@ifundefined{customdicebaseline}{} +{\PackageWarning{customdice}{command `customdicebaseline' already defined}} +\@ifundefined{setdicebaseline}{} +{\PackageWarning{customdice}{command `setdicebaseline' already defined}} +\@ifundefined{customdicefacesize}{} +{\PackageWarning{customdice}{command `customdicefacesize' already defined}} +\@ifundefined{customdicehalfway}{} +{\PackageWarning{customdice}{command `customdicehalfway' already defined}} +\@ifundefined{customdicelower}{} +{\PackageWarning{customdice}{command `customdicelower' already defined}} +\@ifundefined{customdiceupper}{} +{\PackageWarning{customdice}{command `customdiceupper' already defined}} +\@ifundefined{customdicedotsize}{} +{\PackageWarning{customdice}{command `customdicedotsize' already defined}} +\@ifundefined{customdicebigdotsize}{} +{\PackageWarning{customdice}{command `customdicebigdotsize' already defined}} +\@ifundefined{customdicecornerrounding}{} +{\PackageWarning{customdice}{command `customdicecornerrounding' already defined}} +\@ifundefined{customdiceborderthickness}{} +{\PackageWarning{customdice}{command `customdiceborderthickness' already defined}} +\@ifundefined{customdicetextscale}{} +{\PackageWarning{customdice}{command `customdicetextscale' already defined}} +\@ifundefined{setdicefacesize}{} +{\PackageWarning{customdice}{command `setdicefacesize' already defined}} +\@ifundefined{dice}{} +{\PackageWarning{customdice}{command `dice' already defined}} +\@ifundefined{bigdotdice}{} +{\PackageWarning{customdice}{command `bigdotdice' already defined}} +\@ifundefined{textdice}{} +{\PackageWarning{customdice}{command `textdice' already defined}} +\@ifundefined{textdicebot}{} +{\PackageWarning{customdice}{command `textdicebot' already defined}} +\@ifundefined{layoutdice}{} +{\PackageWarning{customdice}{command `layoutdice' already defined}} +\@ifundefined{tinydice}{} +{\PackageWarning{customdice}{command `tinydice' already defined}} +\@ifundefined{scriptsizedice}{} +{\PackageWarning{customdice}{command `scriptsizedice' already defined}} +\@ifundefined{footnotesizedice}{} +{\PackageWarning{customdice}{command `footnotesizedice' already defined}} +\@ifundefined{smalldice}{} +{\PackageWarning{customdice}{command `smalldice' already defined}} +\@ifundefined{normalsizedice}{} +{\PackageWarning{customdice}{command `normalsizedice' already defined}} +\@ifundefined{largedice}{} +{\PackageWarning{customdice}{command `largedice' already defined}} +\@ifundefined{Largedice}{} +{\PackageWarning{customdice}{command `Largedice' already defined}} +\@ifundefined{LARGEdice}{} +{\PackageWarning{customdice}{command `LARGEdice' already defined}} +\@ifundefined{hugedice}{} +{\PackageWarning{customdice}{command `hugedice' already defined}} +\@ifundefined{Hugedice}{} +{\PackageWarning{customdice}{command `Hugedice' already defined}} +\@ifundefined{tinybigdotdice}{} +{\PackageWarning{customdice}{command `tinybigdotdice' already defined}} +\@ifundefined{scriptsizebigdotdice}{} +{\PackageWarning{customdice}{command `scriptsizebigdotdice' already defined}} +\@ifundefined{footnotesizebigdotdice}{} +{\PackageWarning{customdice}{command `footnotesizebigdotdice' already defined}} +\@ifundefined{smallbigdotdice}{} +{\PackageWarning{customdice}{command `smallbigdotdice' already defined}} +\@ifundefined{normalsizebigdotdice}{} +{\PackageWarning{customdice}{command `normalsizebigdotdice' already defined}} +\@ifundefined{largebigdotdice}{} +{\PackageWarning{customdice}{command `largebigdotdice' already defined}} +\@ifundefined{Largebigdotdice}{} +{\PackageWarning{customdice}{command `Largebigdotdice' already defined}} +\@ifundefined{LARGEbigdotdice}{} +{\PackageWarning{customdice}{command `LARGEbigdotdice' already defined}} +\@ifundefined{hugebigdotdice}{} +{\PackageWarning{customdice}{command `hugebigdotdice' already defined}} +\@ifundefined{Hugebigdotdice}{} +{\PackageWarning{customdice}{command `Hugebigdotdice' already defined}} +\@ifundefined{tinytextdice}{} +{\PackageWarning{customdice}{command `tinytextdice' already defined}} +\@ifundefined{scriptsizetextdice}{} +{\PackageWarning{customdice}{command `scriptsizetextdice' already defined}} +\@ifundefined{footnotesizetextdice}{} +{\PackageWarning{customdice}{command `footnotesizetextdice' already defined}} +\@ifundefined{smalltextdice}{} +{\PackageWarning{customdice}{command `smalltextdice' already defined}} +\@ifundefined{normalsizetextdice}{} +{\PackageWarning{customdice}{command `normalsizetextdice' already defined}} +\@ifundefined{largetextdice}{} +{\PackageWarning{customdice}{command `largetextdice' already defined}} +\@ifundefined{Largetextdice}{} +{\PackageWarning{customdice}{command `Largetextdice' already defined}} +\@ifundefined{LARGEtextdice}{} +{\PackageWarning{customdice}{command `LARGEtextdice' already defined}} +\@ifundefined{hugetextdice}{} +{\PackageWarning{customdice}{command `hugetextdice' already defined}} +\@ifundefined{Hugetextdice}{} +{\PackageWarning{customdice}{command `Hugetextdice' already defined}} +\@ifundefined{tinytextdicebot}{} +{\PackageWarning{customdice}{command `tinytextdicebot' already defined}} +\@ifundefined{scriptsizetextdicebot}{} +{\PackageWarning{customdice}{command `scriptsizetextdicebot' already defined}} +\@ifundefined{footnotesizetextdicebot}{} +{\PackageWarning{customdice}{command `footnotesizetextdicebot' already defined}} +\@ifundefined{smalltextdicebot}{} +{\PackageWarning{customdice}{command `smalltextdicebot' already defined}} +\@ifundefined{normalsizetextdicebot}{} +{\PackageWarning{customdice}{command `normalsizetextdicebot' already defined}} +\@ifundefined{largetextdicebot}{} +{\PackageWarning{customdice}{command `largetextdicebot' already defined}} +\@ifundefined{Largetextdicebot}{} +{\PackageWarning{customdice}{command `Largetextdicebot' already defined}} +\@ifundefined{LARGEtextdicebot}{} +{\PackageWarning{customdice}{command `LARGEtextdicebot' already defined}} +\@ifundefined{hugetextdicebot}{} +{\PackageWarning{customdice}{command `hugetextdicebot' already defined}} +\@ifundefined{Hugetextdicebot}{} +{\PackageWarning{customdice}{command `Hugetextdicebot' already defined}} +\makeatother + +\newcommand{\customdicecoldefault}{f40fc2340eb940fc8a170db0f81d7139} % using a UUID so we are extremely unlikely to clash with any user-specified colour name +\global\let\customdicebg\customdicecoldefault +\global\let\customdicefg\customdicecoldefault +\newcommand{\customdicebaseline}{0.02} +\newcommand{\setdicebaseline}[1]{% + \renewcommand{\customdicebaseline}{#1}% +} +\newcommand{\customdicefacesize}{1.65} +\newcommand{\customdicehalfway}{0.825} +\newcommand{\customdicelower}{0.4} +\newcommand{\customdiceupper}{1.25} +\newcommand{\customdicedotsize}{0.12} +\newcommand{\customdicebigdotsize}{0.45} +\newcommand{\customdicecornerrounding}{0.2} +\newcommand{\customdiceborderthickness}{0.1} +\newcommand{\customdicetextscale}{0.6} +\newcommand{\setdicefacesize}[1]{% + \renewcommand{\customdicefacesize}{#1}% + \pgfmathsetmacro{\customdicehalfway}{#1/2}% + \pgfmathsetmacro{\customdicelower}{#1*0.425/1.65}% + \pgfmathsetmacro{\customdiceupper}{#1*1.25/1.65}% + \pgfmathsetmacro{\customdicedotsize}{#1*0.12/1.65}% + \pgfmathsetmacro{\customdicebigdotsize}{#1*0.45/1.65}% + \pgfmathsetmacro{\customdicecornerrounding}{#1*0.2/1.65}% + \pgfmathsetmacro{\customdiceborderthickness}{#1*0.1/1.65}% + \pgfmathsetmacro{\customdicetextscale}{#1*0.6/1.65}% +} + +\newenvironment{customdiceenv}[1][white,black]{% + \foreach \colour in {#1}{% + \ifdefequal{\customdicebg}{\customdicecoldefault}{\global\let\customdicebg\colour}{\global\let\customdicefg\colour}% + }% + \begin{tikzpicture}[baseline=\customdicebaseline ex] + \draw[rounded corners=\customdicecornerrounding ex,darkgray,fill=\customdicebg,line width=\customdiceborderthickness ex] (0ex,0ex) rectangle (\customdicefacesize ex,\customdicefacesize ex); +}{\end{tikzpicture}% + \global\let\customdicebg\customdicecoldefault% + \global\let\customdicefg\customdicecoldefault% +} + +\newcommand{\dice}[2][white,black]{% + \begin{customdiceenv}[#1] + \ifnumequal{#2}{1}{ + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicehalfway ex,\customdicehalfway ex) {}; + }{\ifnumequal{#2}{2}{ + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdiceupper ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdicelower ex) {}; + }{\ifnumequal{#2}{3}{ + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdicelower ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicehalfway ex,\customdicehalfway ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdiceupper ex) {}; + }{\ifnumequal{#2}{4}{ + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdicelower ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdiceupper ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdicelower ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdiceupper ex) {}; + }{\ifnumequal{#2}{5}{ + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdicelower ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdiceupper ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicehalfway ex,\customdicehalfway ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdicelower ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdiceupper ex) {}; + }{\ifnumequal{#2}{6}{ + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdicelower ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdicehalfway ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdicelower ex,\customdiceupper ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdicelower ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdicehalfway ex) {}; + \node[circle,fill=\customdicefg,inner sep=\customdicedotsize ex] at (\customdiceupper ex,\customdiceupper ex) {}; + }{}}}}}} + \end{customdiceenv}% +} + +\newcommand{\bigdotdice}[1][white,black]{% + \begin{customdiceenv}[#1] + \node[circle,fill=\customdicefg,inner sep=\customdicebigdotsize ex] at (\customdicehalfway ex,\customdicehalfway ex) {}; + \end{customdiceenv}% +} + +\newcommand{\textdice}[2][white,black]{% + \begin{customdiceenv}[#1] + \node[\customdicefg,inner sep=0,scale=\customdicetextscale] at (\customdicehalfway ex,\customdicehalfway ex) {#2}; + \end{customdiceenv}% +} + +\newcommand{\textdicebot}[2][white,black]{% + \begin{customdiceenv}[#1] + \node[\customdicefg,inner sep=0,scale=\customdicetextscale] at (\customdicehalfway ex,\customdicehalfway ex) {#2}; + \draw[line width=\customdiceborderthickness ex,\customdicefg] (\customdicelower ex,\customdicecornerrounding ex) --(\customdiceupper ex,\customdicecornerrounding ex); + \end{customdiceenv}% +} + +\newcommand{\layoutdice}[6]{% + \setlength{\tabcolsep}{0pt}% + \renewcommand{\arraystretch}{0}% + \begin{tabular}{ccc} + ~ & #1 & ~\\ + #4 & #2 & #3\\ + ~ & #6 & ~\\ + ~ & #5 & ~\\ + \end{tabular}% +} + +\newcommand{\tinydice}[2][white,black]{% + {\tiny\dice[#1]{#2}} +} +\newcommand{\scriptsizedice}[2][white,black]{% + {\scriptsize\dice[#1]{#2}} +} +\newcommand{\footnotesizedice}[2][white,black]{% + {\footnotesize\dice[#1]{#2}} +} +\newcommand{\smalldice}[2][white,black]{% + {\small\dice[#1]{#2}} +} +\newcommand{\normalsizedice}[2][white,black]{% + {\normalsize\dice[#1]{#2}} +} +\newcommand{\largedice}[2][white,black]{% + {\large\dice[#1]{#2}} +} +\newcommand{\Largedice}[2][white,black]{% + {\Large\dice[#1]{#2}} +} +\newcommand{\LARGEdice}[2][white,black]{% + {\LARGE\dice[#1]{#2}} +} +\newcommand{\hugedice}[2][white,black]{% + {\huge\dice[#1]{#2}} +} +\newcommand{\Hugedice}[2][white,black]{% + {\Huge\dice[#1]{#2}} +} +\newcommand{\tinybigdotdice}[1][white,black]{% + {\tiny\bigdotdice[#1]} +} +\newcommand{\scriptsizebigdotdice}[1][white,black]{% + {\scriptsize\bigdotdice[#1]} +} +\newcommand{\footnotesizebigdotdice}[1][white,black]{% + {\footnotesize\bigdotdice[#1]} +} +\newcommand{\smallbigdotdice}[1][white,black]{% + {\small\bigdotdice[#1]} +} +\newcommand{\normalsizebigdotdice}[1][white,black]{% + {\normalsize\bigdotdice[#1]} +} +\newcommand{\largebigdotdice}[1][white,black]{% + {\large\bigdotdice[#1]} +} +\newcommand{\LARGEbigdotdice}[1][white,black]{% + {\LARGE\bigdotdice[#1]} +} +\newcommand{\Largebigdotdice}[1][white,black]{% + {\Large\bigdotdice[#1]} +} +\newcommand{\hugebigdotdice}[1][white,black]{% + {\huge\bigdotdice[#1]} +} +\newcommand{\Hugebigdotdice}[1][white,black]{% + {\Huge\bigdotdice[#1]} +} +\newcommand{\tinytextdice}[2][white,black]{% + {\tiny\textdice[#1]{#2}} +} +\newcommand{\scriptsizetextdice}[2][white,black]{% + {\scriptsize\textdice[#1]{#2}} +} +\newcommand{\footnotesizetextdice}[2][white,black]{% + {\footnotesize\textdice[#1]{#2}} +} +\newcommand{\smalltextdice}[2][white,black]{% + {\small\textdice[#1]{#2}} +} +\newcommand{\normalsizetextdice}[2][white,black]{% + {\normalsize\textdice[#1]{#2}} +} +\newcommand{\largetextdice}[2][white,black]{% + {\large\textdice[#1]{#2}} +} +\newcommand{\Largetextdice}[2][white,black]{% + {\Large\textdice[#1]{#2}} +} +\newcommand{\LARGEtextdice}[2][white,black]{% + {\LARGE\textdice[#1]{#2}} +} +\newcommand{\hugetextdice}[2][white,black]{% + {\huge\textdice[#1]{#2}} +} +\newcommand{\Hugetextdice}[2][white,black]{% + {\Huge\textdice[#1]{#2}} +} +\newcommand{\tinytextdicebot}[2][white,black]{% + {\tiny\textdicebot[#1]{#2}} +} +\newcommand{\scriptsizetextdicebot}[2][white,black]{% + {\scriptsize\textdicebot[#1]{#2}} +} +\newcommand{\footnotesizetextdicebot}[2][white,black]{% + {\footnotesize\textdicebot[#1]{#2}} +} +\newcommand{\smalltextdicebot}[2][white,black]{% + {\small\textdicebot[#1]{#2}} +} +\newcommand{\normalsizetextdicebot}[2][white,black]{% + {\normalsize\textdicebot[#1]{#2}} +} +\newcommand{\largetextdicebot}[2][white,black]{% + {\large\textdicebot[#1]{#2}} +} +\newcommand{\Largetextdicebot}[2][white,black]{% + {\Large\textdicebot[#1]{#2}} +} +\newcommand{\LARGEtextdicebot}[2][white,black]{% + {\LARGE\textdicebot[#1]{#2}} +} +\newcommand{\hugetextdicebot}[2][white,black]{% + {\huge\textdicebot[#1]{#2}} +} +\newcommand{\Hugetextdicebot}[2][white,black]{% + {\Huge\textdicebot[#1]{#2}} +} +\endinput +%% +%% End of file `customdice.sty'. -- cgit v1.2.3