使用 linguex 斜体示例

使用 linguex 斜体示例

有人能告诉我如何使用 自动将示例变为斜体吗linguex? 带有注释的第一行示例已在此处讨论过,并且运行良好。 我也需要其他环境中的示例使用斜体字体(\ex.\exi.),以及所有行\a.\b.子列表等)。

答案1

如果不深入研究代码,这一点很难做到,因为代码linguex没有为此设置。这里有一个可行的方法。我制作了一个新的宏\examplefont来设置示例的样式(这样代码就不会硬编码斜体)。我还设置了\eachwordone(注释示例的第一行)使用相同的字体,但注释行(\eachwordtwo)设置为直立字体。为了确保注释项目的自由翻译也是直立的,您需要使用\glt

\documentclass{article}
\usepackage{linguex}

\newcommand*{\examplefont}{\itshape} % change this as needed
\renewcommand{\eachwordone}{\examplefont} % make \eachwordone match
\renewcommand{\eachwordtwo}{\normalfont}  % make gloss line upright
\renewcommand{\glt}{\normalfont} % use \glt for free translation

\makeatletter
\def\Exformat[#1]{%
   \settowidth{\currentlabel}{#1}%
   \begin{list}{\makebox[\labelwidth][l]{\normalfont#1}}{%
      \setlength{\leftmargin}{\currentlabel}%
      \listdecl%
      \if@noftnote\relax\else\addtolength{\topsep}{-.5\topsep}\fi
      \ifembedded\topsep=.3\Extopsep\else\topsep=\Extopsep\fi
   }%
   \ifindex\firstwordtrue\fi\item\examplefont{}}
\def\a.{\ifindex\firstwordtrue\fi
        \ifnum\theExDepth=0 \unembeddedtrue
        \trivex.\fi
     \stepcounter{ExDepth}%refstepcounter replaced 
     \begin{list}{\makebox[\labelwidth][l]{\normalfont% 
         \ifnum\theExDepth=1 \SubExLBr\Exalph{ABC}\SubExRBr%
          \else
           \ifnum\theExDepth=2 %
           \ifdim\currentlabel<\lessthanthousand%
           \ifalignSubEx 
              \llap{\hbox to \alignSubExnegindent{\ifunembedded%
                  \SubExLBr\Exalph{SubExNo}\SubExRBr
                  \else\SubExlabel\fi\hss}}%
            \else\SubExlabel\fi%
              \else\ifunembedded%
                  \SubSubExLBr\Exroman{SubExNo}\SubSubExRBr
                  \else\SubExlabel\fi\fi
            \else
             \ifnum\theExDepth=3 %
             \if@noftnote%\ifunembedded\mbox{$\bullet$!}\else 
                    \SubSubExLBr\Exroman{SubSubExNo}\SubSubExRBr
                    %\fi
               \else\Exarabic{SubSubExNo}\SubSubExRBr\fi
         \fi\fi\fi}}%
    {\labelsep\z@ 
     \ifnum\theExDepth=2\topsep .3\Extopsep\else\topsep 0pt\fi 
     \parsep\z@\itemsep\z@
     \ifnum\theExDepth=1 %
       \usecounter{ABC}%
       \settowidth{\currentlabel}{\ExLBr\Exarabic{ExNo}\ExRBr}%
       \listdecl%   
     \else
      \ifnum\theExDepth=2 %
         \usecounter{SubExNo}%
           \ifalignSubEx\ifdim\currentlabel<\lessthanthousand%
           \leftmargin\z@\else\leftmargin=\SubExleftmargin\fi%
           \else\leftmargin=\SubExleftmargin\fi%
         \else
            \ifnum\theExDepth=3 \usecounter{SubSubExNo}\fi
         \leftmargin=\SubSubExleftmargin%
         \fi
    \labelwidth=\leftmargin%
    \fi}%
    \ifnum\theExDepth=1 \setlength{\Exlabelwidth}{4em}\fi%
    %previous line added 2000/12/22
    \b.}

\def\newb.{\ifindex\firstwordtrue\fi
        \my@ifnextchar[{\newExitem}{\examplefont\item\testforgramm}}
\makeatother
\begin{document}
\ex.
\a.This is an example.
\b.Another example.
\a. Another one.
\b. Another other one.

\exg.
This is a glossed example\\
This is the gloss line\\
\glt`This is the translation'

\exi. This is an example.

\end{document}

代码输出

相关内容