1

I'm trying to recreate this rewrite rule:

enter image description here

Using a modified version of phonrule (see Typesetting linguistic rewrite rule), I get this:

enter image description here

There are several issues here, and I'm wary about asking several questions at once, but since each question can be solved independently of the others, I'll ask them all now.

  1. How can I get a larger slash that's more or less proportional to the size of whatever directly follows it?
  2. How can I get large parenthetical brackets proportional to the largest item between them?
  3. How can I replicate the content of the final matrix, such the V is centered, but -round and -low are left aligned?
  4. How can I get a subscript 0 to be at the bottom of a matrix?

The MWE

\documentclass{article}

\providecommand*{\textrightarrow}{\ensuremath{\rightarrow}}
\providecommand*{\textminus}{\ensuremath{-}}
\newcommand*{\phold}{\rule[-1.5pt]{1em}{.5pt}}
\newcommand*{\phon}[2]{#1 \textrightarrow{} #2}
\newcommand*{\phonl}[3]{\phon{#1}{#2}~/~#3\phold}

% set environment for feature matrix with square brackets
\newcommand*{\phonfeatc}[1]{% features are centered
  \ensuremath{%
    \left[\begin{tabular}{@{}c@{}}#1\end{tabular}\right]%
  }}

\begin{document}
\phonl{\phonfeatc{V\\ +back}}{[$\alpha$back]}{{\phonfeatc{V\\ $\alpha$back}} (C$_{0}$\phonfeatc{V\\ \textminus\,round\\ \textminus\,low}$_{0}$ C$_{0}$)$_{0}$ \# X}
\end{document}
1

REVISED ANSWER

This is not my field, but after OP comments, I learned that these bracketed expressions have a centered top row if it a single V or C (or left-aligned otherwise) and subsequent row(s), of arbitrary number, are all left-aligned. If that is so, then this approach I think is more consistent than my original answer.

In it, there are not separate \phonefeatc{} and \phonfeatcl{}{}, but rather just \phonfeat{}{}, in which the 1st argument is the top, centered if V or C, left-aligned otherwise, and the 2nd argument are all the rest of the left-aligned qualifiers. To handle an arbitrary number of rows, I place the nested stack in a \vcenter{\hbox{...}}.

\documentclass{article}
\usepackage{scalerel,stackengine,amsmath}
\strutlongstacks{T}
\setstackEOL{\\}
\newcommand*{\phold}{\rule[-1.5pt]{1em}{.5pt}}
\newcommand*{\phon}[2]{#1 \rightarrow{} #2}
\newcommand*{\phonl}[3]{\phon{#1}{#2}\stretchrel{~/~}{#3}\phold}
\newcommand*{\phonfeat}[2]{%
  \left[
  \def\stacktype{L}
  \ifx V#1\def\stackalignment{c}\else
    \ifx C#1\def\stackalignment{c}\else
      \def\stackalignment{l}
    \fi
  \fi
  \vcenter{\hbox{\stackon{\Longunderstack[l]{#2}}{#1}}}\right]}
\begin{document}
$\phonl{\phonfeat{V}{+back}}{[\alpha\text{back}]}{\phonfeat{V}{$\alpha$back} 
  \left(\text{C}_0\phonfeat{V}{$-$\,round\\ $-$\,low}_0 \text{C}_0\right)_{\!\!0} \# X
}$\bigskip

$\phonl{\phonfeat{V}{+back}}{[\alpha\text{back}]}{\phonfeat{V}{$\alpha$back} 
  \left(\text{C}_0\phonfeat{V}{$-$\,round\\ $-$\,low\\$-$\,xxx}_0 \text{C}_0\right)_{\!\!0} \# X
}$
\end{document}

enter image description here

ORIGINAL ANSWER

I did some adaptation to stacks. It also now runs in math mode, though arguments to \phonfeatc and \phonefeatcl are still processed in text mode.

  1. To get the enlarged slash, I used the \stretchrel, which vertically stretches its 1st argument (here ~/~) to match the vertical footprint of its second argument (here, #3 of \phonl).

  2. By converting the macros to be processed in math mode, I could employ \left(...\right) directly, to grow the parens to the proper size.

  3. To get the proper alignment of the 3-level vector, I employed a nested stack in the form of the macro \phonfeatcl, in which the bottom 2 rows are a left-aligned \Longunderstack and the top row gets stacked, centered, atop it.

  4. Because processing proceeds in math mode, the subscripts will properly attach to the vertical base of what precedes them.

The MWE:

\documentclass{article}
\usepackage{scalerel,stackengine,amsmath}
\strutlongstacks{T}
\setstackEOL{\\}
\newcommand*{\phold}{\rule[-1.5pt]{1em}{.5pt}}
\newcommand*{\phon}[2]{#1 \rightarrow{} #2}
\newcommand*{\phonl}[3]{\phon{#1}{#2}\stretchrel{~/~}{#3}\phold}
\newcommand*{\phonfeatc}[1]{% features are centered
  \left[\Centerstack{#1}\right]}
\newcommand*{\phonfeatcl}[2]{% features are centered
  \left[\def\stacktype{L}\stackon{\Longunderstack[l]{#2}}{#1}\right]}
\begin{document}
$\phonl{\phonfeatc{V\\ +back}}{[\alpha\text{back}]}{\phonfeatc{V\\ $\alpha$back} 
  \left(\text{C}_0\phonfeatcl{V}{$-$\,round\\ $-$\,low}_0 \text{C}_0\right)_{\!\!0} \# X
}$
\end{document}

enter image description here

| improve this answer | |
  • Could you comment on how you achieved the various things I asked for in my question? I really have no idea what all these "stack" commands are doing. – Sverre Aug 22 '17 at 13:33
  • 1
    @Sverre Done, per your request. – Steven B. Segletes Aug 22 '17 at 13:44
  • Out of curiosity, why do the brackets in the last matrix not fully enclose its content vertically? – Sverre Aug 22 '17 at 13:50
  • 1
    @Sverre I have just added \strutlongstacks{T} to the preamble to remedy that. – Steven B. Segletes Aug 22 '17 at 13:52
  • For \phonfeatcl, if I need a matrix with three left aligned rows below the top V, do I change \Longunderstack[l]{#2} to \Longunderstack[l]{#3}? – Sverre Aug 22 '17 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.