3

I'm writing a document and I wanted to colour some text parts.

In the preamble I call float package and many others and it worked properly. until I called color package. Then LaTeX return errors at some place in the source code:

Missing \endgroup inserted
Missing } inserted
Unbalanced output routine ...

By (un)commenting parts of code I've found that \newfloat{graf}{tbp}{lop}[chapter] command causes it.

Does anyone have idea why it is working only without color package and/or how to define custom floats and be able to use colours?

Thanks for your time and suggestions.

Edit:

Code:

\documentclass[a4paper%,draft%
    ,12pt]{report}
\usepackage[cp1250]{inputenc}
\usepackage[english,czech]{babel}
\usepackage{float}
\usepackage[usenames,dvipsnames]{color}

\newcommand{\dd}{\ensuremath{\mathrm{d}}}

%== Graf environment definition==

\newfloat{graf}{tbp}{lop}[chapter]
\floatname{graf}{Graf}
\newcommand{\listofgraphs}{\listof{graf}{List of Graf}}

\begin{document}

Lorem ipsum dolor sit amet.

\end{document}
3
  • 2
    1. Could you please give us a small but complete example showing the problem. 2. Have you already tried replacing the float package by floatrow?
    – user2574
    May 12, 2011 at 5:35
  • Lots of people use color and float together: there must be something else going on here.
    – Joseph Wright
    May 12, 2011 at 5:59
  • Axel: 1. I've added the code, 2. I'haven't known about that package yet. Joseph: When I don't define new float both no error occurs. Well, I use only [H] option so I should better say 'no error'.
    – Crowley
    May 12, 2011 at 6:13

2 Answers 2

2

Ok...

Mistake was between chair and screen. As usual.

The problem is not in collision between those packages, problem is caused by the name of my new float - graf - and its collision with color package. When I used

\newfloat{foo}{tbp}{lop}[chapter]

No error was throwed.

Axel:

I've tried the floatrow package and changed proper commands but same error occurs, so Your advice led me to this conclusion. Thanks.

1

In the course of defining a new floating environment called graf, you will (among other things) define the macros \graf and \endgraf. The latter will cause an error because the \endgraf macro is already defined as \par by LaTeX (and plain TeX).

3
  • But why it works without problems when color package is not loaded?
    – Crowley
    May 13, 2011 at 19:44
  • 1
    @Crowley: I guess that the float definition of \endgraf overrides the original definition with \def, which won't cause an error by itself. However, any macro or package that will try to use \endgraf assuming its original definition will cause unexpected effects and very likely errors.
    – lockstep
    May 13, 2011 at 22:59
  • Thanks a lot, another thing to avoid as far as possible. :)
    – Crowley
    May 15, 2011 at 9:29

You must log in to answer this question.

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