diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/pst-vowel/pst-vowel.sty |
Initial commit
Diffstat (limited to 'macros/latex/contrib/pst-vowel/pst-vowel.sty')
-rw-r--r-- | macros/latex/contrib/pst-vowel/pst-vowel.sty | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/macros/latex/contrib/pst-vowel/pst-vowel.sty b/macros/latex/contrib/pst-vowel/pst-vowel.sty new file mode 100644 index 0000000000..6699849b04 --- /dev/null +++ b/macros/latex/contrib/pst-vowel/pst-vowel.sty @@ -0,0 +1,118 @@ +% pst-vowel.sty -- pstricks additions for drawing vowel diagrams. +% Copyright 2009 by Alan Munn <amunn@msu.edu> +% based on code in vowel.sty Copyright 2002 by Rei Fukui +% +% This package insert nodes for use with pstricks so that arrows can +% be drawn to show diphthongs on vowel charts. +% +% For cardinal vowels, the change is minimal, since predefined node +% labels are used. For non-cardinal vowels, an extra node argument +% must be provided. +% +% This package may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This package has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this package is Alan Munn. +% +% This package consists of the file pst-vowel.sty and documentation files +% pst-vowel.tex and pst-vowel.pdf +% +% Version 1.0 2009/04/24 +% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{pst-vowel}[2009/04/24 pst-vowel Package version 1.0] +\RequirePackage{pst-node} +\RequirePackage{vowel} + +% Put a vowel on a specified point. +% [AM] Added an extra argument to add a node label for the vowel. +% Usage is \putvowel{vowel}{x}{y}{node} +% +\renewcommand\@putvowel[4]{% +\setbox\z@\hbox{#1\global\dimen4=.5ex}% +\setbox\z@\hbox{#1}\dimen\@ne\wd\z@\incr@ne 2\vowelsep +% +\dimen\z@#2\incrz@ -.5\dimen\@ne +\expandafter\xdef\csname vwlxi\the\@vwlcnt\endcsname{\the\dimen\z@}% +\ifdim\dimen\z@<\z@ \dimen\z@-\dimen\z@ + \ifdim\dimen\z@>\@vwllftsep \@vwllftsep\dimen\z@\fi\fi +% +\dimen\z@#2\incrz@ .5\dimen\@ne +\expandafter\xdef\csname vwlxii\the\@vwlcnt\endcsname{\the\dimen\z@}% +\dimen\@ne\@vwldgmwd \incr@ne-\dimen\z@ +\ifdim\dimen\@ne<\z@ \dimen\@ne-\dimen\@ne + \ifdim\dimen\@ne>\@vwlrtsep \@vwlrtsep\dimen\@ne\fi\fi +% +\dimen\z@#3\dimen\tw@=\ht\z@\advance\dimen\tw@ -\dimen4%.5ex% +\incrz@ -\dimen\tw@ \incrz@ -\vowelsep +\expandafter\xdef\csname vwlyi\the\@vwlcnt\endcsname{\the\dimen\z@}% +\ifdim\dimen\tw@>\@vwltopsep \@vwltopsep\dimen\tw@\fi +% +\dimen\z@#3\dimen\tw@=\dp\z@\advance\dimen\tw@ \dimen4%.5ex% +\incrz@ \dimen\tw@ \incrz@ \vowelsep +\expandafter\xdef\csname vwlyii\the\@vwlcnt\endcsname{\the\dimen\z@}% +\ifdim\dimen\tw@>\@vwlbotsep \@vwlbotsep\dimen\tw@\fi +% +\expandafter\gdef\csname vwlsym\the\@vwlcnt\endcsname{\rnode{#4}{#1}}% +\expandafter\xdef\csname tmpnoerase\the\@vwlcnt\endcsname{% + \if@tmpnoerase1\else0\fi}% +\advance\@vwlcnt \@ne +\ignorespaces} + +% Macro to put a vowel next to a dot. +% [AM] Added an extra argument which specifies a node label for the dot. +% For the cardinal vowels, these labels are pre-specified v1 ... v16 +% For arbitrarily placed vowels using \putvowel[l] or \putvowel[r] the node +% label has to be explicitly given as in \putvowel[l]{vowel}{x}{y}{node}. +% +\def\@putdotvowel[#1]#2#3#4#5{% +\if x#1\@putvowel{#2}{#3}{#4}{#5}\else +\@tmpnoerasetrue\@putvowel{\rnode{#5}{\vowelsymbol}}{#3}{#4}{#5}\@tmpnoerasefalse +\setbox\z@\hbox{#2}\setbox\@ne\hbox{\vowelsymbol}% +\dimen\z@=#3\dimen\@ne=#4\dimen\tw@=.5\wd\z@ +\advance\dimen\tw@.5\wd\@ne \advance\dimen\tw@.5\vowelsep +% +\if l#1% + \incrz@-\dimen\tw@ +\else + \if r#1\incrz@\dimen\tw@ + \else \errmessage{put(c)vowel: no such option [#1]}% + \fi +\fi +% +\edef\@vwltmpi{\the\dimen\z@}% +\@putvowel{#2}\@vwltmpi{#4}{#5}\fi} + +% Put a vowel on a cardinal position +% [AM] This code has been modified to add an explicit node label for each +% dotted vowel. The labels for the cardinal vowels are v1 ... v16. +% + +\def\@putcvowel[#1]#2#3{% +\ifcase#3\or + \@putdotvowel[#1]{#2}\z@\z@{v1}\or + \@putdotvowel[#1]{#2}\c@rdhposii\vowelvunit{v2}\or + \@putdotvowel[#1]{#2}\c@rdhposiii{2\vowelvunit}{v3}\or + \@putdotvowel[#1]{#2}\c@rdhposiv\@vwldgmht{v4}\or + \@putdotvowel[#1]{#2}\@vwldgmwd\@vwldgmht{v5}\or + \@putdotvowel[#1]{#2}\@vwldgmwd{2\vowelvunit}{v6}\or + \@putdotvowel[#1]{#2}\@vwldgmwd\vowelvunit{v7}\or + \@putdotvowel[#1]{#2}\@vwldgmwd\z@{v8}\or + \@putdotvowel[#1]{#2}{2\vowelhunit}\z@{v9}\or + \@putdotvowel[#1]{#2}\c@rdhposx\vowelvunit{v10}\or + \@putdotvowel[#1]{#2}\c@rdhposxi{1.5\vowelvunit}{v11}\or + \@putdotvowel[#1]{#2}\c@rdhposxii{2\vowelvunit}{v12}\or + \@putdotvowel[#1]{#2}\c@rdhposxiii{.5\vowelvunit}{v13}\or + \@putdotvowel[#1]{#2}\c@rdhposxiv{.5\vowelvunit}{v14}\or + \@putdotvowel[#1]{#2}\c@rdhposxv{2.5\vowelvunit}{v15}\or + \@putdotvowel[#1]{#2}\c@rdhposxvi{2.5\vowelvunit}{v16}\else\fi +} + +\endinput |