summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ot-tableau/ot-tableau.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/ot-tableau/ot-tableau.sty')
-rw-r--r--macros/latex/contrib/ot-tableau/ot-tableau.sty61
1 files changed, 47 insertions, 14 deletions
diff --git a/macros/latex/contrib/ot-tableau/ot-tableau.sty b/macros/latex/contrib/ot-tableau/ot-tableau.sty
index 84528124dc..3d2ac05907 100644
--- a/macros/latex/contrib/ot-tableau/ot-tableau.sty
+++ b/macros/latex/contrib/ot-tableau/ot-tableau.sty
@@ -1,4 +1,21 @@
-\ProvidesPackage{ot-tableau}[2017/07/23]
+%% ot-tableau.sty
+%% Copyright 2021 Adam Baker
+%
+% 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.
+% 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 work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Adam Bker.
+%
+% This work consists of the files ot-tableau.sty and ot-tableau.tex.
+
+\ProvidesPackage{ot-tableau}[2021-05-19]
% Package option: notipa
\newif\ifottableau@tipa
@@ -9,6 +26,11 @@
\newif\ifottableau@circledviolations
\DeclareOption{circledviolations}{\ottableau@circledviolationstrue}
+% Package option: usehhline
+\newif\ifottableau@usehhline
+\ottableau@usehhlinefalse % default to false
+\DeclareOption{usehhline}{\ottableau@usehhlinetrue}
+
% Package option: shadedcells
\newif\ifottableau@shadedcells
\DeclareOption{shadedcells}{\ottableau@shadedcellstrue}
@@ -29,8 +51,13 @@
\RequirePackage{rotating}
% fancy table and lines
-\RequirePackage{hhline,tabu}
-\newtabulinestyle { dashed=.5pt on 1.5pt off 1.5pt }
+% 2021-05-19: Removing hhline, which makes the nice lines, because hhline conflicts with arydshln
+\ifottableau@usehhline
+ \RequirePackage{hhline}
+\else
+\fi
+
+\RequirePackage{arydshln}
% IPA typesetting macros
\def\ipa#1{#1}
@@ -91,25 +118,34 @@
% 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}%
\gdef\ConstraintString{#1}
\StrSubstitute{#1}{s}{c}[\NoS]
\StrCount{\NoS}{c}[\ConstraintCount]%
+ \ifottableau@usehhline
+ \gdef\TopOrBottomLine{\hhline{---||*{\ConstraintCount}{-|}}}
+ \gdef\DoubleLine{\hhline{---||*{\ConstraintCount}{-|}}}
+ \else
+ \gdef\TopOrBottomLine{\hline}
+ \gdef\DoubleLine{\hline\hline}
+ \fi
\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}}
-
+ {\begin{tabular}{|r@{\hspace{4pt}}l@{\hspace{3pt}}l||#1|}} % finger first
+ {\begin{tabular}{|l@{\hspace{2pt}}r@{\hspace{4pt}}l||#1|}} % finger second
+ \TopOrBottomLine
+ }{\\\TopOrBottomLine\end{tabular}}
+
% draw two lines after the constraints, one line elsewhere
\def\properlines{\ifthenelse{\thetableaurow=0}%
- {\\\hhline{:===::*{\ConstraintCount}{=:}}}%
- {\\\hhline{|---||*{\ConstraintCount}{-|}}}}
+ {\\\DoubleLine}%
+ {\\\TopOrBottomLine}}
\newcommand\cand[2][]{\OptimalOff\properlines%
\ifottableau@fingerfirst \ipa{#1} \else \rowletter \fi%
@@ -142,6 +178,3 @@
\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]}