2 Commits 077eafd4e1 ... d36d6ffb50

Autor SHA1 Mensagem Data
  SpaghettiToastBook d36d6ffb50 Disallow \exref in footnotes 5 anos atrás
  SpaghettiToastBook a3454bfcc1 Add convenience macros for indices and glosses 5 anos atrás
1 arquivos alterados com 29 adições e 3 exclusões
  1. 29 3
      stb-linguistics.sty

+ 29 - 3
stb-linguistics.sty

@@ -5,6 +5,7 @@
 \RequirePackage{eqparbox}
 \RequirePackage{etoolbox}
 \RequirePackage{xparse}
+\RequirePackage{xstring}
 
 % --- Line up all leaves ---
 \DeclareOption{leafline}{%
@@ -108,11 +109,17 @@
         { \eqmakebox[\@exenv-{\the\@listdepth}][r]{#1}}%
     ]%
     \protected@edef\@currentlabel{\@nameuse{the\@enumctr}}%
-    \label{\@exenv @\arabic{\@exenv i}-\ifnumequal{\@listdepth}{2}{\arabic{\@exenv ii}}{0}}%
+    \IfStrEq{\@exenv}{texamples}{%
+        \label{\@exenv @\arabic{\@exenv i}-\ifnumequal{\@listdepth}{2}{\arabic{\@exenv ii}}{0}}%
+    }{}%
 }
 
 % Relative cross-references to examples
-\NewDocumentCommand{\exref}{m O{0}}{\ref{\@exenv @\the\numexpr \value{\@exenv i} + #1 \relax-#2}}
+\NewDocumentCommand{\exref}{m O{0}}{%
+    \IfStrEq{\@exenv}{texamples}%
+        {\ref{\@exenv @\the\numexpr \value{\@exenv i} + #1 \relax-#2}}%
+        {\PackageError{stb-linguistics}{\protect\exref\space can't be used in footnotes (\@exenv)}}%
+}
 
 \NewDocumentCommand{\nextexref}{o}{\exref{1}[#1]} % (use \NewDocumentCommand for the these instead of \newcommand* so that -NoValue- is passed if there's no optional argument)
 \NewDocumentCommand{\nnextexref}{o}{\exref{2}[#1]}
@@ -204,9 +211,28 @@
 % --- Miscellaneous linguistics stuff ---
 % Indices
 \newcommand*{\ind}[1]{\textsubscript{\(#1\)}}
+\newcommand*{\indt}[1]{\(t\)\ind{#1}}
+\newcommand*{\ti}{\indt{i}}
+\newcommand*{\tj}{\indt{j}}
+\newcommand*{\tk}{\indt{k}}
+
+% Symbols for glosses
+\newcommand*{\nom}{\textsc{nom}}
+\newcommand*{\acc}{\textsc{acc}}
+\newcommand*{\dat}{\textsc{dat}}
+\newcommand*{\gen}{\textsc{gen}}
+
+\newcommand*{\sg}{\textsc{sg}}
+\newcommand*{\pl}{\textsc{pl}}
+
+\newcommand*{\first}{\textsc{1p}}
+\newcommand*{\second}{\textsc{2p}}
+\newcommand*{\third}{\textsc{3p}}
 
-% Tenses
 \newcommand*{\past}{\textsc{past}}
 \newcommand*{\pres}{\textsc{pres}}
+\newcommand*{\nonpast}{\textsc{nonpast}}
+
+\newcommand*{\poss}{\textsc{poss}}
 
 \endinput