0

This question piggybacks off of the question/answer here, where one answer mentions how to create a phonological rule using the phonrule package.

MWE here:

\documentclass[a4paper,12pt,twoside,onecolumn]{memoir}

\usepackage{phonrule}

\begin{document}

\phon{x}{\oneof{
\envr{w}{z} \\
\envl{v}{\phonfeat{
+feature x \\
-feature y}}}}

\end{document}

Results in:

enter image description here

You can see that output and environments are centered. Is there any way to un-center them and/or left-align them? The centering that it does appears to be an intentional addition in v1.2.0 of phonrule. But there is nothing else in the documentation regarding alignment.

I need it to be the standard left-aligned version - that is, left-aligned output and left-aligned environment. Something like this (exact spacing is flexible):

enter image description here

Trying to throw in any type of alignment generally breaks the phonrule environment and it won't compile or it aligns the entire figure/example, rather than just the individual (output + environment) sections.

I have been using roughly the same as the other answer from the above question which utilizes \mbox. This is fine, but adding additional outputs and environments is either messy or requires a new command based on the differences. phonrule generally does all this in a much cleaner and more expandable way, which is why I'm looking into being able to modify the alignment.

2
  • 2
    I suggest asking this question on the TeX stackexchange tex.stackexchange.com Dec 2, 2016 at 9:46
  • Will do. Thought I'd trying in the same sub (linguistics) as that other question first.
    – whatisit
    Dec 3, 2016 at 9:07

1 Answer 1

0

The answer to this can be found over at tex.stackexchange.com. The accepted answer from egreg is repeated here, for future convenience.

Here's a complete reimplementation of phonrule:

\documentclass{article}

\providecommand*{\textrightarrow}{\ensuremath{\rightarrow}}
\providecommand*{\textplus}{\ensuremath{+}}
\providecommand*{\textminus}{\ensuremath{-}}

\newcommand*{\phold}{\rule[-1.5pt]{1.5ex}{.5pt}}

\newcommand*{\phon}[2]{#1 \textrightarrow{} #2}
\newcommand*{\phonc}[3]{\phon{#1}{#2}~/~#3}
\newcommand*{\phonr}[3]{\phon{#1}{#2}~/~\phold#3}
\newcommand*{\phonl}[3]{\phon{#1}{#2}~/~#3\phold}
\newcommand*{\phonb}[4]{\phonl{#1}{#2}{#3}#4}

\makeatletter
\newcommand*{\env}{\@ifstar{\@env{&}}{\@env{~}}}
\newcommand*{\@env}[3]{#2~/#1#3}

\newcommand*{\envr}{\@ifstar{\@envr{&}}{\@envr{~}}}
\newcommand*{\@envr}[3]{\@env{#1}{#2}{\phold#3}}
\newcommand*{\envl}{\@ifstar{\@envl{&}}{\@envl{~}}}
\newcommand*{\@envl}[3]{\@env{#1}{#2}{#3\phold}}
\newcommand*{\envb}{\@ifstar{\@envb{&}}{\@envb{~}}}
\newcommand*{\@envb}[4]{\@env{#1}{#2}{#3\phold#4}}

% set environment for feature matrix with square brackets
\newcommand*{\phonfeat}[1]{%
  \ensuremath{%
    \left[\begin{tabular}{c}#1\end{tabular}\right]%
  }%
}
\newcommand*{\oneof}[2][c]{%
  \ensuremath{%
    \left\{
    \begin{tabular}{#1#1}#2\end{tabular}
    \right.
  }%
}

\begin{document}
\phon{x}{\oneof[l]{ \envr*{w}{z} \\
      \envl*{v}{\phonfeat{
      \textplus feature x \\
      \textminus feature y
}}}}

\phon{x}{\oneof[l]{
   \envr{w}{z} \\
   \envl{v}{\phonfeat{
   \textplus feature x \\
   \textminus feature y
}}}}

\phon{x}{\oneof{
   \envr{w}{z} \\
   \envl{v}{\phonfeat{
   \textplus feature x \\
   \textminus feature y
}}}}

\end{document}

The changes are:

  1. The \oneof command accepts an optional argument for the inner alignment, default c like in the original; it can be l or r.

  2. The commands \env, \envl, \envr and \envb have a *-form, which inserts an & after / instead of the default ~, so they can be used in the argument of \oneof in order to get the alignment you wish.

In the code above I used all three possibilities; the first example is what you're looking for, the second one just has left alignment, the final one is like the original.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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