3

I am getting the following message in the log file of a very long document (>700-page book) with many \included files:

(\end occurred inside a group at level 2)

### simple group (level 2) entered at line 269 ({)
### simple group (level 1) entered at line 1187 ({)
### bottom level 

But the log file only gives the line numbers -- not the name of file. I have gone through every .tex file in the project, plus all the auxiliary files, and cannot find a mismatched { on line 269 or 1187 of any of them.

Is there a way to tell which source file the error is referring to? Any other suggestions about how to diagnose this?

Edit: Here are the ~20 lines before the error in the log file, as well as all of the lines after:

 [733] [734] [735]) (./FoSCT-2e-v2.aux
(./Preface/preface.aux) (./Ch01Intro/chapter-intro.aux)
(./Ch02DemandModeling/chapter-demand-modeling.aux)
(./Ch03DetermInv/chapter-inv-deterministic.aux)
(./Ch04StochInvPer/chapter-inv-stochastic-per.aux)
(./Ch05StochInvContin/chapter-inv-stochastic-contin.aux)
(./Ch06MultiechInv/chapter-inv-multiechelon.aux)
(./Ch07PoolingFlexibility/chapter-pooling-flexibility.aux)
(./Ch08FacilLoc/chapter-facil-loc.aux)
(./Ch09SupplyUncertainty/chapter-supply-uncertainty.aux)
(./Ch10TSP/chapter-tsp.aux) (./Ch11VRP/chapter-vrp.aux)
(./Ch12IntegratedModels/chapter-integrated-models.aux)
(./Ch13Bullwhip/chapter-bullwhip.aux) (./Ch14Contracts/chapter-contracts.aux)
(./Ch15Auctions/chapter-auctions.aux)
(./Ch16Applications/chapter-applications.aux)
(./Apx01MultiChapProbs/appendix-multi-chap-probs.aux)
(./Apx02Proofs/appendix-proofs.aux) (./Apx03Formulas/appendix-formulas.aux)
(./Apx04OptTech/appendix-OPT_TECH.aux))

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

 )
(\end occurred inside a group at level 2)

### simple group (level 2) entered at line 269 ({)
### simple group (level 1) entered at line 1187 ({)
### bottom level 
Here is how much of TeX's memory you used:
 38358 strings out of 493005
 892893 string characters out of 6134596
 4898692 words of memory out of 5000000
 41542 multiletter control sequences out of 15000+600000
 57101 words of font info for 168 fonts, out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 81i,29n,402p,61350b,2524s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on FoSCT-2e-v2.pdf (773 pages).
6
  • Normally the log file tells you which file it inputted before the error, doesn't it? If this somehow does not apply to your TeX system, you can still comment all of them out and resurrect them one by one until the error shows up.
    – user121799
    Commented May 10, 2019 at 2:07
  • PS The way the log file normally tells you which file you're in is (filename.tex ...). Sometimes, that ... can be many lines long though, so you may have to look carefully. But commenting out the includes does seem the way to go.
    – Teepeemm
    Commented May 10, 2019 at 2:12
  • OK, the commenting-out trick worked. There were two unmatched {s, one each in two different files. Follow-up question: Why didn't these trigger errors, instead of just warnings? Commented May 10, 2019 at 3:36
  • 1
    @marmot -- The message as shown appear only at the very end of the job, so they are dissociated from any reporting of the file in which they occurred. Commenting out (or using \includeonly) is the only reasonable way to identify the errant files. Commented May 10, 2019 at 3:55
  • 2
    @LarrySnyder610 -- Often, an unmatched open brace doesn't trigger an error until the end of a job, since almost any "text" command can be nested. (The situation may be different when LaTeX3 is in effect, but that isn't generally true yet.) In such a case, the only possibility is, at the \end{document}, to check whether the running count of open/close instances is zero. Math is different -- it is always presumed to be "complete" at a paragraph break, which is why a blank line in a math environment invariably results in an error message. Commented May 10, 2019 at 4:02

2 Answers 2

4

Commenting out the \included files one-by-one let me diagnose the problem. There were two unmatched {s, one each in two different files.

2

I was not able to find any indication in my log file about which source file had the unmatched {. But there are some hints that we can use from the error message:

  1. The line number
  2. The offending opener
  3. The order that things happened

Item 3 is the easiest information to use. You were at the bottom level before you entered group 1 before you entered group 2. So once you locate line 1187, you know that line 269 will occur in a file that TeX loads later.

Item 1 is the correct line number. At the worst, this means that you'll need to open each file and go to line 1187. If you have a command line, you can try
grep '{' -n *.tex | grep '1187:'
The -n flag tells grep to put the line number at the beginning of each result, so that this will return lines 1187 that have a {. (Unfortunately, this will be a lot of results, because it's TeX. Maybe try appending | grep -v '}' to remove lines that have }.)

The other suggestion is to work from higher numbers lower. Since you presumably have files with lengths between 270 and 1180 lines, they could be the 269 offender but not the 1187 offender. So focus on the 1187 to find that file, and then you can use Item 3 to narrow down your search for the 269.

1
  • Thanks! The grep -n suggestion is great! Commented Aug 27, 2020 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .