texlive[52009] Master/texmf-dist: ddphonism (1sep19)
commits+karl at tug.org
commits+karl at tug.org
Sun Sep 1 23:36:04 CEST 2019
Revision: 52009
http://tug.org/svn/texlive?view=revision&revision=52009
Author: karl
Date: 2019-09-01 23:36:04 +0200 (Sun, 01 Sep 2019)
Log Message:
-----------
ddphonism (1sep19)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/ddphonism/README.md
trunk/Master/texmf-dist/doc/latex/ddphonism/ddphonism.pdf
trunk/Master/texmf-dist/doc/latex/ddphonism/ddphonism.tex
trunk/Master/texmf-dist/tex/latex/ddphonism/ddphonism.sty
Modified: trunk/Master/texmf-dist/doc/latex/ddphonism/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/ddphonism/README.md 2019-09-01 21:35:52 UTC (rev 52008)
+++ trunk/Master/texmf-dist/doc/latex/ddphonism/README.md 2019-09-01 21:36:04 UTC (rev 52009)
@@ -1,11 +1,11 @@
The ddphonism package
Celia Rubio Madrigal
-2019/08/10
+2019/09/01
__________________
Overview
-This is a music-related package which is focused on notation from the Twelve-Tone System, also called Dodecaphonism. It provides LaTeX algorithms that produce typical T.T.S. notation based off a musical series, or row sequence, of variable length.
+This is a music-related package focused on notation from the Twelve-Tone System, also called Dodecaphonism. It provides LaTeX algorithms that produce typical dodecaphonic diagrams based off a musical series, or row sequence, of variable length.
__________________
Change history
@@ -13,6 +13,9 @@
Version 0.1 (2019/08/10)
- Initial public release
+Version 0.2 (2019/09/01)
+- Added several new features and options
+
__________________
License
Modified: trunk/Master/texmf-dist/doc/latex/ddphonism/ddphonism.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/ddphonism/ddphonism.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/ddphonism/ddphonism.tex 2019-09-01 21:35:52 UTC (rev 52008)
+++ trunk/Master/texmf-dist/doc/latex/ddphonism/ddphonism.tex 2019-09-01 21:36:04 UTC (rev 52009)
@@ -7,9 +7,9 @@
\usepackage{ddphonism}
\title{The \textsf{ddphonism} package\footnote{This
- document corresponds to \textsf{ddphonism} v0.1, dated 2019/08/10.}}
+ document corresponds to \textsf{ddphonism} v0.2, dated 2019/09/01.}}
\author{Celia Rubio Madrigal\footnote{Email: \href{mailto:celrubio at ucm.es}{\texttt{celrubio at ucm.es}}}}
-\date{August 10, 2019}
+\date{September 1, 2019}
\begin{document}
@@ -17,13 +17,13 @@
\maketitle
\begin{abstract}
- This is a music-related package which is focused on notation from the Twelve-Tone System, also called Dodecaphonism. It provides \LaTeX{} algorithms that produce typical T.T.S. notation based off a musical series, or row sequence, of variable length.
+ This is a music-related package focused on notation from the Twelve-Tone System, also called Dodecaphonism. It provides \LaTeX{} algorithms that produce typical dodecaphonic diagrams based off a musical series, or row sequence, of variable length.
\begin{center}
\textbf{Keywords}
\end{center}
- \textit{twelve tone system, dodecaphonism, music, mathematics, matrix, row, series, diagram, clock diagram, notation, algorithm, schoenberg, contemporary music, 20th century}
+ \textit{twelve tone system, dodecaphonism, music, mathematics, matrix, row, series, permutation, diagram, clock diagram, notation, algorithm, schoenberg, contemporary music, 20th century}
\end{abstract}
\tableofcontents
@@ -33,16 +33,16 @@
It is said that a twelve-tone matrix is the only thing a twelve-tone composer should need, because it provides the whole serial spectrum with which they may work. I wanted \LaTeX{} users to be able to generate them automatically.
- But I also think that a twelve-tone matrix is not enough, that there exist several other notations with which they may understand their series and its potential. These are the diagrams that can be obtained with this package.
+ But I also think that a twelve-tone matrix is not enough, that there exist several other notations with which they may understand their series and their potential. These are the diagrams that can be obtained with this package:
\begin{multicols}{2}
- \dmatrix{0,1,2,3,4}
+ \dmatrix{4,3,2,1,0}
- \tikz{\ddihedral{4,5,7,1,6,3,8,2,11,0,9,10}}
+ \ddihedral{4,5,7,1,6,3,8,2,11,0,9,10}
- \ddiagram{4,5,7,1,6,3,8,2,11,0,9,10}{}
+ \ddiagram[arrow shift = 4]{4,5,7,1,6,3,8,2,11,0,9,10}
- \tikz{\darrows{4,5,7,1,6,3,8,2,11,0,9,10}}
+ \darrows{4,5,7,1,6,3,8,2,11,0,9,10}
\bigskip
\drow{4,3,2,1,0}
@@ -49,40 +49,124 @@
\end{multicols}
\section{Using the \textsf{ddphonism} package}
- These are the commands provided by \textsf{ddphonism}:
+ These are the commands provided by \textsf{ddphonism}. The main parameter in every command is the row sequence.
- \newcommand{\I}[1]{\item[\texttt{$\backslash$#1}]\quad}
+ \newcommand{\I}[1]{\item[\texttt{$\backslash$#1}]\quad}
+ \newcommand{\Ii}[1]{\item[\textsf{#1}]\quad}
\begin{itemize}
- \I{dmatrix} produces a twelve-tone matrix of arbitrary length, as shown in \href{https:matrices.netlify.com}{this website}. Its parameter is the row sequence. For example, \verb|\dmatrix{0,2,1,4,3,6,5}| produces the matrix \dmatrix{0,2,1,4,3,6,5}
+ \I{dmatrix} produces a twelve-tone matrix of arbitrary length, as shown in \href{https:matrices.netlify.com}{this website}. For example, \verb|\dmatrix{0,2,1,4,3,6,5}| produces the matrix \dmatrix{0,2,1,4,3,6,5}
- The command automatically reduces the input and output modulus the length of the input series. Thus, the input \verb|\dmatrix{7,9,8,11,10,13,12}| produces the same output as before.
+ \begin{itemize}
+ \Ii{sep} scales the matrix.
+ \Ii {vsep} scales the matrix vertically.
+ \Ii {hsep} scales the matrix horizontally.
+ \Ii{lines} draws lines between rows and columns.
+ \Ii{outside lines} only draws the outside lines.
+ \Ii{inside lines} only draws the inside lines.
+ \Ii{vlines} only draws the vertical lines.
+ \Ii{hlines} only draws the horizontal lines.
+ \end{itemize}
+ \verb|\dmatrix[lines,sep=0.75]{0,2,1,4,3,6,5}| produces the matrix
- \I{ddiagram} produces a twelve tone clock diagram of arbitrary length, as shown in \href{https:diagramas.netlify.com}{this website}. Its parameters are the row sequence and its name. An additional optional parameter tells which number must be up north. The default value is the first number. For example, \verb|\ddiagram{0,2,1,4,3,6,5}{P}| produces the diagram \ddiagram{0,2,1,4,3,6,5}{P}
-
- and \verb|\ddiagram[3]{0,1,2,3,4}{P}| produces the diagram \ddiagram[3]{0,2,1,4,3,6,5}{P}
-
- The command also reduces the input and output modulus the length of the input series.
+ \dmatrix[lines,sep=0.75]{0,2,1,4,3,6,5}
- \I{ddihedral} produces a dihedral representation of a series of arbitrary length. Its parameters are the original row sequence and, optionally, the transformations it undergoes: \texttt{t,s,c,v} applied in that order. For example,\\ \verb|\tikz{\ddihedral[t=2,v=1]{0,2,1,4,3,6,5}}| produces the diagram\\ \tikz{\ddihedral[t=2,v=1]{0,2,1,4,3,6,5}}
-
- It needs to be inside a \texttt{tikz} environment, as opposed to the previous ones, which are separate \texttt{tikz} environments on their own. This is because rotation or translation lines are sometimes included in this diagram, and sometimes it needs scalings.
-
- The command also reduces the input and output modulus the length of the input series.
+ \begin{itemize}
+ \Ii{no tikz} deletes the tikz environment and lets the user write it instead.
+ \end{itemize}
+ \I{ddiagram} produces a twelve tone clock diagram of arbitrary length, as shown in \href{https:diagramas.netlify.com}{this website}. For example, \verb|\ddiagram{0,2,1,4,3,6,5}| produces the diagram\\
+ \ddiagram{0,2,1,4,3,6,5}
+
+ \begin{itemize}
+ \Ii{name} writes a name at the center of the diagram.
+ \Ii{up} lets the user choose which number is up north. The default value is the first number in the row.
+ \Ii{arrow shift} lets the user choose where the arrow should fall on the line. The values range from 0 to 10. The default value is 2.5.
+ \end{itemize}
+
+ \verb|\ddiagram[name=P, up=5, arrow shift=5]{0,2,1,4,3,6,5}| produces the diagram\\
+ \ddiagram[name=P, up=5, arrow shift=5]{0,2,1,4,3,6,5}
+
+
+ \begin{itemize}
+ \Ii{no numbers} deletes the numbers around the diagram.
+ \Ii{no arrow} deletes the arrow inside the diagram.
+ \end{itemize}
+
+ \verb|\ddiagram[no numbers, no arrow]{0,2,1,4,3,6,5}| produces the diagram\\
+ \ddiagram[no numbers, no arrow]{0,2,1,4,3,6,5}
+
+ \begin{itemize}
+ \Ii{xshift} shifts the figure horizontally.
+ \Ii{yshift} shifts the figure vertically.
+ \Ii{no tikz} deletes the tikz environment and lets the user write it instead.
+ The option \textsf{up} does not work anymore and the up position becomes 0.
+ It is recommended that the user passes the option \textsf{ddiagram} to the environment:
+ \begin{verbatim}
+ \begin{tikzpicture}[ddiagram]
+ \ddiagram[no tikz]{0,2,1,4,3,6,5}
+ \end{tikzpicture}
+ \end{verbatim} produces the same diagram as \verb|\ddiagram{0,2,1,4,3,6,5}|.
+ \end{itemize}
+
+ \I{ddihedral} produces a dihedral representation of a series of arbitrary length. For example, \verb|\ddihedral{0,2,1,4,3,6,5}| produces the diagram\\
+ \ddihedral{0,2,1,4,3,6,5}
+
+ \begin{itemize}
+ \Ii{t} applies the transformation \textit{transposition} to the diagram.
+ \Ii{s} applies the transformation \textit{inversion} to the diagram.
+ \Ii{c} applies the transformation \textit{cyclic shift} to the diagram.
+ \Ii{v} applies the transformation \textit{retrograde} to the diagram.
+
+ The transformations are applied in that exact order.
+ \end{itemize}
+
+ \verb|\ddihedral[s=1, c=4]{0,2,1,4,3,6,5}| produces the diagram\\
+ \ddihedral[s=1, c=4]{0,2,1,4,3,6,5}
+
+ \begin{itemize}
+ \Ii{no italics} removes the italics from the diagram name.
+ \Ii{new t} renames the transformation \textit{transposition}.
+ \Ii{new s} renames the transformation \textit{inversion}.
+ \Ii{new c} renames the transformation \textit{cyclic shift}.
+ \Ii{new v} renames the transformation \textit{retrograde}.
+ \end{itemize}
+
+ \verb|\ddihedral[no italics, new v=R, v=1]{0,2,1,4,3,6,5}| produces the diagram\\
+ \ddihedral[no italics, new v=R, v=1]{0,2,1,4,3,6,5}
+
+ \begin{itemize}
+ \Ii{no tikz} deletes the tikz environment and lets the user write it instead. It is recommended that the user passes the option \textsf{ddihedral} to the environment:
+ \begin{verbatim}
+ \begin{tikzpicture}[ddihedral]
+ \ddihedral[no tikz]{0,2,1,4,3,6,5}
+ \end{tikzpicture}
+ \end{verbatim} produces the same diagram as \verb|\ddihedral{0,2,1,4,3,6,5}|.
+ \end{itemize}
+
\I{darrows} produces the arrows from the \verb|\ddihedral| diagram. For example,
- \verb|\tikz{\darrows{0,2,1,4,3,6,5}}| produces the arrows\\
- \tikz{\darrows{0,2,1,4,3,6,5}}
+ \verb|\darrows{0,2,1,4,3,6,5}| produces the arrows\\
+ \darrows{0,2,1,4,3,6,5}
+
+ \begin{itemize}
+ \Ii{no tikz} deletes the tikz environment and lets the user write it instead.
+ \end{itemize}
\I{drow} produces a twelve-tone row sequence as a permutation in its matrix form. For example, \verb|\drow{0,2,1,4,3,6,5}| produces the row
\drow{0,2,1,4,3,6,5}
+ \begin{itemize}
+ \Ii{sep} lets the user choose the column separation.
+ \end{itemize}
+
+ \verb|\drow[sep=10pt]{0,2,1,4,3,6,5}| produces the row
+
+ \drow[sep=10pt]{0,2,1,4,3,6,5}
+
\end{itemize}
\section{The package code}
\lstset{
-% frame=lines,
- %
language=[Latex]Tex,
%
basicstyle=\footnotesize\sffamily,
Modified: trunk/Master/texmf-dist/tex/latex/ddphonism/ddphonism.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ddphonism/ddphonism.sty 2019-09-01 21:35:52 UTC (rev 52008)
+++ trunk/Master/texmf-dist/tex/latex/ddphonism/ddphonism.sty 2019-09-01 21:36:04 UTC (rev 52009)
@@ -5,12 +5,12 @@
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
-
+
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ddphonism}
-[2019/08/10 v0.1 LaTeX package for twelve-tone matrices, clock diagrams et al.]
+[2019/09/01 v0.2 Dodecaphonic diagrams: twelve-tone matrices, clock diagrams, etc.]
-\RequirePackage{ifthen}
+\RequirePackage{etoolbox}
\RequirePackage{xparse}
\RequirePackage{tikz}
\RequirePackage{xstring}
@@ -26,88 +26,215 @@
\DeclareExpandableDocumentCommand{\Evaluation}{m}{\int_eval:n {#1}}
\ExplSyntaxOff
-\newcounter{Dfirst}
\newcounter{Dsize}
+\newcommand{\DsizeMake}[1]{%
+ \setcounter{Dsize}{0}%
+ \foreach \n in {#1}{%
+ \stepcounter{Dsize}%
+ }%
+}
-\newcommand{\DsizeHead}[1]{
- \setcounter{Dsize}{0}
- \setcounter{Dfirst}{-1}
-
- \foreach \n in {#1}{
- \ifnum\theDfirst=-1
- \setcounter{Dfirst}{\n}
- \fi
- \stepcounter{Dsize}
+% Only with numbers.
+\newcounter{Dfirst}
+\newcommand{\DheadMake}[1]{%
+ \setcounter{Dfirst}{-1}%
+ \foreach \n in {#1}{%
+ \ifnum\theDfirst=-1%
+ \setcounter{Dfirst}{\n}%
+ \fi%
+ }%
+}
+
+% Only when DsizeMake is already done.
+\newcounter{Dmod}
+\newcommand{\Modulo}[1]{%
+ \setcounter{Dmod}{#1}%
+ \loop%
+ \ifnum\theDmod>\Evaluation{\theDsize-1}%
+ \setcounter{Dmod}{\Evaluation{\theDmod-\theDsize}}%
+ \repeat%
+ \ifnum\theDmod<0%
+ \setcounter{Dmod}{\Evaluation{\theDmod+\theDsize}}%
+ \repeat%
+ \theDmod%
+}
+
+\newif\ifdmatrixLines
+\newif\ifdmatrixOutside
+\newif\ifdmatrixInside
+\newif\ifdmatrixV
+\newif\ifdmatrixH
+\newif\ifdmatrixTikz
+\pgfkeys{
+ /dmatrix/.is family
+ , /dmatrix
+ , default/.style =
+ { lines = false
+ , outside lines = false
+ , inside lines = false
+ , sep = 1
+ , vsep = 1
+ , hsep = 1
+ , no tikz = false
}
+ , no tikz/.is if=dmatrixTikz
+ , lines/.is if=dmatrixLines
+ , outside lines/.is if=dmatrixOutside
+ , inside lines/.is if=dmatrixInside
+ , vlines/.is if=dmatrixV
+ , hlines/.is if=dmatrixH
+ , sep/.estore in=\dmatrixSep
+ , vsep/.estore in=\dmatrixVsep
+ , hsep/.estore in=\dmatrixHsep
}
-\newcommand{\Modulo}[1]{
- \ifnum#1>\Evaluation{\theDsize-1}
- \Evaluation{#1-\theDsize}
- \else\ifnum#1<0
- \Evaluation{#1+\theDsize}
- \else #1
- \fi\fi
+\newcommand{\DLOH}{%
+ \draw (0.05*\dmatrixSep*\dmatrixHsep,0) --%
+ (\theDsize*\dmatrixSep*\dmatrixHsep+0.05*\dmatrixSep*\dmatrixHsep,0);%
+ \draw (0.05*\dmatrixSep*\dmatrixHsep,-\theDsize*0.5*\dmatrixSep*\dmatrixVsep) -- %
+ (\theDsize*\dmatrixSep*\dmatrixHsep+0.05*\dmatrixSep*\dmatrixHsep,-\theDsize*0.5*\dmatrixSep*\dmatrixVsep);%
}
-\newcommand{\dmatrix}[1]{
- \DsizeHead{#1}
- \begin{tikzpicture}
- \foreach [count=\nj] \j in {#1} {
- \foreach [count=\ni] \i in {#1} {
- \draw node at (\ni-0.5,-\nj/2+0.25) {
- \Modulo{\Evaluation{\i-\j+\theDfirst}}
- };
- }
- }
- \end{tikzpicture}
+\newcommand{\DLOV}{%
+ \draw (0.05*\dmatrixSep*\dmatrixHsep,0) -- %
+ (0.05*\dmatrixSep*\dmatrixHsep,-\theDsize*0.5*\dmatrixSep*\dmatrixVsep);%
+ \draw (\theDsize*\dmatrixSep*\dmatrixHsep+0.05*\dmatrixSep*\dmatrixHsep,0) -- %
+ (\theDsize*\dmatrixSep*\dmatrixHsep+0.05*\dmatrixSep*\dmatrixHsep,-\theDsize*0.5*\dmatrixSep*\dmatrixVsep);
}
+\newcommand{\DLIH}{%
+ \draw (0.05*\dmatrixSep*\dmatrixHsep,-\xD*0.5*\dmatrixSep*\dmatrixVsep) -- %
+ (\theDsize*\dmatrixSep*\dmatrixHsep+0.05*\dmatrixSep*\dmatrixHsep,-\xD*0.5*\dmatrixSep*\dmatrixVsep);%
+}
+\newcommand{\DLIV}{%
+ \draw (\xD*\dmatrixSep*\dmatrixHsep+0.05*\dmatrixSep*\dmatrixHsep,0) -- %
+ (\xD*\dmatrixSep*\dmatrixHsep+0.05*\dmatrixSep*\dmatrixHsep,-\theDsize*0.5*\dmatrixSep*\dmatrixVsep);%
+}
+
+\newcommand{\dmatrix}[2][]{%
+ \DsizeMake{#2}%
+ \DheadMake{#2}%
+ %
+ \pgfkeys{/dmatrix, default, #1}%
+ %
+ \ifdmatrixTikz\else%
+ \begin{tikzpicture}%
+ \fi%
+ \foreach [count=\nj] \j in {#2} {%
+ \foreach [count=\ni] \i in {#2} {%
+ \draw node at
+ ( \ni*\dmatrixSep*\dmatrixHsep-0.5*\dmatrixSep*\dmatrixHsep
+ , -\nj*\dmatrixSep*\dmatrixVsep/2+0.25*\dmatrixSep*\dmatrixVsep) {%
+ \Modulo{\Evaluation{\i-\j+\theDfirst}}%
+ };%
+ }%
+ }%
+ \foreach \xD in {1,...,\Evaluation{\theDsize-1}} {%
+ \ifdmatrixLines
+ \DLOH\DLOV\DLIH\DLIV
+ \fi
+ \ifdmatrixOutside
+ \DLOH\DLOV
+ \fi
+ \ifdmatrixInside
+ \DLIH\DLIV
+ \fi
+ \ifdmatrixH
+ \DLOH\DLIH
+ \fi
+ \ifdmatrixV
+ \DLOV\DLIV
+ \fi
+ }%
+ %
+ \ifdmatrixTikz\else%
+ \end{tikzpicture}%
+ \fi%
+}
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Diagrams
\usetikzlibrary{shapes,arrows,decorations.markings,shapes.misc}
-\tikzstyle ddiagramArrow=[decoration=
- {markings,mark=at position 0.25 with
- {\arrow[scale=1.25,>=triangle 45]{>}}},
- postaction={decorate}]
+\tikzstyle{ddiagram}=[minimum height=0pt,inner sep=0pt,outer sep=0pt,scale=0.65]
-\newcounter{anterior}
-\newcounter{var}
-\newcommand{\ddiagram}[3][-1]{
- \DsizeHead{#2}
- \def\theDDfirst{\Evaluation{\Modulo{\theDfirst}}}
-
- \ifnum #1=-1
- \setcounter{var}{\theDDfirst}
- \else
- \setcounter{var}{#1}
- \fi
-
- \begin{tikzpicture}[rotate=360*\thevar/\theDsize,
- minimum height=0pt,inner sep=0pt,outer sep=0pt,scale=0.65]
- \foreach \x in {0,...,\Evaluation{\theDsize-1}} {
- \node at (90-360*\x/\theDsize:2) {\x};
- \node (\x) at (90-360*\x/\theDsize:1.6) {};
- };
-
- \setcounter{anterior}{-1}
- \foreach \xD in {#2}{
- \def\x{\Evaluation{\Modulo{\xD}}}
- \ifnum \theanterior=\theDDfirst
- \draw [style=ddiagramArrow] (\theanterior) -- (\x);
- \else \ifnum \theanterior=-1
+\newif\ifddiagramTikz
+\newif\ifddiagramNoNum
+\newif\ifddiagramNoArr
+\pgfkeys{
+ /ddiagram/.is family
+ , /ddiagram
+ , default/.style =
+ { name =\empty%
+ , up =\empty%
+ , no tikz = false
+ , no numbers = false
+ , no arrow = false
+ , xshift = 0
+ , yshift = 0
+ , arrow shift = 2.5
+ }
+ , no tikz/.is if=ddiagramTikz
+ , no numbers/.is if=ddiagramNoNum
+ , no arrow/.is if=ddiagramNoArr
+ , name/.estore in=\ddiagramName
+ , up/.estore in=\ddiagramUp
+ , xshift/.estore in=\ddiagramX
+ , yshift/.estore in=\ddiagramY
+ , arrow shift/.estore in=\ddiagramArrS
+}
+
+\newcounter{Dprev}
+\newcommand{\Dvar}{}
+\newcommand{\ddiagram}[2][]{%
+ \DsizeMake{#2}%
+ \DheadMake{#2}%
+ %
+ \pgfkeys{/ddiagram, default, #1}%
+ %
+ \ifdefequal{\ddiagramUp}{\empty}%
+ {\renewcommand{\Dvar}{\theDfirst}}% if empty
+ {\renewcommand{\Dvar}{\ddiagramUp}}% if not empty
+ %
+ \ifddiagramTikz\else%
+ \begin{tikzpicture}[ddiagram,rotate=360*\Dvar/\theDsize]%
+ \fi%
+ \foreach \x in {0,...,\Evaluation{\theDsize-1}} {%
+ \ifddiagramNoNum\else
+ \node [xshift=\ddiagramX,yshift=\ddiagramY] at (90-360*\x/\theDsize:2) {\x};%
+ \fi
+ \node [xshift=\ddiagramX,yshift=\ddiagramY] (\x) at (90-360*\x/\theDsize:1.6) {};%
+ };%
+ %
+ \setcounter{Dprev}{-1}%
+ \foreach \x in {#2}{%
+ \ifnum \theDprev=\theDfirst%
+ \ifddiagramNoArr
+ \draw [xshift=\ddiagramX,yshift=\ddiagramY] (\theDprev) -- (\x);%
\else
- \draw (\theanterior) -- (\x);
- \fi\fi
- \setcounter{anterior}{\x}
- };
- \draw (\theanterior) -- (\theDDfirst);
-
- \node at (0,0) [circle,fill=white] {#3};
- \end{tikzpicture}
+ \draw [xshift=\ddiagramX,yshift=\ddiagramY,
+ decoration=
+ {markings,mark=at position 0.099*\ddiagramArrS with
+ {\arrow[scale=1.25,>=triangle 45]{>}}},
+ postaction={decorate}
+ ] (\theDprev) -- (\x);%
+ \fi
+ \else \ifnum \theDprev=-1 \else%
+ \draw [xshift=\ddiagramX,yshift=\ddiagramY] (\theDprev) -- (\x);%
+ \fi\fi%
+ \setcounter{Dprev}{\x}%
+ };%
+ \draw [xshift=\ddiagramX,yshift=\ddiagramY] (\theDprev) -- (\theDfirst);%
+ %
+ \ifdefequal{\ddiagramName}{\empty}%
+ {}% if empty
+ {\node [xshift=\ddiagramX,yshift=\ddiagramY] at (0,0) [circle,fill=white] {\ddiagramName};}% if not empty
+ \ifddiagramTikz\else%
+ \end{tikzpicture}%
+ \fi%
}
@@ -115,63 +242,97 @@
% Dihedral diagrams
\tikzstyle ddihedralArrow=[decoration=
- {markings,mark=at position 1 with {\arrow[scale=1.5,>=angle 60]{>}}},
- postaction={decorate}]
+{markings,mark=at position 1 with {\arrow[scale=1.5,>=angle 60]{>}}},
+postaction={decorate}]
+\tikzstyle{ddihedral}=[inner sep=0,minimum height=18pt]
+
+\newif\ifddihedralTikz
+\newif\ifddihedralItalics
\pgfkeys{
/ddihedral/.is family, /ddihedral,
- default/.style = {t = 0, c = 0, s = 0, v = 0},
+ default/.style =
+ { t = 0, c = 0, s = 0, v = 0
+ , no tikz=false
+ , new t = T, new c = C, new s = S, new v = V
+ , no italics = false
+ },
+ no tikz/.is if=ddihedralTikz,
t/.estore in = \ddihedralT,
c/.estore in = \ddihedralC,
s/.estore in = \ddihedralS,
v/.estore in = \ddihedralV,
+ no italics/.is if=ddihedralItalics,
+ new t/.estore in = \ddihedralNewT,
+ new c/.estore in = \ddihedralNewC,
+ new s/.estore in = \ddihedralNewS,
+ new v/.estore in = \ddihedralNewV,
}
-\newcommand{\darrows}[1]{
- \DsizeHead{#1}
- \draw foreach \x in {0,...,\Evaluation{\theDsize-1}} {
- (90-360*\x/\theDsize:2.5) node[circle] (\x) {}
- };
- \foreach \xD [count=\y] in {#1} {
- \def\x{\Evaluation{\Modulo{\xD}}}
- \draw [style=ddihedralArrow] (90-360*\Evaluation{\y-1}/\theDsize:1.25) -- (\x);
- };
+\newif\ifdarrowsTikz
+\pgfkeys{
+ /darrows/.is family, /darrows,
+ default/.style = {no tikz=false},
+ no tikz/.is if=darrowsTikz,
}
+\newcommand{\darrows}[2][]{%
+ \DsizeMake{#2}%
+ %
+ \pgfkeys{/darrows, default, #1}%
+ %
+ \ifdarrowsTikz\else%
+ \begin{tikzpicture}%
+ \fi%
+ \draw foreach \x in {0,...,\Evaluation{\theDsize-1}} {%
+ (90-360*\x/\theDsize:2.5) node[circle] (\x) {}%
+ };%
+ \foreach \x [count=\y] in {#2} {%
+ \draw [style=ddihedralArrow] (90-360*\Evaluation{\y-1}/\theDsize:1.25) -- (\x);%
+ };%
+ \ifdarrowsTikz\else%
+ \end{tikzpicture}%
+ \fi%
+}
-\newcommand\ddihedral[2][]{
- \pgfkeys{/ddihedral, default, #1}
-
- \tikzset{inner sep=0,minimum height=18pt}
-
- \DsizeHead{#2}
-
- \draw foreach \x in {0,...,\Evaluation{\theDsize-1}} {
- (\Evaluation{(90+\ddihedralT*360/\theDsize)+(2*\ddihedralS-1)*\x*360/\theDsize}:2.5)
- node[very thin,circle,draw] (\x) {\x}
- };
-
- \draw foreach \x in {0,...,\Evaluation{\theDsize-1}} {
- (\Evaluation{(90-\ddihedralC*360/\theDsize)+(2*\ddihedralV-1)*\x*360/\theDsize}:1.25)
- node[very thin,circle,draw] {\x}
- };
-
- \darrows{#2}
-
- \node at (0,0) [very thin,draw,circle, fill=white] {\
- \ifnum\ddihedralV=0
- \ifnum\ddihedralC=0
- \ifnum\ddihedralS=0
- \ifnum\ddihedralT=0
- P
- \fi\fi\fi
- \else V \fi
- \ifnum\ddihedralC=0
- \else C$^{\ddihedralC}$ \fi
- \ifnum\ddihedralS=0
- \else S \fi
- \ifnum\ddihedralT=0
- \else T$^{\ddihedralT}$ \fi
- \ };
+\newcommand\ddihedral[2][]{%
+ \DsizeMake{#2}%
+ %
+ \pgfkeys{/ddihedral, default, #1}%
+ %
+ \ifddihedralTikz\else%
+ \begin{tikzpicture}[ddihedral]%
+ \fi%
+ \draw foreach \x in {0,...,\Evaluation{\theDsize-1}} {%
+ (\Evaluation{(90+\ddihedralT*360/\theDsize)+(2*\ddihedralS-1)*\x*360/\theDsize}:2.5)%
+ node[very thin,circle,draw] (\x) {\x}%
+ };%
+ %
+ \draw foreach \x in {0,...,\Evaluation{\theDsize-1}} {%
+ (\Evaluation{(90-\ddihedralC*360/\theDsize)+(2*\ddihedralV-1)*\x*360/\theDsize}:1.25)%
+ node[very thin,circle,draw] {\x}%
+ };%
+ %
+ \darrows[no tikz]{#2}%
+ %
+ \node at (0,0) [very thin,draw,circle, fill=white] {%
+ {\ifddihedralItalics\else\it\fi%
+ \ifodd\ddihedralV%
+ \ddihedralNewV\else%
+ \ifnum\ddihedralC=0%
+ \ifodd\ddihedralS\else%
+ \ifnum\ddihedralT=0%
+ \ddihedralNewT$^0$%
+ \fi\fi\fi\fi%
+ \ifnum\ddihedralC=0%
+ \else \ddihedralNewC$^{\ddihedralC}$\fi%
+ \ifodd\ddihedralS%
+ \ddihedralNewS\fi%
+ \ifnum\ddihedralT=0%
+ \else \ddihedralNewT$^{\ddihedralT}$\fi}%
+ };%
+ \ifddihedralTikz\else%
+ \end{tikzpicture}%
+ \fi%
}
@@ -178,26 +339,51 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Rows
-\newcount\fooo
+\pgfkeys{
+ /drow/.is family, /drow,
+ default/.style = {sep=\arraycolsep},
+ sep/.estore in = \drowSep,
+}
+
\long\def\addto#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}
\newcounter{myDDcntr}
-
-\newcommand{\drow}[1]{
- \DsizeHead{#1}
- \def\tabledata{} \fooo=\theDsize
- \setcounter{myDDcntr}{0}
- \loop
- \addto\tabledata{\themyDDcntr\stepcounter{myDDcntr} &}
- \advance \fooo -1
- \ifnum \fooo>1
- \repeat
- \addto\tabledata{\themyDDcntr \\}
- \ensuremath{
- \left(\begin{array}{*{\theDsize}c}
- \tabledata
- \StrSubstitute{#1}{,}{&}\\
- \end{array}\right)
- }
+\newlength{\Dvarr}
+
+\newcommand{\drow}[2][]{%
+ \DsizeMake{#2}%
+ %
+ \pgfkeys{/drow, default, #1}%
+ \setlength{\Dvarr}{\arraycolsep}
+ \setlength{\arraycolsep}{\drowSep}
+ %
+ \ifnum\theDsize=0%
+ \ensuremath{\left(\right)}%
+ \else\ifnum\theDsize=1%
+ \ensuremath{%
+ \left(\begin{array}{*{\theDsize}c}%
+ 0\\%
+ #2\\%
+ \end{array}\right)%
+ }%
+ \else%
+ \def\TableDDdata{}%
+ \setcounter{myDDcntr}{0}%
+ \loop%
+ \addto\TableDDdata{\themyDDcntr\stepcounter{myDDcntr} &}%
+ \stepcounter{myDDcntr}%
+ \ifnum\themyDDcntr<\Evaluation{\theDsize-1}%
+ \repeat%
+ \addto\TableDDdata{\themyDDcntr \\}%
+ \setcounter{myDDcntr}{0}%
+ %
+ \ensuremath{%
+ \left(\begin{array}{*{\theDsize}c}%
+ \TableDDdata%
+ \StrSubstitute{#2}{,}{&}\\%
+ \end{array}\right)%
+ }%
+ \fi\fi%
+ \setlength{\arraycolsep}{\Dvarr}
}
\endinput
More information about the tex-live-commits
mailing list