From 7870a781c1a56b03d9e4fa902003361b9119b090 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 11 Dec 2015 23:15:04 +0000 Subject: simpler-wick (11dec15) git-svn-id: svn://tug.org/texlive/trunk@39074 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/simpler-wick/simpler-wick.sty | 222 +++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/simpler-wick/simpler-wick.sty (limited to 'Master/texmf-dist/tex/latex/simpler-wick') diff --git a/Master/texmf-dist/tex/latex/simpler-wick/simpler-wick.sty b/Master/texmf-dist/tex/latex/simpler-wick/simpler-wick.sty new file mode 100644 index 00000000000..7ddbd6a003e --- /dev/null +++ b/Master/texmf-dist/tex/latex/simpler-wick/simpler-wick.sty @@ -0,0 +1,222 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Simpler Wick Contractions +% Copyright (C) 2014 Joshua Ellis +% +% An simpler implementation of the Wick contractions. +% +% +% This work may be distributed and/or modified under the conditions of the LaTeX +% Project Public License, either version 1.3 of this license or (at your option) +% any later version. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Joshua Ellis. +% +% This program is distributed in the hope that it will be useful, but WITHOUT +% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +% FOR A PARTICULAR PURPOSE. See the LaTeX Project Public License for more +% details. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ProvidesPackage{simpler-wick}[2015/12/11 Simpler Wick contractions] + +\RequirePackage{tikz} +\RequirePackage{pgfopts} +\usetikzlibrary{calc} +\usetikzlibrary{external} + +\pgfkeys{ + /simplerwick/.is family, + /simplerwick, + sep/.store in=\swick@sep, + sep=3pt, + offset/.store in=\swick@offset, + offset=1em} + +\ProcessPgfOptions{/simplerwick} + +% Works just like \@ifnextchar[, except for digits [1-9] +\def\swick@ifnextdigit#1#2{ + \@ifnextchar 1{#1}{ + \@ifnextchar 2{#1}{ + \@ifnextchar 3{#1}{ + \@ifnextchar 4{#1}{ + \@ifnextchar 5{#1}{ + \@ifnextchar 6{#1}{ + \@ifnextchar 7{#1}{ + \@ifnextchar 8{#1}{ + \@ifnextchar 9{#1}{#2}}}}}}}}}} + +% A count to keep track of how many contraction are currently open. +\countdef\swick@count=0 + +% Convert the digit to its representation as a word +\def\swick@translate#1{% + \ifcase#1\or + one\or + two\or + three\or + four\or + five\or + six\or + seven\or + eight\or + nine\fi +} + +% Keeping track of which contraction is open or closed. +\newif\ifswick@if@one@ +\newif\ifswick@if@two@ +\newif\ifswick@if@three@ +\newif\ifswick@if@four@ +\newif\ifswick@if@five@ +\newif\ifswick@if@six@ +\newif\ifswick@if@seven@ +\newif\ifswick@if@eight@ +\newif\ifswick@if@nine@ + +% Shortcut to the ith 'if' variable +\def\swick@settrue@#1{ + \csname swick@if@\swick@translate{#1}@true\endcsname} +\def\swick@setfalse@#1{ + \csname swick@if@\swick@translate{#1}@false\endcsname} + +% Returns true or false based on whether the ith. Use as: +% +% \if\swick@cond@4 +% +% \else +%