我正在研究如何使用该pst-asr
包进行韵律音系学,并使用以下代码:
\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}
我可以得到这个:
但是,当我尝试使用 linguex 将此图形放入示例中时,使用以下代码:
\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}
如果它排版的话我会得到这样的混乱:
请注意,唯一的区别是在环境之前添加linguex
了。\ex.
\asr
任何帮助都将不胜感激!
答案1
该\asr
命令将其转换|
为活动字符,因此不允许将其作为另一个命令的参数。请注意,仅表面上\ex
没有参数:实际上它的参数是以下句点和第一个空白行(或\par
)之间的任何内容。
您可以使用以下方法解决该问题\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}
答案2
我不确定预期的输出是什么,但如果我在使用宏之前设置了 catcodes,我会得到:
\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}