2

I'm trying to typeset three rewrite rules to each other. Each rule is contained in an expex example to keep consistent with the numbering elsewhere in the document. At present, I have the following:

Three badly-aligned rewrite rules

Which can be produced with the following code:

\documentclass{scrreprt}

\usepackage{expex}
\usepackage{phonrule}

\begin{document}

\pex \a \phon{1m.Irr}{\oneof[l]{ \envr{ŋaŋ}{[+son]} \ \envr{ŋaŋu}{[$-$son]}}} \a \phon{12m.Irr}{\oneof[l]{ \envr{naŋ}{[+son]} \ \envr{naŋu}{[$-$son]}}} \a \phon{2m.R}{\oneof[l]{ \envr{nuŋ}{[+son]} \ \envr{nuŋu}{[$-$son]}}} \xe

\end{document}

However, the alignment is pretty unsightly. Specifically, I would like to horizontally align the arrows, braces and environments across each rule with each other. If possible, I would like advice on a general solution to aligning across examples, since the issue comes up fairly frequently; however, I would prefer not to spend weeks learning the ins and outs of tex programming in order to achieve this!

There are several questions and answers posted on here to do with alignment of single elements within rules using phonrule, but so far as I am aware no one has asked before about alignment of elements across multiple rules.

  • this question and that question and their comments and answers might be helpful. I'd begin with the tabto package. – benjamin Jan 06 '21 at 10:57
  • Thank you, @benjamin. I loaded tabto in the preamble and changed the code thus:
    \a
    \phon{1m.Irr}{\tabto{2cm}\oneof[l]{
    \envr*{ŋaN}{[+son]} \\
    \envr*{ŋaŋu}{[$-$son]}}}
    \a
    \phon{12m.Irr}{\tabto{2cm}\oneof[l]{
    \envr*{naN}{[+son]} \\
    \envr*{naŋu}{[$-$son]}}}
    \a
    \phon{2m.R}{\tabto{2cm}\oneof[l]{
    \envr*{nuN}{[+son]} \\
    \envr*{nuŋu}{[$-$son]}}}
    \xe```
    This tabs the elements correctly, but it interferes with the vertical spacing (making the parts overlap). I don't mind adding in vertical space, but do you know why this is so?
    
    – Peter Nyhuis Torres Jan 11 '21 at 02:59

1 Answers1

2

The simplest solution, I think, would be to make a fixed width box for the first part of the phonological rule. Then arrows will all line up correctly. Here's a modified version of the \phon macro called \fphon which uses a length set initially to be the longest string in the group. You can set this globally (if most of the left hand sides of the rules are about the same length) or locally per example set.

\documentclass{scrreprt}

\usepackage{expex}
\usepackage{phonrule} \usepackage{calc} \newlength{\fixedlen} \setlength{\fixedlen}{\widthof{12m.Irr}} \newcommand{\fphon}[3][\parrow]{\parbox{\fixedlen}{#2} #1 #3} \begin{document}

\pex \a \fphon{1m.Irr}{\oneof[l]{ \envr{ŋaŋ}{[+son]} \ \envr{ŋaŋu}{[$-$son]}}} \a \fphon{12m.Irr}{\oneof[l]{ \envr{naŋ}{[+son]} \ \envr{naŋu}{[$-$son]}}} \a \fphon{2m.R}{\oneof[l]{ \envr{nuŋ}{[+son]} \ \envr{nuŋu}{[$-$son]}}} \xe

\end{document}

output of code

If you also want the slashes to line up, then you can modify the internal \@env command to also use a fixed width box:

\documentclass{scrreprt}

\usepackage{expex}
\usepackage{phonrule} \usepackage{calc} \newlength{\fixedlen} \newlength{\rfixedlen} \setlength{\fixedlen}{\widthof{12m.Irr}} \setlength{\rfixedlen}{2em} \newcommand{\fphon}[3][\parrow]{\parbox{\fixedlen}{#2} #1 #3} \makeatletter \renewcommand*{@env}[3]{\parbox{\rfixedlen}{#2}~/#1#3} \makeatother \begin{document}

\pex \a \fphon{1m.Irr}{\oneof[l]{ \envr{ŋaŋ}{[+son]} \ \envr{ŋaŋu}{[$-$son]}}} \a \fphon{12m.Irr}{\oneof[l]{ \envr{naŋ}{[+son]} \ \envr{naŋu}{[$-$son]}}} \a \fphon{2m.R}{\oneof[l]{ \envr{nuŋ}{[+son]} \ \envr{nuŋu}{[$-$son]}}} \xe

\end{document}

output of second code

Alan Munn
  • 218,180