5

I'm figuring out how to do metrical phonology using the pst-asr package, and using this code:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Charis SIL}

\usepackage{pstricks,pst-xkey,pst-asr,graphicx}\psset{everyasr=\tiershortcuts}

\usepackage{linguex}

% adds tiers for feet and words
\newtier{ft}\psset{ft=(sy) +3.5ex ([)}
\newtier{wrd}\psset{wrd=(ft) +4.5ex ([)}

% replaces `×' in timing tier with `c' and `v' where needed.
\newcommand{\xsymb}{}
\newcommand{\cons}{\renewcommand{\xsymb}{c}}% Consonant
\newcommand{\vowl}{\renewcommand{\xsymb}{v}}% Vowel

\begin{document}

\asr[tssym=\xsymb] \3\cons j: \vowl o\1\vowl o\1\vowl o \vowl o |
    \@(5,sy){$\sigma$} \-[xed=true,xedratio=.4](5,ts)
    \@(2,ft){foot} \-(1,sy) \-(3,sy)
    \@(4.5,ft){foot} \-(4,sy) \-(5,sy)
    \@(3.25,wrd){word} \-(2,ft) \-[linestyle=dotted](4.5,ft)
\endasr

\end{document}

I am able to get this:

enter image description here

However, when I try to use linguex to put this graphic in an example, using this code:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Charis SIL}

\usepackage{pstricks,pst-xkey,pst-asr,graphicx}\psset{everyasr=\tiershortcuts}

\usepackage{linguex}

% adds tiers for feet and words
\newtier{ft}\psset{ft=(sy) +3.5ex ([)}
\newtier{wrd}\psset{wrd=(ft) +4.5ex ([)}

% replaces `×' in timing tier with `c' and `v' where needed.
\newcommand{\xsymb}{}
\newcommand{\cons}{\renewcommand{\xsymb}{c}}% Consonant
\newcommand{\vowl}{\renewcommand{\xsymb}{v}}% Vowel

\begin{document}

\ex. \asr[tssym=\xsymb] \3\cons j: \vowl o\1\vowl o\1\vowl o \vowl o |
    \@(5,sy){$\sigma$} \-[xed=true,xedratio=.4](5,ts)
    \@(2,ft){foot} \-(1,sy) \-(3,sy)
    \@(4.5,ft){foot} \-(4,sy) \-(5,sy)
    \@(3.25,wrd){word} \-(2,ft) \-[linestyle=dotted](4.5,ft)
\endasr

\end{document}

I get this mess, if it typesets at all:

enter image description here

Note that the only difference is the addition of linguex's \ex. before the \asr environment.

Any help is appreciated!

Jagath
  • 4,287

2 Answers2

2

The \asr command makes | into an active character, which so disallows it being in the argument to another command. Note that only apparently \ex has no argument: actually its argument is whatever comes between the following period and the first blank line (or \par).

You can solve the issue with \scantokens:

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Charis SIL}

\usepackage{pstricks,pst-xkey,pst-asr,graphicx}\psset{everyasr=\tiershortcuts}

\usepackage{linguex}

% adds tiers for feet and words
\newtier{ft}\psset{ft=(sy) +3.5ex ([)}
\newtier{wrd}\psset{wrd=(ft) +4.5ex ([)}

% replaces `×' in timing tier with `c' and `v' where needed.
\newcommand{\xsymb}{}
\newcommand{\cons}{\renewcommand{\xsymb}{c}}% Consonant
\newcommand{\vowl}{\renewcommand{\xsymb}{v}}% Vowel

\begin{document}

\ex. \scantokens{\asr[tssym=\xsymb] \3\cons j: \vowl o\1\vowl o\1\vowl o \vowl o |
    \@(5,sy){$\sigma$} \-[xed=true,xedratio=.4](5,ts)
    \@(2,ft){foot} \-(1,sy) \-(3,sy)
    \@(4.5,ft){foot} \-(4,sy) \-(5,sy)
    \@(3.25,wrd){word} \-(2,ft) \-[linestyle=dotted](4.5,ft)
\endasr}

\end{document}

enter image description here

egreg
  • 1,121,712
1

I'm not sure what the intended output is but if I set the catcodes before using the macro I get:

enter image description here

\documentclass{article}

\usepackage{fontspec}
\setmainfont{Charis SIL}

\usepackage{pstricks,pst-xkey,pst-asr,graphicx}\psset{everyasr=\tiershortcuts}

\usepackage{linguex}

% adds tiers for feet and words
\newtier{ft}\psset{ft=(sy) +3.5ex ([)}
\newtier{wrd}\psset{wrd=(ft) +4.5ex ([)}

% replaces `×' in timing tier with `c' and `v' where needed.
\newcommand{\xsymb}{}
\newcommand{\cons}{\renewcommand{\xsymb}{c}}% Consonant
\newcommand{\vowl}{\renewcommand{\xsymb}{v}}% Vowel

\begin{document}

\makeatletter
\show\tierput@b

{\catcode`\|\active
\ex. \asr[tssym=\xsymb] \3\cons j: \vowl o\1\vowl o\1\vowl o \vowl o |
    \@(5,sy){$\sigma$} \-[xed=true,xedratio=.4](5,ts)
    \@(2,ft){foot} \-(1,sy) \-(3,sy)
    \@(4.5,ft){foot} \-(4,sy) \-(5,sy)
    \@(3.25,wrd){word} \-(2,ft) \-[linestyle=dotted](4.5,ft)
\endasr

}

\end{document}
David Carlisle
  • 757,742