我正在使用 expex 包编写示例(在语言学文章中)。根据文档,此包允许绘制箭头(表示语法中的移动)。expex 包文档的第 74 页中有一节介绍如何使用 pstricks 来执行此操作。
这是一个最小的工作示例(从 expex 文档中复制并粘贴),我无法编译,而且我不明白为什么。
\documentclass{article}
\usepackage{pstricks} % Apparently this is required to draw arrow with Expex (see p.74 of Expec doc)
\usepackage{expex} % package for glosses
\lingset{everygla=,aboveglftskip=0pt,*=?*, textoffset=!-.6em, everyglb=\footnotesize, everyglft=\slshape} % changes style of glosses
\begin{document}
\ex
This is a "control item", showing that the problem really comes from adding the stuff to draw arrows.
\xe
\ex
%\pss{angle=-90,nodesep=0pt,arrows=->,dima=.2em,labelsep=.25ex,linearc=.7ex}
\def\\#1(#2){\rnode{#2}{\strut #1}} %
%
\vrule height0pt depth5.3ex width0pt
\\Whom(A) did John persuade \\t(B) [ PRO to visit \\whom(C) ]
\ncbar[armA=3.5ex,offsetB=\lingdima]{B}{A}
\bput{0}{$M_{sp}=2$}
\ncbar[armA=4.5ex,offsetB=-\lingdima]{C}{A}
\bput{0}(1.2){$M_{sp}=6$}
\xe
\end{document}
结果看起来应该是这样的。(此快照取自 expex 文档第 74 页。)
感谢您的帮助!
答案1
如果使用TikZ
是一个选项,这可以轻松完成:
代码:
\documentclass{article}
\usepackage{expex}
\usepackage{tikz}
\usepackage{xparse}
\lingset{everygla=,aboveglftskip=0pt,*=?*, textoffset=!-.6em, everyglb=\footnotesize, everyglft=\slshape}
\newcommand\Tikzmark[2]{%
\tikz[remember picture]\node[inner sep=0pt,outer sep=0pt] (#1) {#2};%
}
\NewDocumentCommand\DrawArrow{O{}mmmmO{3}}{
\tikz[remember picture,overlay]
\draw[->,rounded corners,line width=0.8pt,shorten >= 2pt,shorten <= 2pt,#1]
(#2) -- ++(0,-#6\ht\strutbox) coordinate (aux) -- node[#4] {#5} (#3|-aux) -- (#3);
}
\begin{document}
\ex
W\Tikzmark{enda}{h}\Tikzmark{endb}{o}m(A) did John persuade \Tikzmark{starta}{t}(B) [ PRO to visit w\Tikzmark{startb}{h}om(C) ]
\xe
\DrawArrow{starta}{enda}{above}{$M_{sp}=2$}
\DrawArrow{startb}{endb}{above,pos=0.15}{$M_{sp}=6$}[3.5]
\end{document}
您可以\Tikzmark
放置一些标记,然后\DrawArrow
在标记之间画箭头。
该\DrawArrow
命令具有语法
\DrawArrow[<tikz options>]{<start-mark>}{<end-mark>}{<options for the node>}{<label>}[<vertical shift>]