%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% %%%%%% %% ling-macros.sty %% Copyright 2016 Andrew McKenzie (andrew.mckenzie@ku.edu) % %% not to be confused with lingmacros.sty, a part of tree-dvips.sty % % %%% Thanks to Lydia Newkirk for the name suggestion. % % 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 Andrew McKenzie. % % This work consists of the files ling-macros.sty and ling-macros-doc.tex %%%%%%%%% ESSENTIAL COMMANDS %%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} % the format \ProvidesPackage{ling-macros}[2016/10/01 package of linguistics macros] % package delivery % 2011/12/10, version 1.0 % 2012/07/31, version 1.2 % update % last update: 2014/01/28, version 1.3 % update with semantics stuff % last update: 2014/02/10, version 2.0 % clean and organize commands, add documentation % last update: 2016/10/01, version 2.1 % add options, clean up for CTAN % last update: 2016/10/12, version 2.2 % changed name to ling-macros \RequirePackage{gb4e} % Example numbering and linguistic glosses (gb4e style) if you turn this off, turn off the corresponding macros! %Lengths for example macros. As is they don't affect gb4e, but options will adjust these \newlength{\bexskip}\setlength{\bexskip}{-.0\baselineskip}% space before exe environment {in proportions of \baselineskip} \newlength{\bxlskip}\setlength{\bxlskip}{-.0\baselineskip}% space before xlist environment {in proportions of \baselineskip} \newlength{\bexsep}\setlength{\bexsep}{0pt}% space between examples in exe environment {in points} \newlength{\bxlsep}\setlength{\bxlsep}{0pt}% space between examples in exe environment {in points} \newlength{\bexindent}\setlength{\bexindent}{0ex}%% space of label indent in exe environment {in ex units} \newlength{\bxlindent}\setlength{\bxlindent}{0ex}%% space of label indent in xlist environment {in ex units} \newlength{\fexskip}\setlength{\fexskip}{.0\baselineskip}% space after exe environment {in proportions of \baselineskip}} \newlength{\fxlskip}\setlength{\fxlskip}{.0\baselineskip}% space after xlist environment {in proportions of \baselineskip}} \newlength{\bexlabel}\setlength{\bexlabel}{0pt} \newlength{\bxllabel}\setlength{\bxllabel}{0pt} % Example macros (gb4e package) \newcommand{\bex}{% % Begin example environment \vspace{\bexskip}% % space before \begin{exe}% \addtolength{\itemsep}{\bexsep}% % space between examples \addtolength{\itemindent}{\bexindent}% % space before example number \addtolength{\labelsep}{\bexlabel}% % space between example number and example }% \newcommand{\fex}{% % End (finish) example environment \end{exe}% \vspace{\fexskip}% % space after }% %%% %%%%%%% \newcommand{\bxl}{% % Begin xlist environment \vspace{\bxlskip}% % space before \begin{xlist}% \addtolength{\itemsep}{\bexsep}% % space between examples \addtolength{\itemindent}{\bxlindent}% % space before example number \addtolength{\labelsep}{\bxllabel}% % space between example number and example }% \newcommand{\fxl}{% % End (finish) xlist environment \end{xlist}% \vspace{\fxlskip}% % space after }% % \RequirePackage{linguex} % Example numbering and linguistic glosses (linguex style) Turn off gb4e if you use this % \RequirePackage{tipa} % International Phonetic Alphabet \RequirePackage{stmaryrd} % Necessary for some semantics symbols (see \den) \RequirePackage{amssymb} % Necessary for some mathematic symbols (see \nl) \RequirePackage{pbox} % Necessary for scope boxes \RequirePackage{ulem} % For striking-out text and special underlining % \RequirePackage{qtree} % Tree diagrams % \RequirePackage{tikz-qtree} % Tree diagrams with tikz % \RequirePackage{tree-dvips} % Arrows in trees and glosses (On menu bar, set "Typeset" to TeX and DVI) % %\RequirePackage{parsetree} % Alternate tree diagram drawing package \RequirePackage{upgreek} %upright rather than italic Greek letters \RequirePackage{relsize} % allows relative sizes for small things %LaTeX list macros \newcommand{\ben}{\begin{enumerate}} % Begin enumerate environment \newcommand{\fen}{\end{enumerate}} % End (finish) enumerate environment \newcommand{\bit}{\begin{itemize}} % Begin itemize environment \newcommand{\fit}{\end{itemize}} % End (finish) enumerate environment %Common Linguistics stuff \newcommand{\featuresize}{\smaller[2]} % necessary for feature commands! you can change this, though. \newcommand{\alert}{\textbf} % highlights a part of an example. Compatible with beamer \newcommand{\term}[1]{{\bfseries #1}} % New terminology \newcommand{\ol}[1]{\textit{#1}} % Object language expression %Indices %requires relsize package \newcommand{\ix}[1]{\ensuremath{_{#1}}} % ix =index; in text-semantics mode, allows upright subscript indices with non-math mode text \newcommand{\ux}[1]{\ensuremath{_{\textrm{\smaller[2]{#1}}}}} % ux = upright index; in all modes, places upright subscript indices with non-math mode text \newcommand{\superx}[1]{\ensuremath{^{\textrm{\smaller[2]{#1}}}}} % superx = superscript index. For subscripts, see \ix and \ux above \newcommand{\readas}[1]{{\scshape{read:} \textsl{#1}}} % Read formal expressions in plain language % Null symbol \newcommand{\nl}{\ensuremath{\varnothing}} % Null symbol (\null is already used) % Requires amssymb package, or a class that calls it %% Prime symbol in text \newcommand{\pri}{\ensuremath{^\prime}} % allows a redefinition for text mode %% Glossing \newcommand{\m}[1]{\textsc{#1}} % morpheme glossing as small caps: clashes with fontspec, where \m does stuff. \newcommand{\mc}[1]{\textsc{#1}} % morpheme glossing as small caps: does not clash with fontspec \newcommand{\mb}{\ensuremath{-}} %wider morpheme break symbol (and can be changed) %% Contexts for elicitation: \newenvironment{context}{\begin{quote}% \bfseries Context: \\% \mdseries\slshape }%open environment {\end{quote}}%close environment %% Phonology \newcommand{\underlying}[1]{\settowidth{\prulewidth}{#1}\ensuremath{\left/ \pbox[c]{\prulewidth}{#1} \right/}} % underlying form \newcommand{\becomes}{\ensuremath{\to}~} % changes to \newlength{\prulewidth} % sets variable width for \prules (requires pbox package} \newcommand{\spoken}[1]{\settowidth{\prulewidth}{#1}\ensuremath{\left[~ \pbox[c]{\prulewidth}{#1} ~\right]}} % spoken form \newcommand{\environ}{\parbox[c]{1em}{\larger[2] \ensuremath{\left/ \right.}}} % in the environment of (requires relsize) \newcommand{\spot}{\rule[-1pt]{2ex}{.5pt}} % location of change \newcommand{\prule}[3]{\underlying{#1} \becomes \spoken{#2} \environ #3} % puts all the other commands together \newcommand{\iparule}[3]{{\tipaencoding \underlying{#1} \becomes \spoken{#2} \environ #3} } % puts all the other commands together with ipa. Requires tipa package % allows setting of environment bar \newcommand{\environset}[1]{\parbox[c]{1em}{\larger[#1] $/$}} % in the environment of, variable size (requires relsize) \newcommand{\pruleset}[4]{\underlying{#1} \becomes \spoken{#2} \environset{#4} #3} % puts all the other commands together \newcommand{\iparuleset}[4]{{\tipaencoding \underlying{#1} \becomes \spoken{#2} \environset{#4} #3} } % puts all the other commands together with ipa Requires tipa package \newcommand{\syll}{\ensuremath{_\sigma}} % syllable symbol %%% Writing feature matrices \newcommand{\fmleft}{$\left[ \begin{array}{c l}} % Big brackets, left \newcommand{\fmright}{\end{array} \right]$} % Big brackets, right \newcommand{\fmat}[2]{{#1}&{\textrm{#2}} \\ } % Inside array notation %%%%%%%%%% SYNTAX MACROS %%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\xbar}[1]{$\overline{\textrm{#1}}$} % The bar in X-bar (see \pri for prime mark) \newcommand{\head}[1]{#1{\ensuremath{^\circ}}} % Syntactic head naming ... \head{C} \newcommand{\lv}{{\itshape v}} % Little v label \newcommand{\feat}[1]{{\featuresize\ensuremath{[}#1\ensuremath{]}}} % features in trees and diagrams \newcommand{\textfeat}[1]{\ensuremath{[}\mbox{#1}\ensuremath{]}} % features in text \newcommand{\dcopy}[1]{\sout{~#1~}} % deleted copy (requires ulem package) \newcommand{\ufeat}[1]{\feat{\textit{u}#1:\rule[-1pt]{2ex}{.5pt}}} % Unvalued/uninterpretable feature; given X: [uX:__] \newcommand{\unv}[1]{\textit{u}#1:\rule[-1pt]{2ex}{.5pt}} % Unvalued/uninterpretable feature part; given X: [uX:__] % Goes inside \feat or \textfeat command \newcommand{\mroot}[1]{\ensuremath{\sqrt{\hspace{1pt}\textrm{#1}\hspace{2pt}}}} % morphological roots %%%%%%%%% SEMANTICS MACROS%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Delimiters \newcommand{\den}[1]{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket}} % Denotation brackets % Requires stmaryrd package ... \usepackage{stmaryrd} \newcommand{\dena}[2]{{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket}}\ensuremath{^{{#2}}}} % Denotation brackets with assignment variables (requires stmaryrd package) \newcommand{\denamod}[3]{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket^{{#2}^{{#3}}}}} % Denotation brackets with modified assignment variables (requires stmaryrd package) \newcommand{\denac}[2]{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket^{{#2}_{c}}}} % Denotation brackets with assignment variable, context c (requires stmaryrd) \newcommand{\denacmod}[3]{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket^{{#2}_{{c}}^{{#3}}}}} % Denotation brackets with modified assignment variable, context c (requires stmaryrd) \newcommand{\denol}[1]{\den{\ol{#1}}} % Denotation with object language \newcommand{\denola}[2]{\dena{\ol{#1}}{#2}} % Denotation + assignment with object language \newcommand{\denolamod}[3]{\denamod{\ol{#1}}{#2}{#3}} % Denotation + modified assignment with object language \newcommand{\denolac}[2]{\denac{\ol{#1}}{#2}} \newcommand{\denolacmod}[3]{\denacmod{\ol{#1}}{#2}{#3}} % Nested scope boxes (these can be useful for clarifying complex formulas. Requires pbox package \newlength{\scopewidth} %introduces a variable width \newcommand{\scopebox}[1]{\settowidth{\scopewidth}{#1} % sets width to that of line, then creates a pbox with maximum of that width with delimiters. \ensuremath{\left[ ~ {\pbox[c]{\scopewidth}{#1}}~\right] }} \newcommand{\innerscopebox}[1]{% % creates a pbox with parent maximum width with delimiters. \ensuremath{\left[ ~ {\pbox[c]{\scopewidth}{#1}}~\right] }} \newcommand{\type}[1]{\ensuremath{\langle{#1}\rangle}} % Type brackets for type-theory ... \type{e,\type{s,t}} \newcommand{\uptype}[1]{\ensuremath{\langle{\mathrm{#1}}\rangle}} % Set notation: \newcommand{\set}[1]{\ensuremath{\{~ #1 ~\}}} % Encloses a set (easier to see in source) \newcommand{\varset}[2]{\ensuremath{\{~ #1 ~|~ #2 ~\}}} % Encloses an abstracted set \newcommand{\cvarset}[2]{\ensuremath{\{~ #1 ~{:}~ #2 ~\}}} % Encloses an abstracted set, with a colon %Semantic operators \newcommand{\lam}[1]{\ensuremath{\lambda #1}} % Lambda operator ... \lam{x} \newcommand{\some}[1]{\ensuremath{\exists #1}} % Existential quantifier ... \some{x} \newcommand{\all}[1]{\ensuremath{\forall #1}} %Universal quantifier ... \all{x} \newcommand{\no}[1]{\ensuremath{\neg\exists #1}} % Negative quantifier \newcommand{\ddet}[1]{\ensuremath{\iota #1}} % Definite determiner ... \ddet{x} % \newcommand{\EX}{{\sffamily E\hspace{-.4ex}X}} % Exemplification operator %% Semantics stuff \newcommand{\form}[1]{\ensuremath{#1}} % Formal expression / formula \newcommand{\f}[1]{\ensuremath{#1}} % Formal expresssion that stay formal in text-semantics \newcommand{\lamd}[2]{\lam{#1} \ensuremath{\in} D\ix{#2}} % lambda-notation with domain %% Writing functions \newcommand{\fleft}{$\left[ \begin{array}{ccr}} % Big brackets, left \newcommand{\fright}{\end{array} \right]$} % Big brackets, right \newcommand{\func}[2]{{\textrm{#1}} & \to & {\textrm{#2}} \\ } % Inside array notation %%% Function notation : to write out the parts of the function explicitly \newcommand{\funcnot}[5]{% \ensuremath{#1} : %#1 the function variable \pbox[t]{2.0\textwidth}{% \ensuremath{#2}% #2 domain ~\ensuremath{\to} \ensuremath{#3} \\%#3 the range \all{#4}%#4 the argument variable ~\ensuremath{\in} \ensuremath{#2}, \ensuremath{#1(#4) =} #5% #5 the truth-conditions }% } % \newcommand{\funcnot}[3]{\ensuremath{f }: \pbox[t]{.8\textwidth}{\ensuremath{#1 \to \{1, 0\} }\\ \ensuremath{\all{#2} \in #1; f(#2) = 1} iff #3}} % Function notation % \newcommand{\funcnotx}[2]{\parbox[m]{2.5in}{\vspace{2pt}f : #1 $\to$ \{1, 0\} \\for all x $\in$ #1, f(x) = 1 iff #2}} % Function %notation % \newcommand{\crule}[1]{\textbf{#1 :}} % compositional rule in a tree %%% \DeclareOption{leftflush}{% sets gb4e examples as left flushed \setlength{\bexindent}{-3.2ex} % shortens indentation of examples to put them on the left \setlength{\bexlabel}{-2ex} % shortens space between example number and example \setlength{\bxllabel}{-1.0ex} % shortens indentation of examples to put them nearer to the left \setlength{\bxlindent}{-5ex} % shortens space between example number and example \newcommand{\lessthanten}{ % sets ex numbers 1-9 all the way at the left. Must put command outside exe \setlength{\bexindent}{-3.5ex} % shortens indentation of examples to put them on the left \setlength{\bexlabel}{-1.2ex} % shortens space between example number and example } \newcommand{\tenormore}{ % sets ex numbers 10+ to the left. (i.e. undoes \lessthanten) Must put command outside exe \setlength{\bexindent}{-3.2ex} % shortens indentation of examples to put them on the left \setlength{\bexlabel}{-2ex} % shortens space between example number and example } }%%end of option leftflush \DeclareOption{shortspace}{%sets gb4e examples with less white space. \setlength{\bexskip}{-.7\baselineskip} % reduces space before \setlength{\bxlskip}{-.4\baselineskip} \setlength{\bexsep}{-4pt} % reduces space between examples \setlength{\bxlsep}{-2pt} \setlength{\fexskip}{-.7\baselineskip} % reduces space after \setlength{\fxlskip}{-.2\baselineskip} }%%end of option shortspace \DeclareOption{abstract}{%combines leftflush and shortspace for use in abstracts \setlength{\bexindent}{-3.2ex} % shortens indentation of examples to put them on the left \setlength{\bexlabel}{-2ex} % shortens space between example number and example \setlength{\bxllabel}{-1.0ex} % shortens indentation of examples to put them nearer to the left \setlength{\bxlindent}{-5ex} % shortens space between example number and example \setlength{\bexskip}{-.7\baselineskip} % reduces space before \setlength{\bxlskip}{-.4\baselineskip} \setlength{\bexsep}{-4pt} % reduces space between examples \setlength{\bxlsep}{-2pt} \setlength{\fexskip}{-.7\baselineskip} % reduces space after \setlength{\fxlskip}{-.2\baselineskip} \newcommand{\lessthanten}{ % sets ex numbers 1-9 all the way at the left. Must put command outside exe \setlength{\bexindent}{-3.5ex} % shortens indentation of examples to put them on the left \setlength{\bexlabel}{-1.2ex} % shortens space between example number and example } \newcommand{\tenormore}{ % sets ex numbers 10+ to the left. (i.e. undoes \lessthanten) Must put command outside exe \setlength{\bexindent}{-3.2ex} % shortens indentation of examples to put them on the left \setlength{\bexlabel}{-2ex} % shortens space between example number and example } %%% }%end of option abstract \DeclareOption{text-semantics}{%% sets semantic formulas in upright fashion % Delimiters \renewcommand{\den}[1]{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket}} % Denotation brackets % Requires stmaryrd package ... \usepackage{stmaryrd} \renewcommand{\dena}[2]{{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket}}\ensuremath{^{\textrm{\smaller[2]{#2}}}}} % Denotation brackets with assignment variables (requires stmaryrd package) \renewcommand{\denamod}[3]{\ensuremath{\llbracket}\,{#1}\,\ensuremath{\rrbracket^{\mathrm{\smaller[2]{#2}}^{\textrm{\smaller[4]{#3}}}}}} % Denotation brackets with modified assignment variables (requires stmaryrd package) \renewcommand{\denac}[2]{$\llbracket$\,{#1}\,$\rrbracket^{\mathrm{#2}_{\tiny\textrm{c}}}$} % Denotation brackets with assignment variable, context c (requires stmaryrd) \renewcommand{\denacmod}[3]{$\llbracket$\,{#1}\,$\rrbracket^{\mathrm{#2}_{\tiny\textrm{c}}^{\tiny\textrm{#3}}}$} % Denotation brackets with modified assignment variable, context c (requires stmaryrd) \renewcommand{\denol}[1]{\den{\ol{#1}}} % Denotation with object language \renewcommand{\denola}[2]{\dena{\ol{#1}}{#2}} % Denotation + assignment with object language \renewcommand{\denolamod}[3]{\denamod{\ol{#1}}{#2}{#3}} % Denotation + modified assignment with object language \renewcommand{\denolac}[2]{\denac{\ol{#1}}{#2}} \renewcommand{\denolacmod}[3]{\denacmod{\ol{#1}}{#2}{#3}} %Sets \renewcommand{\set}[1]{\{ #1 \}} % Encloses a set (easier to see in source) \renewcommand{\varset}[2]{\{ #1 \ensuremath{|} #2 \}} % Encloses an abstracted set \renewcommand{\cvarset}[2]{\{ #1 \ensuremath{:} #2 \}} % Encloses an abstracted set, with a colon %Indices \renewcommand{\ix}[1]{\ensuremath{_{\textrm{\smaller[2]{#1}}}}} % ix =index; Upright subscript indices with non-math mode text \renewcommand{\lamd}[2]{\lam{#1} \ensuremath{\in} D\ix{#2}} % lambda-notation with domain \renewcommand{\superx}[1]{\ensuremath{^{\textrm{\smaller[2]{#1}}}}} % superx = superscript index. For subscripts, see \ix above %Semantic operators \renewcommand{\lam}[1]{\ensuremath{\uplambda}#1} % Lambda operator ... \lam{x} \renewcommand{\some}[1]{\ensuremath{\exists}#1} % Existential quantifier ... \some{x} \renewcommand{\no}[1]{\ensuremath{\neg\exists}#1} % Negative quantifier \renewcommand{\all}[1]{\ensuremath{\forall}#1} %Universal quantifier ... \all{x} \renewcommand{\form}{} % Formal expression / formula \renewcommand{\pri}{\ensuremath{^\prime}} \renewcommand{\ddet}[1]{\ensuremath{\upiota}#1} % Definite determiner ... \ddet{x} %Funcnot \renewcommand{\funcnot}[5]{% {#1} : \pbox[t]{2.0\textwidth}{% 1 the function {#2} {\ensuremath{\to}} #3 \\% the buffoon % the domain \all{}{#4} \ensuremath{\in} #2, {#1(#4) =} #5% %object of domain }% } }%%end of option text-semantics \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions