This question is a really nice example of why minimal examples rather than code fragments are extremely helpful both in explaining a problem to others, and in finding the source of a problem by yourself.
Errors and line numbers
If I turn the fragment of code you supplied into a minimal example, it compiles without error:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{expex}
\begin{document}
\pex
\a
\begingl
\gla nie ale jeśli ją \underline{pan} \underline{zobaczy} \underline{będzie}
\underline{pan} \underline{wiedział} że to do mnie //
\glb non mais si {\sc 3sg.dat} {\sc 2sg.pol} voir-{\sc 3sg.fut} être-{\sc 3sg.fut}
{\sc 2sg.pl} savoir-{\sc 3sg.pp} que ce{$_etre-{\sc 3sg}$} pour {\sc 1sg}//
\glft 'non, mais quand vous la verrez vous saurez que c'est pour moi'//
\endgl
\xe
\end{document}
![output of code](https://i.stack.imgur.com/ogrPn.png)
This clearly shows that the code in question is not the source of the error you are getting. This is quite a common problem in TeX generally: the line at which TeX gets lost is not necessarily the actual source of the error: it could be much earlier in the document.
In the case of the error you are getting, we can reproduce it in the minimal example by removing one of the pairs of closing //
at the end of a gloss line. (Rather than including the code here, I've shown a screen shot from my editor which shows the line numbers explicitly.)
![editor screenshot](https://i.stack.imgur.com/CVoo7.png)
Notice that the //
have been removed from line 11 of the code. Now let's take a look at the error:
./expexerror.tex:13: Argument of \@optionaltemp has an extra }.
<inserted text>
\par
l.13 ...que ce{$_etre-{\sc 3sg}$} pour {\sc 1sg}//
?
The error shows is reported as being at line 13, even though that line itself is perfectly well formed. The reason for this is (roughly) that ExPex scans its gloss lines until it finds a closing //
, which in this case is at the end of line 13. But between the \gla
starting at line 10 and the //
at line 13 there is another \glb
command that it doesn't know what to do with, and therefore it causes an error.
So finding errors is unfortunately not as simple as simply reading the log or console output and looking at the line number (although that's definitely a good place to start.) If you determine that the reported line is error free, then you should always look backwards to see where the error might be coming from. In this case it probably wasn't too far (probably the previous \gla
line) but in other kinds of similar errors (not with ExPex) the actual source might be quite far away. A classic example of this is when you forget an \end{...}
for an environment.
Some other comments on your code
There are some other issues with your code which you might want to change. First, you are using the two letter font changing commands, which are essentially deprecated in LaTeX. See Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX? for some discussion.
As well as this, it would be preferable to create a macro for linguistic features like this and use this instead of adding formatting directly. So instead of {\sc 3sg.fut}
you would use a macro e.g., \fts{3sg.fut}
. (See complete code below.)
Furthermore, you are using them within math mode, and this actually gives rise to a warning that tells you there are no small caps in the relevant math font. This is due to the ce{$_etre-{\sc 3sg}$}
in your last gloss line, which as you can see from the image above is rendered in lower case. The best way to deal with this is to load the amsmath
package, and use its \text
command, which allows you to embed regular text inside math expressions. So instead of ce{$_etre-{\sc 3sg}$}
you would write ce{$_\text{etre-\fts{3sg}}$}
.
Finally, you are using straight quotes in your source, which gives you incorrect opening quotation marks. You should be using `
for an open quote and '
for a close quote (or if your editor supports automatic smart quotes, and you are using a UTF-8 encoding, just use the ‘
and ’
directly in your source file.)
So here's a new version of the minimal example with these things fixed:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{expex}
\usepackage{amsmath}
\newcommand*{\fts}{\textsc} % \fts = features (use something that works for you)
\begin{document}
\pex
\a
\begingl
\gla nie ale jeśli ją \underline{pan} \underline{zobaczy} \underline{będzie}
\underline{pan} \underline{wiedział} że to do mnie//
\glb non mais si \fts{3sg.dat} \fts{2sg.pol} voir-\fts{3sg.fut} être-\fts{3sg.fut}
\fts{2sg.pl} savoir-\fts{3sg.pp} que ce{$_\text{etre-\fts{3sg}}$} pour \fts{1sg}//
\glft `non, mais quand vous la verrez vous saurez que c'est pour moi'//
\endgl
\xe
\end{document}
![output of code](https://i.stack.imgur.com/v7DlW.png)
Best Answer
polyglossia
(or a package it loads) makes\[
robust butamsthm
isn't expecting that. If you reset the original definition, things work better,(I removed redundant packages from the example)