![在 ExPex 中悬挂缩进的开头创建符号、箭头和文本](https://linux22.com/image/367559/%E5%9C%A8%20ExPex%20%E4%B8%AD%E6%82%AC%E6%8C%82%E7%BC%A9%E8%BF%9B%E7%9A%84%E5%BC%80%E5%A4%B4%E5%88%9B%E5%BB%BA%E7%AC%A6%E5%8F%B7%E3%80%81%E7%AE%AD%E5%A4%B4%E5%92%8C%E6%96%87%E6%9C%AC.png)
我正在使用包含大量示例的包,这些示例由于内容expex
的长度而分成两行或更多行。和选项工作正常,没有问题。\gla
\glb
normal
cascading
glhangstyle
但是,我有时发现这些示例文本繁多,难以从视觉上理解。我考虑在每行开头添加一个符号或箭头作为悬挂缩进的可能性。在尝试了 之后\xpatchcmd
,我确定我对 还不够熟悉,无法expex
弄清楚——如果它甚至可能的话。
我没有 MWE,但我从expex
文档中附上了一张图像,后面是我修饰过的一张,以展示我希望实现的示例。这个例子包括一个箭头,但我希望我可以在那里包含任何东西,比如一个符号。假设这是可能的,我认为它应该适用于和normal
选项cascading
……甚至可能none
?
级联示例的 MWE 摘录自expex-demo.tex
:
\documentclass{article}
\usepackage{expex}
\begin{document}
\ex[glhangstyle=cascade]
\let\\=\textsc
\begingl
\gla
Hom\^{a}o sa \v{c}\^{o} p\^{o} tha \~{n}u nao ng\u{a} hmua. \~{N}u
dj\u{a} g\u{a}, \~{n}u dj\u{a} \v{c}\u{o}ng \~{n}u, laih gui r\^{e}o
\~{n}u. Todang bboi r\^{o}k jolan \~{n}u nao hma, \~{n}u bb\^{o}h sa
droi mr\u{a} d\u{o} bboi gah, a, hruh \~{n}u.//
\glb
\\{exist} one \\{clf} person old \\{3s} go do field \\{3s} hold
machete \\{3s} hold hoe \\{3s} and carry.on.back back.basket \\{3s}
while at along trail \\{3s} go field \\{3s} see one \\{clf} peacock
stay at \\{drct} -- nest \\{3s}//
\glft
`There was an old person who went to work in the field. He took
along his machete, he took along his hoe, and he carried his
basket on his back. While he was on his way to the farm, he saw a
peacock beside its nest.'//
\endgl
\xe
\end{document}
答案1
这是一个受启发的解决方案这个帖子有一些小的改动。我发布了这里关于自动化的问题。
\documentclass{article}
\usepackage{expex}
\usepackage{tikz}
\usepackage{xparse}
% https://tex.stackexchange.com/a/231044/121944
\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[->,line width=0.5pt,shorten >= 2pt,shorten <= 2pt,#1]
(#2) -- ++(0,-#6\ht\strutbox) coordinate (aux) -- node[#4] {#5} (#3|-aux);
}
%
\begin{document}
\ex[glhangstyle=cascade]
\let\\=\textsc
\begingl
\gla
Hom\^{a}o sa \v{c}\^{o} p\^{o} tha \~{n}u nao ng\u{a} hmua. \~{N}u
dj\u{a} g\u{a}, \~{n}u dj\u{a} \v{c}\u{o}ng \~{n}u, laih gui r\^{e}o
\~{n}u. Todang bboi r\^{o}k jolan \~{n}u nao hma, \~{n}u bb\^{o}h sa
droi mr\u{a} d\u{o} bboi gah, a, hruh \~{n}u.//
\glb
\\{\Tikzmark{starta}exist} one \\{clf} person old \\{3s} go do field \\{3s} hold
machete \\{3s} \Tikzmark{enda}hold hoe \\{3s} and carry.on.back back.basket \\{3s}
while at along trail \\{3s} go field \\{3s} see one \\{clf} peacock
stay at \\{drct} -- nest \\{3s} //
\glft
`There was an old person who went to work in the field. He took
along his machete, he took along his hoe, and he carried his
basket on his back. While he was on his way to the farm, he saw a
peacock beside its nest.'//
\endgl
\xe
\DrawArrow{starta}{enda}{}{}
\ex[glhangstyle=cascade]
\let\\=\textsc
\begingl
\gla
Hom\^{a}o sa \v{c}\^{o} p\^{o} tha \~{n}u nao ng\u{a} hmua. \~{N}u
dj\u{a} g\u{a}, \~{n}u dj\u{a} \v{c}\u{o}ng \~{n}u, laih gui r\^{e}o
\~{n}u. Todang bboi r\^{o}k jolan \~{n}u nao hma, \~{n}u bb\^{o}h sa
droi mr\u{a} d\u{o} bboi gah, a, hruh \~{n}u.//
\glb
\\{exist} one \\{clf} person old \\{3s} go do field \\{3s} hold
machete \\{3s} \Tikzmark{starta}hold hoe \\{3s} and carry.on.back back.basket \\{3s}
while at along \Tikzmark{enda}trail \\{3s} go field \\{3s} see one \\{clf} peacock
stay at \\{drct} -- nest \\{3s} //
\glft
`There was an old person who went to work in the field. He took
along his machete, he took along his hoe, and he carried his
basket on his back. While he was on his way to the farm, he saw a
peacock beside its nest.'//
\endgl
\xe
\DrawArrow{starta}{enda}{}{}
\ex[glhangstyle=cascade]
\let\\=\textsc
\begingl
\gla
Hom\^{a}o sa \v{c}\^{o} p\^{o} tha \~{n}u nao ng\u{a} hmua. \~{N}u
dj\u{a} g\u{a}, \~{n}u dj\u{a} \v{c}\u{o}ng \~{n}u, laih gui r\^{e}o
\~{n}u. Todang bboi r\^{o}k jolan \~{n}u nao hma, \~{n}u bb\^{o}h sa
droi mr\u{a} d\u{o} bboi gah, a, hruh \~{n}u.//
\glb
\\{\Tikzmark{starta}exist} one \\{clf} person old \\{3s} go do field \\{3s} hold
machete \\{3s} \Tikzmark{enda}h\Tikzmark{startb}old hoe \\{3s} and carry.on.back back.basket \\{3s}
while at along \Tikzmark{endb}trail \\{3s} go field \\{3s} see one \\{clf} peacock
stay at \\{drct} -- nest \\{3s} //
\glft
`There was an old person who went to work in the field. He took
along his machete, he took along his hoe, and he carried his
basket on his back. While he was on his way to the farm, he saw a
peacock beside its nest.'//
\endgl
\xe
\DrawArrow{starta}{enda}{}{}
\DrawArrow{startb}{endb}{}{}
\end{document}
答案2
答案到这个问题帮助为这个答案提供了一个起点,它不需要任何额外的包(除了expex
)。我确实包括了,mathabx
因为它有一个方便的有角度的箭头。但是,下面的答案可以采用任何文本或符号。
这也需要\tlap
我在这个答案对一个不相关的问题。
\documentclass{memoir}
\usepackage[mathb]{mathabx}
\usepackage{expex}
% Define spacing and example number format for (all) ExPex examples
\lingset{exnotype=chapter.arabic,%
glhangstyle=cascade,
glhangindent=2em}%
\newcommand{\tlap}[1]{\vbox to 0pt{\vss\hbox{#1}}}%
\newcommand{\insertcascadeexpexsymbol}[2]{%
\let\tmpdima\relax%
\newlength\tmpdima%
\tmpdima=1.5em%
\newcount\tmpcnta%
\tmpcnta=\numexpr#1-1\relax%
\newcount\tmpcntc%
\tmpcntc=\numexpr#1-2\relax%
\newcount\tmpcntb%
\tmpcntb=0%
\let\indentdiminitial\relax%
\newlength\indentdiminitial%
\indentdiminitial=-0.8em%
\let\indentdimincrement\relax%
\newlength\indentdimincrement%
\indentdimincrement=2.0em%
\let\tmpdiminitial\relax%
\newlength\tmpdiminitial%
\tmpdiminitial=5.475em%
\let\tmpdimincrement\relax%
\newlength\tmpdimincrement%
\tmpdimincrement=2.475em%
\let\tmpdimeachlineinitial\relax%
\newlength\tmpdimeachlineinitial%
\tmpdimeachlineinitial=1.475em%
\let\tmpdimeachlineincrement\relax%
\newlength\tmpdimeachlineincrement%
\tmpdimeachlineincrement=0.035em%
\let\dimverticalfix\relax%
\newlength\dimverticalfix%
\dimverticalfix=-\dimexpr\tmpdiminitial+\tmpcntc\tmpdimincrement\relax%
\let\dimverticaleachlinefix\relax%
\newlength\dimverticaleachlinefix%
\dimverticaleachlinefix=\dimexpr\tmpdimeachlineinitial-\tmpcntc\tmpdimeachlineincrement\relax%
\tlap{\vspace*{\dimverticalfix}%
\rlap{\vbox{\loop\ifnum\tmpcntb < \tmpcnta%
\advance\tmpcntb by 1%
\hspace*{\dimexpr\indentdiminitial+\tmpcntb\indentdimincrement\relax}{#2}\vspace*{\dimverticaleachlinefix}\newline%
\repeat}}}}%
\begin{document}
\let\\=\textsc
\ex
\begingl
\gla
Hom\^{a}o sa \v{c}\^{o} p\^{o} tha \~{n}u nao ng\u{a} hmua. \~{N}u dj\u{a} g\u{a}, \~{n}u dj\u{a} \v{c}\u{o}ng \~{n}u, laih gui r\^{e}o \~{n}u. Todang bboi r\^{o}k jolan \~{n}u nao hma, \~{n}u bb\^{o}h sa droi mr\u{a} d\u{o} bboi gah, a, hruh \~{n}u. //\insertcascadeexpexsymbol{4}{$\drsh$}
\glb
\\{exist} one \\{clf} person old \\{3s} go do field \\{3s} hold machete \\{3s} hold hoe \\{3s} and carry.on.back back.basket \\{3s} while at along trail \\{3s} go field \\{3s} see one \\{clf} peacock stay at \\{drct} -- nest \\{3s} //
\glft
`There was an old person who went to work in the field. He took along his machete, he took along his hoe, and he carried his basket on his back. While he was on his way to the farm, he saw a peacock beside its nest.' //
\endgl
\xe
\end{document}
例如,如果用 替换\hspace*{\dimexpr\indentdiminitial+\tmpcntb\indentdimincrement\relax}
,\hspace*{1em}
您可以使符号垂直向下移动,但不遵循级联缩进:
如果你更喜欢使用expex
with normal
for glhangstyle
,那也没问题:
通过在包含 a 的行和包含 a 的行\insertcascadeexpexsymbol
之后立即调用命令,您可以获得与示例重叠的箭头。//
\gla
\tlap
\rlap
\vbox
这个答案远非完美,但根据我的测试,它确实实现了对箭头的粗略近似,并且适用于 2 行示例到至少 6 行示例。
第一个参数\insertcascadeexpexsymbol
是行数(可以在编译示例一次后确定。
的第二个参数\insertcascadeexpexsymbol
是要插入的符号或文本。我使用的是包\drsh
中定义的数学符号。mathabx
给感兴趣的人一些解释:
里面\insertcascadeexpexsymbol
有很多垂直位置的混乱。我想不出更好的方法,但也许更精明的 TeX 用户可能知道如何改进这一点。我发现的基本问题是,行间/行内间距似乎会根据和中的行总数略有变化\gla
。\glab
我尝试只使用\newline
s,但遇到了同样的问题。所有计算都只是为了尝试均衡 2 行、3 行、4 行等示例中的符号/文本的位置。
还使用了许多硬编码长度。我希望使用 中的变量expex
,但无法弄清楚如何在 之外引用它们而expex
不会undefined
出错。例如,我宁愿让它相对于 中使用的悬挂缩进值(默认expex
值或 中定义的值),而不是在命令内部硬编码悬挂缩进值\lingset
。我希望能够访问这些变量至少在一定程度上有助于改进此命令,可能包括我使用的垂直计算诡计。
答案3
我的上一个答案有效,但效果不是很好。例如,如果您更改aboveglbskip
和aboveglcskip
值,则所有硬编码计算都需要非常仔细地调整。有很多细节可能会对将来的某人有所帮助,这就是为什么我发布新答案而不是编辑旧答案的原因。
改进答案
我在其中修补了两个命令,expex
以允许 avbox
重叠行间注释线。单条注释线(即仅 \gla)和使用多条注释线(例如 \gla 和 \glb,或 \gla 和 \glb 和 \glc)之间的行为有所不同。
警告:这确实不是为光泽而工作nlevel
。
大多数行都包含注释。因此,请参阅 MWE 以获取有关发生原因/情况的解释注释。
\documentclass[a4paper,12pt,final]{memoir}
\usepackage{xpatch}
%%%%%%%%%%%%%%%%
% (begin) ExPex update to allow arrows
%%%%%%%%%%%%%%%%
\makeatletter
\@ifclassloaded{memoir}{\let\tt\texttt}{}%This is required, because expex uses \tt, which memoir does not allow
\makeatother
% Include ExPex for having sentences with glossing and translation
\usepackage{expex}
\makeatletter
% Create an additional \gl@maxhtlast (to complement existing \gl@maxdplast)
%% --inside \glw@updatelists
\newdimen\gl@maxhtlast
\xpatchcmd{\glw@updatelists}
{\global\gl@maxdplast=\glw@maxdp}
{\global\gl@maxhtlast=\glw@maxht
\global\gl@maxdplast=\glw@maxdp}
{}{}%
% Add a new box to overlay arrows (or whatever) to the left side of the top interlinear gloss line
%% --inside \glw@printilg@a
\xpatchcmd{\glw@printilg@a}
{\glw@printilg@b \par }
{\glw@printilg@b \par %
% DO NOTHING, IF NO GLARROW WAS SPECIFIED BY USER
\ifx\ling@glarrow\empty%
%do nothing
% OTHERWISE, USER DID SPECIFY A GLARROW
\else%
% Create new dimension for above skips (e.g. aboveglaskip, aboveglbskip, aboveglcskip etc.)
\newdimen\dim@aboveskip%
% Give a default value of 0pt
\global\dim@aboveskip=0pt%
% Create a new counter for the number if interlinear gloss lines
\newcount\numglwlines%
% Give a default value of 0
\global\numglwlines=0%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Loop through one GLWORD
%%% Calculate the abovegl<N>skip total (into \dim@aboveskip)
%%% and Count number of gloss lines (into \numglwlines)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DON'T MODIFY EXISTING TOKENS, LISTS, OR OPERATORS (TO BE SAFE)
% INSTEAD, USE A TEMPORARY VERSION WITH THE SAME VALUE
\let\temp@currentitem\@currentitem%
\let\countlineslist\mainlist%
\let\gl@lop@temp\gl@lop%
% Get the first GLWORD from token list
% and use it to to count the interlinear gloss lines
\gl@lop@temp\countlineslist\to\temp@currentitem\relax%
% If the item is \empty, ignore. Otherwise, count the lines
\ifx\temp@currentitem\empty%
\else%
% DON'T MODIFY EXISTING TOKENS, LISTS, OR OPERATORS (TO BE SAFE)
% INSTEAD, USE A TEMPORARY VERSION WITH THE SAME VALUE
\let\temp@aboveskip\@aboveskip%
\let\tempaboveskiplist\aboveskiplist%
\let\gltoks@next@temp\gltoks@next%
\let\gl@lopTL@temp\gl@lopTL%
% GLWORD is not \empty, therefore it contains at least one line
% Add one to \numglwlines counter
\global\advance\numglwlines by 1%
% Set value to TRUE to loop through GLWORD lines
\gl@loopmoretrue%
\loop\ifgl@loopmore%
% Get the `aboveskip' value for current gloss line
\gl@lop\tempaboveskiplist\to\temp@aboveskip%
% If value is 0pt, do nothing
\ifdim\temp@aboveskip=0pt%
%do nothing
% Otherwise, above skip value is set to something
\else%
% Store current \dim@aboveskip value into temporary value
\let\dim@aboveskip@temp\dim@aboveskip%
% Add current `above skip' value to existing sum of `above skip' values
\global\dim@aboveskip=\dimexpr\dim@aboveskip@temp+\temp@aboveskip\relax%
\fi%
% Get the next token (i.e. line) of the GLWORD
\gl@lopTL\temp@currentitem\to\gltoks@next@temp%
% If token (line) is \empty, we are finished looping
\ifx\temp@currentitem\empty%
\gl@loopmorefalse%
% Otherwise, increment the number of lines, and continue looping
\else
\global\advance\numglwlines by 1%
\fi%
\repeat%
% Set to FALSE as a precaution
\gl@loopmorefalse%
% Free up memory of temporary items
\let\temp@aboveskip\relax%
\let\tempaboveskiplist\relax%
\let\gltoks@next@temp\relax%
\let\gl@lopTL@temp\relax%
\fi%
% Free up memory of temporary items
\let\temp@currentitem\relax%
\let\countlineslist\relax%
\let\gl@lop@temp\relax%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Countdown of wrapped lines in the interlinear glosses `paragraph' to zero
%% used for looping until we reach the final line
\newcount\ep@countdown@ilg@para@lines%
\ep@countdown@ilg@para@lines=\prevgraf%
% Number of wrapped lines in the interlinear glosses `paragraph'
\newcount\ep@num@ilg@para@lines%
\ep@num@ilg@para@lines=\prevgraf%
% Count the number of lines processed so far
\newcount\ep@num@lines%
\ep@num@lines=0%
% Create a \vbox to overlay on top of the interlinear glosses
\setbox0\vbox
{%
\ifnum\numglwlines=1%only gla exists
%do nothing
\else%
% If at least 2 paragraph lines, the initialize the vertical skip
%% (note: the first line does not contain an arrow, so only other lines are `processed')
\ifnum\ep@num@ilg@para@lines>1%
%Shift upwards, the amount of space between each interlinear line
%e.g. between \gla and \glb, between \glb and \glc, etc.
%these spaces are defined by variables: aboveglbskip, aboveglcskip, aboveglftskip, etc.
\vskip -\dimexpr\dim@aboveskip*(\ep@num@ilg@para@lines-1)\relax%
%Shift upwards, the amount of \gl@maxhtlast (height, not depth, of each glword)
\vskip -\dimexpr\gl@maxhtlast*\numglwlines*(\ep@num@ilg@para@lines-1)\relax%
%Shift upwards, the amount of \gl@maxdplast (depth, not height, of each glword)
\vskip -\dimexpr\gl@maxdplast*\numglwlines*(\ep@num@ilg@para@lines-1)\relax%
%Shift upwards, the amount of \lingextraglskip (interlinear skips)
\vskip -\dimexpr\lingextraglskip*(\ep@num@ilg@para@lines-2)\relax%
\fi%
\fi%
% For some reason, the paragraph glue values
% need be used in \vskip
% IS THIS ALWAYS TRUE?? ONLY SOMETIMES??
\vskip -\the\gluestretch\parskip%
\vskip -\the\glueshrink\parskip%
%Loop through the paragraph lines
\loop%
\ifnum\ep@countdown@ilg@para@lines=\ep@num@ilg@para@lines%
%do nothing
\else%
\ling@everygla%
\newdimen\ep@dim@arrow@indent%
\ep@dim@arrow@indent=0pt%
% If hangstyle is `normal' then use a consistent horizontal offset
\ifnum\ep@glhangstyle=1%
% Use the standard hanging indent
\ep@dim@arrow@indent=\dimexpr\ling@glhangindent\relax%
\fi%
% If hangstyle is `cascade' then use a cascading horizontal offset
\ifnum\ep@glhangstyle=2%
% Set offset to the hanging indent amount multiplied by the current line number
\ep@dim@arrow@indent=\dimexpr(\ling@glhangindent*\ep@num@lines)\relax%
\fi%
% Create \hbox to contain the arrow and indent offset
\hbox{%
% Create horizontal indentation
\hspace*{\ep@dim@arrow@indent}%
% Create the arrow
\raisebox{-\ling@aboveglarrowskip}[\height][0pt]{\llap{\ling@glarrow}}%
% Use a \vrule to make sure the line height is consistent
\vrule height\dimexpr\gl@maxhtlast\relax depth\dimexpr\gl@maxdplast\relax width 0pt%
}%
% Add `above skips' for one horizontal line of GLWORDS
\vskip \dim@aboveskip%
% Add remaining heights for one horizontal line of GLWORDS
\vskip \dimexpr(\gl@maxdplast)*\numexpr\numglwlines-1\relax\relax%
% Add remaining depths for one horizontal line of GLWORDS
\vskip \dimexpr(\gl@maxhtlast)*\numexpr\numglwlines-1\relax\relax%
% Add extraglskip vertical skip, if necessary
\ifnum\numglwlines=1%only gla exists, no \lingextraglskip is used in this case
%do nothing
\else%
% If there are 3 or more wrapped lines, then also add
% vertical skip defined by extraglskip (\lingextraglskip)
\ifnum\ep@countdown@ilg@para@lines>1%
\vskip \lingextraglskip%
\fi%
\fi%
\fi%
% Line countdown to zero (by increments of 1)
\advance\ep@countdown@ilg@para@lines -1%
% Processed line counter (by increments of 1)
\advance\ep@num@lines 1%
% If countdown has not reached zero yet, keep looping
\ifnum\ep@countdown@ilg@para@lines>0%
\repeat%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Display the vbox content
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If only one line, GLWORDS function similar to a regular paragraph
%% therefore, use a \raisebox to overlap the arrows
\ifnum\numglwlines=1
\raisebox{\dimexpr(\gl@maxhtlast+\gl@maxdplast)*(\ep@num@ilg@para@lines-1)\relax}[\height][0pt]{\box0}%
% Otherwise, display the box normally (because overlapping is already possible)
\else%
\box0%
\fi%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fi%
}
{}{}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DEFINE TWO NEW KEYS FOR USE WITHIN \lingset{}
%%% glarrow -> an arrow symbol (but could be any symbol or text)
%%% aboveglarrowskip -> vertical space above the arrow (similar to aboveglbskip and aboveglcskip)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\define@lingkey{glarrow}{\def\ling@glarrow{#1}}%
\lingset{glarrow=}%
\define@lingkey{aboveglarrowskip}{\def\ling@aboveglarrowskip{#1}}%
\lingset{aboveglarrowskip=0pt}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother
\lingset{numoffset=\leftmargin,%
textoffset=0.75em,%
extraglskip=!1.1ex,%
glspace=!0.01em,%
belowglpreambleskip=!0ex,%
aboveglbskip=-0.9ex,%
aboveglcskip=-0.9ex,%
aboveglftskip=-0.1ex,%
exnotype=chapter.arabic,%
aboveglarrowskip=0pt,%DEFAULT
glarrow=\tiny$\hookrightarrow$,%DEFAULT IS glarrow= (i.e. empty)
glhangstyle=cascade,%
glhangindent=2em}%
\begin{document}
\let\\=\textsc
\ex
\begingl
\gla
Hom\^{a}o sa \v{c}\^{o} p\^{o} tha \~{n}u nao ng\u{a} hmua. \~{N}u dj\u{a} g\u{a}, \~{n}u dj\u{a} \v{c}\u{o}ng \~{n}u, laih gui r\^{e}o \~{n}u. Todang bboi r\^{o}k jolan \~{n}u nao hma, \~{n}u bb\^{o}h sa droi mr\u{a} d\u{o} bboi gah, a, hruh \~{n}u. //
\glb
\\{exist} one \\{clf} person old \\{3s} go do field \\{3s} hold machete \\{3s} hold hoe \\{3s} and carry.on.back back.basket \\{3s} while at along trail \\{3s} go field \\{3s} see one \\{clf} peacock stay at \\{drct} -- nest \\{3s} //
\glft
`There was an old person who went to work in the field. He took along his machete, he took along his hoe, and he carried his basket on his back. While he was on his way to the farm, he saw a peacock beside its nest.' //
\endgl
\xe
\end{document}
其结果是:
也适用于normal
悬挂式。更改\lingset{glhangstyle=cascade}
为\lingset{glhangstyle=normal}
结果为:
如果您希望箭头(在本例中)指向文本中间而不是基线,则可以使用 来aboveglarrowskip
调整位置。将\lingset{aboveglarrowskip=0pt}
(默认)更改为\lingset{aboveglarrowskip=-2pt}
会导致:
您可以选择使用其他包中的其他箭头符号。例如\usepackage[mathb]{mathabx}
,\lingset{glarrow=\tiny$\drsh$}
或者,您可以\usepackage{fdsymbol}
使用\lingset{glarrow=\tiny$\Rdsh$}
如果你想使用箭头以外的其他东西,那也没问题。例如,\lingset{glarrow=\tiny{--test--}}
您可以添加一些间距,例如,\lingset{glarrow={--test--\hspace*{5pt}}}
确实,这个补丁非常灵活。例如,你可以扔出一个TikZ
非常大的箭头。但由于高度太大,你可以\raisebox
用零高度包围它,使用:
\usepackage{tikz}
\newcommand{\myarrow}[1][]{%
\begin{tikzpicture}[#1]%
\draw (0,2.7ex) -- (0,0) -- (0.75em,0);
\draw (0.55em,0.2em) -- (0.75em,0) -- (0.55em,-0.2em);
\end{tikzpicture}%
}
\lingset{numoffset=\leftmargin,%
textoffset=0.75em,%
extraglskip=!1.1ex,%
glspace=!0.01em,%
belowglpreambleskip=!0ex,%
aboveglbskip=-0.9ex,%
aboveglcskip=-0.9ex,%
aboveglftskip=-0.1ex,%
exnotype=chapter.arabic,%
glarrow={\raisebox{0pt}[0pt][0pt]{\myarrow[scale=1.35,draw=red]}},%
glhangstyle=cascade,%
glhangindent=2em}%
和glhangstyle=normal
它也很棒,因为您可以通过普遍使用它,\lingset{}
或者仅为个别\ex\xe
或\pex\xe
示例指定它。您只需要使用标准注释(不是 nlevel)并指定所需的符号/文本和垂直跳过(如果需要)。