Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've been trying to run my university's thesis package along with tikz and there is an incompatibility I can't figure out (seems to be a different issue than what has already been addressed here). The error is puzzlingly the too many }'s.

EDIT: The code is now here


EDIT2: I hacked my way around the issue by not using tikz and pgf directly in the same document but using the standalone package to generate pdf images and include them. Turns out however that the university stylesheet also has problems with hyperref. The error is the same and it comes about when compiling a figure (even if the figure is a pdf). Leaving only the '\inlcudegraphics' statement works. Just to be clear, the incompatibility with hyperref is in addition to the issue with tikz. Commenting out the inclusion of hyperref but re-including tikz gives the issue back. It only works with both excluded.

EDIT3: It's not all of hyperref that conflicts. Removing the 'colorlinks = true' (and probably any xcolor option work the same) fixes the issue.

Any help is very appreciated!

share|improve this question
Welcome to the site. If your code is too long you paste it on writelatex.com and put link here so that we don't need to download a zip file which is not so nice due to you-know-why. –  percusse Jun 17 '13 at 5:57
Thank you percusse. I wasn't aware of writelatex. Pretty handy! –  Mike Jun 17 '13 at 16:35
Thanks JLDiaz. Yes, as I just edited above, if without 'colorlinks = true' it works out. Just to clarify, by 'main.tex' did you mean the file I posted on writelatex? –  Mike Jun 17 '13 at 17:13
add comment

1 Answer 1

up vote 3 down vote accepted

The problem is not directly related with tikz, nor the figure environment. It is a bad interaction between xcolor package (which tikz inputs), hyperref package (which also does color manipulations in the links), and the code in your University style which redefines the mechanism to place floats. This affects not only to the figure environment, but to any floating environment (also tables).

Given the file main.tex available in the link provided by the OP, the following MWE shows the problem:


  This is a table.

When compiling, the following error appears:

Chapter 1.
! Too many }'s.
\color@endbox ->\color@endgroup \egroup

l.11 \end{table}

The problem is caused by code at lines 15--29 in main.tex, which (re)define the internal latex command \@xfloat. Commenting out these lines the problem vanishes.

I read those lines and I'm not sure which is their purpose. I would say that removing them would not make much difference in the final output, but just in case, I compared them with the original definition of \@xfloat in LaTeX kernel.

The code is complex, and I had no time to study it in depth (perhaps some other more familiar with that routine could cast more light), but I noticed that the original latex code included some color-related macros that were absent in main.tex redefinition, so I added them. In particular, I changed line 26 of main.tex from:




et voilà! The problem vanished. However be warned, I'm not sure of what I did so perhaps side-effects remain.

share|improve this answer
You are the man! Thanks a lot. Don't worry I'll proceed with caution. Either way I can always do the hack without the colorlinks=true and it will also work. Your solution is behaving really well so far. I didn't notice it affected tables before, but maybe it's because using longtable redefined things back to working form. –  Mike Jun 17 '13 at 17:22
Perhaps because longtables are not floats –  JLDiaz Jun 17 '13 at 17:23
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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