2

I thought the gb4e package for linguistic example typesetting would provide automatic switching of the numbering scheme between main text examples and examples in footnotes. This is not the behavior I am currently getting from my MWE below. I.e., what exactly do I have to do to ensure that examples in the main text get the "standard" Arabic numbers, and examples in footnotes are under an independent numbering scheme (e.g., Roman)?

And a bigger problem: When I use the polyglossia package to define further languages for use within the document, XeLaTeX does not even use two independent counters for main text examples and footnote examples. Any advice on this?

\documentclass[a4paper,11pt]{article}

\usepackage{polyglossia}
\usepackage{gb4e}
\noautomath
\setdefaultlanguage{english}
\setotherlanguage{sanskrit}
\setotherlanguage{urdu}
\setmainfont{Charis SIL}
\newfontfamily\devanagarifont[Scale=MatchUppercase]{Devanagari MT}
\newfontfamily\urdufont[Script=Arabic,Scale=1.5]{Nafees}


\begin{document}

This is a test.

\begin{exe}
\ex
{
\gll Ein jeder Hund bellt.\\
{\sc art}.{\sc m}.{\sc sg}.{\sc nom} every.{\sc m}.{\sc sg}.{\sc nom} dog.{\sc m}.{\sc sg}.{\sc nom} bark.{\sc pres}.{\sc 3p}.{\sc sg}\\
\trans `Every dog barks.'
}
\label{ex-1}
\end{exe}


Here is a footnote.\footnote{This is a footnote.\begin{exe}
\ex
{
\gll Ein jeder Hund bellt.\\
{\sc art}.{\sc m}.{\sc sg}.{\sc nom} every.{\sc m}.{\sc sg}.{\sc nom} dog.{\sc m}.{\sc sg}.{\sc nom} bark.{\sc pres}.{\sc 3p}.{\sc sg}\\
\trans `Every dog barks.'
}
\label{ex-fn}
\end{exe}}

\end{document}
Alan Munn
  • 218,180
  • I suspect the bidi package, loaded by polyglossia for RTL languages, to be the culprit. Somewhere in bidi, the footnote numbering seems to get screwed up. – Sebastian Sulger Mar 25 '15 at 15:31
  • This code won't compile for me at all when bidi is loaded. – Alan Munn Mar 26 '15 at 10:50
  • Sorry - I adapted my MWE. \noautomath was missing. – Sebastian Sulger Mar 26 '15 at 13:06
  • 1
    Since Alexis has already given you a fix for this the first part of your problem on the Ling-TeX mailing list, perhaps you can change your question to reflect just the bidi problem. (It's really not so good to post the same question simultaneously on two separate forums, since people who don't read the mailing list will spend time trying to help solve a problem that has already been solved for you.) – Alan Munn Mar 26 '15 at 14:26

1 Answers1

1

Here's a solution to both of your problems. Since gb4e doesn't work properly in an RTL environment, there's no sense in patching the RTL footnotes.

% !TEX TS-program = XeLaTeX
\documentclass[a4paper,11pt]{article}
\usepackage{polyglossia}
\usepackage{etoolbox}
\usepackage{gb4e}
\noautomath

\setdefaultlanguage{english}
\setotherlanguage{sanskrit}
\setotherlanguage{urdu}
\setmainfont{Charis SIL}
\newfontfamily\devanagarifont[Scale=MatchUppercase]{Devanagari MT}
\newfontfamily\urdufont[Script=Arabic,Scale=1.5]{Nafees}

\makeatletter
\pretocmd{\@footnotetext}{
    \@noftnotefalse\setcounter{fnx}{0}%
    \renewcommand{\thexnumi}{\roman{xnumi}}
    }{}{}
\apptocmd{\@footnotetext}{
    \@noftnotetrue
    \renewcommand{\thexnumi}{\arabic{xnumi}}
    }{}{}
\@ifpackageloaded{bidi}{%
\pretocmd{\@LTRfootnotetext}{
    \@noftnotefalse\setcounter{fnx}{0}%
    \renewcommand{\thexnumi}{\roman{xnumi}}
    }{}{}
\apptocmd{\@LTRfootnotetext}{
    \@noftnotetrue
    \renewcommand{\thexnumi}{\arabic{xnumi}}
    }{}{}
}
\makeatother

\begin{document}

This is a test.

\begin{exe}
\ex
{
\gll Ein jeder Hund bellt.\\
{\sc art}.{\sc m}.{\sc sg}.{\sc nom} every.{\sc m}.{\sc sg}.{\sc nom} dog.{\sc m}.{\sc sg}.{\sc nom} bark.{\sc pres}.{\sc 3p}.{\sc sg}\\
\trans `Every dog barks.'
}
\label{ex-1}
\end{exe}

Here is a footnote.\footnote{This is a footnote.\begin{exe}
\ex
{
\gll Ein jeder Hund bellt.\\
{\sc art}.{\sc m}.{\sc sg}.{\sc nom} every.{\sc m}.{\sc sg}.{\sc nom} dog.{\sc m}.{\sc sg}.{\sc nom} bark.{\sc pres}.{\sc 3p}.{\sc sg}\\
\trans `Every dog barks.'
}
\label{ex-fn}
\end{exe}}

\begin{exe}
\ex
{
\gll Ein jeder Hund bellt.\\
{\sc art}.{\sc m}.{\sc sg}.{\sc nom} every.{\sc m}.{\sc sg}.{\sc nom} dog.{\sc m}.{\sc sg}.{\sc nom} bark.{\sc pres}.{\sc 3p}.{\sc sg}\\
\trans `Every dog barks.'
}
\label{ex-1}
\end{exe}

Here is a footnote.\footnote{This is a footnote.\begin{exe}
\ex
{
\gll Ein jeder Hund bellt.\\
{\sc art}.{\sc m}.{\sc sg}.{\sc nom} every.{\sc m}.{\sc sg}.{\sc nom} dog.{\sc m}.{\sc sg}.{\sc nom} bark.{\sc pres}.{\sc 3p}.{\sc sg}\\
\trans `Every dog barks.'
}
\label{ex-fn}
\end{exe}}



\end{document}

output of code

Alan Munn
  • 218,180