4

I'm desperate, can't figure out what's going on... So here's my code for a gloosed example:

\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

And here's the error I'm getting while compiling:

! Paragraph ended before \@optionaltemp was complete.
<to be read again>
\par
l.2035 ... \underline{wiedział} że to do mnie //
I suspect you've forgotten a `}',

So I've check all } and everything seems to be fine. So either I'm blind or I'm missing something else.

Please!!!!! help me!

  • Does the ł character work without problems outside of \underline? – Andrew Swann Jul 9 '15 at 12:23
  • 3
    Please complete your example in order to make it compilable. What is \a? – LaRiFaRi Jul 9 '15 at 12:24
  • 7
    If I turn your example into a minimal document, I get no error, which likely means that the problem is not in this particular example, but somewhere else. You will need to do some work with your document to find the real source of the error. One way to do this is to move the \end{document} earlier in your file until the error goes away, and then focus on that part. If you do this you may find the error yourself, or you will be able to construct a minimal document (not a code fragment) that shows the error, in which case you can edit your question to include that. – Alan Munn Jul 9 '15 at 12:46
  • 2
    The most likely source of the error is that one of your gloss lines is missing its final //. – Alan Munn Jul 9 '15 at 15:38
  • Alan Munn, Thank you! you're completely right! – Justyna Bernat Jul 13 '15 at 14:44
16

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

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

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

  • wow! this is excellent! Thank you very much!! I was just wondering, becouse I already have a lot of \newcommands, can it be a source of problem for LaTex? – Justyna Bernat Jul 15 '15 at 6:49

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.