0

Could anyone tell me how examples can be italicised automatically using linguex? The first line of examples with glosses is already discussed here and works fine. I need italic font for the examples in the other environments, too (\ex. and \exi.), and for all lines of the \a., \b. sublists, etc).

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Skillmon Feb 20 '18 at 20:15
1

This is quite difficult to do without digging into the code, as linguex is not set up for this. Here's one way that works. I've made a new macro \examplefont to set the style of the examples (so that the code doesn't hard-code italics. I've also set \eachwordone (the first line of a glossed example) to use the same font, but the gloss line (\eachwordtwo) is set to the upright font. To make sure the free translation of glossed items is also upright, you need to use the \glt macro

\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}

output of code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.