\documentclass{article}
\usepackage{linguex}
\begin{document}
\ex. Some Example French sentence \hfill(French)\\
This is the gloss\\
`the interpretation'
\exg. Some Example French sentence \hfill(French)\\
This is the gloss\\
`the interpretation'
\end{document}
示例 2 中的 (法语) 应该向右对齐;就像第一个例子一样。
似乎存在某种冲突特异命令。有任何帮助请
答案1
该\exg
命令比复杂得多\eg
,因为它解析文本以水平对齐两行的单词。
一些 TeX 引擎(pdfTeX、LuaTeX、XeTeX)支持“savepos”功能。它允许记录文件中的当前位置(单位为 sp),.aux
以便在下一次 TeX 运行中进行评估。
下面的示例将此功能与 一起使用zref
,该包提供了比标准\label
/\ref
提供的更灵活的标签/引用系统。
\RequirePackage{ifluatex}
\ifluatex
\IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{}
\fi
\documentclass[twoside]{article}
\usepackage[
a6paper,
landscape,
vmargin=1cm,
includeheadfoot,
showframe, % for reviewing
]{geometry}
\usepackage{linguex}
\usepackage{zref-savepos}
\makeatletter
\zref@newprop*{PageValue}[1]{\the\c@page}%
% Counter
\newcount\eolpos@cnt
\eolpos@cnt=\z@
\newcommand*{\eolpos@label}{eolpos\the\eolpos@cnt}
\newcommand*{\eolpos}{}
\protected\def\eolpos#1{%
\leavevmode
\rlap{%
% Unique label names
\global\advance\eolpos@cnt\@ne
% Save the current horizontal position along
% with the value of the page counter
\zref@savepos
\zref@labelbyprops{\eolpos@label}{posx, PageValue}%
% Measure part
\sbox\z@{#1}%
\dimen@=\z@
\zifrefundefined{\eolpos@label}{%
}{%
\dimen@=\dimexpr
\expandafter\ifx\csname pdfhorigin\endcsname\relax
1in%
\else
\pdfhorigin
\fi
+%
\ifodd\zref@extractdefault{\eolpos@label}{PageValue}\@ne
\oddsidemargin
\else
\evensidemargin
\fi
+\textwidth
-\wd\z@
-\zref@extractdefault{\eolpos@label}{posx}{0}sp%
\relax
}%
% Set space
\ifdim\dimen@<\z@
\typeout{`eolpos` warning: Text sticks to the left by \the\dimen@}%
\fi
\kern\dimen@
% Place user text
\usebox\z@
}%
}
% \z@ = 0 or 0pt
% \@ne = 1
% \dimen@ = \dimen0
\makeatother
\begin{document}
\ex. Some Example French sentence \hfill(French)\\
This is the gloss\\
`the interpretation'
\exg. Some Example French sentence \eolpos{(French)}\\
This is the gloss\\
`the interpretation'
\newpage
\ex. Some Example French sentence \hfill(French)\\
This is the gloss\\
`the interpretation'
\exg. Some Example French sentence \eolpos{(French)}\\
This is the gloss\\
`the interpretation'
\end{document}
第 1 页:
第2页:
答案2
\hfill 只适用于第三行使用 linguex 来解释示例,这可能是您的选择。或者,Brian Buccola 在他的网站上有一个解决方法这里。