summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ot-tableau
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-07-25 22:00:35 +0000
committerKarl Berry <karl@freefriends.org>2017-07-25 22:00:35 +0000
commitb5a3b2241e94d4afceda9cbcaebbd4da44e688ce (patch)
tree5bc46e710b8d6a5749bc51571f7cfbb0f7a67023 /Master/texmf-dist/tex/latex/ot-tableau
parentfa806c70c6a0ac139eabe8d0eca43352a13ac48e (diff)
ot-tableau (25jul17)
git-svn-id: svn://tug.org/texlive/trunk@44889 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ot-tableau')
-rw-r--r--Master/texmf-dist/tex/latex/ot-tableau/ot-tableau.sty45
1 files changed, 30 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/ot-tableau/ot-tableau.sty b/Master/texmf-dist/tex/latex/ot-tableau/ot-tableau.sty
index 4769b18ec44..84528124dca 100644
--- a/Master/texmf-dist/tex/latex/ot-tableau/ot-tableau.sty
+++ b/Master/texmf-dist/tex/latex/ot-tableau/ot-tableau.sty
@@ -1,5 +1,4 @@
-% Note that ot-tableau requires arydshln, which must be loaded after longtable
-\ProvidesPackage{ot-tableau}[2014/09/02]
+\ProvidesPackage{ot-tableau}[2017/07/23]
% Package option: notipa
\newif\ifottableau@tipa
@@ -25,11 +24,14 @@
\RequirePackage{xstring}
\RequirePackage{amssymb} % provides the asterisks
\RequirePackage{bbding} % provides \HandRight, etc.
-\RequirePackage{suffix}
-\RequirePackage{colortbl}
-\RequirePackage{arydshln}
+\RequirePackage{suffix} % provides stared commands
+\RequirePackage{colortbl} % for shading
\RequirePackage{rotating}
+% fancy table and lines
+\RequirePackage{hhline,tabu}
+\newtabulinestyle { dashed=.5pt on 1.5pt off 1.5pt }
+
% IPA typesetting macros
\def\ipa#1{#1}
\def\ip#1{[#1]}
@@ -86,18 +88,28 @@
\def\ExclOff{\globaldefs=1\ottableau@exclfalse\globaldefs=0}
\def\ExclOn{\globaldefs=1\ottableau@excltrue\globaldefs=0}
-
+% Automatic row lettering
\newcommand*{\rowletter}{\stepcounter{tableaurow}\alph{tableaurow}. }
+
+% https://tex.stackexchange.com/questions/382843/using-the-tabu-environment-within-a-conditional-within-newenvironment
\newenvironment{tableau}[1]{\setcounter{tableaurow}{0}%
- \dashlinegap=2pt%
- \ifottableau@fingerfirst
- \begin{tabular}{|r@{\hspace{4pt}}l@{\hspace{3pt}}l||#1|}
- \else
- \begin{tabular}{|l@{\hspace{2pt}}r@{\hspace{4pt}}l||#1|}
- \fi%
- }{\\\hline\end{tabular}}
+ \gdef\ConstraintString{#1}
+ \StrSubstitute{#1}{s}{c}[\NoS]
+ \StrCount{\NoS}{c}[\ConstraintCount]%
+ \ifottableau@fingerfirst % finger first: this is the default
+ \expandafter\@firstoftwo
+ \else % finger second
+ \expandafter\@secondoftwo
+ \fi
+ {\begin{tabu}{|r@{\hspace{4pt}}l@{\hspace{3pt}}l||#1|}} % finger first
+ {\begin{tabu}{|l@{\hspace{2pt}}r@{\hspace{4pt}}l||#1|}} % finger second
+ \hhline{|---||*{\ConstraintCount}{-|}}
+ }{\\\hhline{|---||*{\ConstraintCount}{-|}}\end{tabu}}
-\def\properlines{\ifthenelse{\thetableaurow=0}{\\\hline\hline}{\\\hline}}
+% draw two lines after the constraints, one line elsewhere
+\def\properlines{\ifthenelse{\thetableaurow=0}%
+ {\\\hhline{:===::*{\ConstraintCount}{=:}}}%
+ {\\\hhline{|---||*{\ConstraintCount}{-|}}}}
\newcommand\cand[2][]{\OptimalOff\properlines%
\ifottableau@fingerfirst \ipa{#1} \else \rowletter \fi%
@@ -126,7 +138,10 @@
\ifottableau@excl \empty \else \IfSubStr{#1}{!}{\ExclOn}{\ExclOff} \fi%
}
-\newcommand\inp[1]{\hline\multicolumn{3}{|l||}{#1}}
+\newcommand\inp[1]{\multicolumn{3}{|l||}{#1}}
\newcommand\const[1]{&\textsc{#1}\UnshadeTheCell}
\WithSuffix\newcommand\const*[1]{&#1\UnshadeTheCell}
+
+% 2017-07-22: This doesn't work for some reason if it's toward the top of the file
+\newcolumntype{:}{|[dashed]}