Whenever I want to insert an image or a table, there are the same errors:

\begin{figure} or \begin{table} -> Undefined control sequence. \end{figure} or \end{table} -> \begin{document} ended by \end{figure}. Extra }, or forgotten \endgroup. Extra \endgroup. Too many }'s.

Somebody said there might be a package that's too old, or doesn't work with others, but I don't know where to start.


\usepackage[utf8]{inputenc} % Einstellung der Eingabekodierung
\usepackage[ngerman]{babel} % Deutsche Trennmuster

\usepackage{newtxtext, newtxmath} % Schriftart Palatino & passende Mathe-Schrift
\usepackage[T1]{fontenc}    % Einstellung Schriftkodierung
\usepackage{amsmath}        % Mathematik-Erweiterungen
\usepackage{microtype}      % Verbesserte Mikrotypographie
\usepackage{csquotes}       % Kontextabhängige Anführungszeichen
\usepackage{calc}       % Berechnung von TeX-Maßen
]{geometry}         % Anpassung Satzspiegel
\usepackage{parskip}        % Kein Absatzeinzug
\usepackage{emptypage}      % Keine Seitenzahlen auf Leerzeiten
\usepackage{array}      % Tabellen-Erweiterung
\usepackage[pdftex]{graphicx}       % Einbindung von Grafiken
\usepackage{float}      % Anpassung von Gleitumgebungen
\usepackage{fancyhdr}       % Anpassung von Kopf- und Fußzeilen
\selectlanguage{german} % Einstellung der Sprache

\usepackage{xcolor}     % Farben
\usepackage{subcaption} % Unternummerierung für Abbildungen
\usepackage{listings}       % Quelltextauszüge
\usepackage{siunitx}        % Physikalische Einheiten
\usepackage{chemformula} % chemische Symbole, Reaktionsgleichungen
\usepackage[nohyperlinks]{acronym} % Abkürzungen
\usepackage{tocloft} % eigene "list of things"

\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}

\floatplacement{table}{htb} % Anpassungen für Gleitumgebungen

  \par\centerline{\textbf{\Large #2}}\par
{} % Einfache Überschriften für Aufgabenstellung usw.

\makeatother % Erweiterter Zeilenabstand in Gleitumgebungen, Fußnoten und Minpages


% Römische Seitenzahlen für den Vorspann.


% Inhaltsverzeichnis


\begin{figure}[h] % error: Undefined control sequence.
    \caption{Reaktionen in der Batterie}
\end{figure} % error:  \begin{document} ended by \end{figure}. Extra }, or forgotten \endgroup. Extra \endgroup. Too many }'s.

% Tabelle mit Zeiten etc.
\begin{table} [h] % error: Undefined control sequence.
    \begin{tabular}{p{2.5cm} p{2.5cm} p{2.5cm} p{5cm} p{2.5cm}}
        $t_{on} / s$ & $t_{off}$ / s & $\dfrac{t_{on}}{t_{off}}$ & $R_{3}$ (Entladewiderstand) / \si\ohm & max. I / A \\ [1ex]
        5 & 5 & 1 : 1 &  &  \\
        50 & 50 & 1 : 1 &  &  \\
\end{table} % error: \begin{document} ended by \end{table}. Extra }, or forgotten \endgroup. Extra \endgroup. Too many }'s.

  • 1
    Welcome to Tex.SX! Unfortunately your "minimal" working example is anything but. Please try to reduce it as much as possible, making it much easier for us to help you. Start by removing unnecessary packages, comments, etc. until you have only a few lines left that still compile, and clearly show your problem.
    – Ingmar
    Commented Apr 24, 2023 at 13:41
  • 4
    I took a wild guess, and it seems that \let\@xfloat=\latex@xfloat is your problem. What's your intent with that line?
    – Teepeemm
    Commented Apr 24, 2023 at 13:42
  • 1
    are you sure you want \floatplacement{figure}{htb} ? that removes p so makes it very likely that all figures go to the end of the document. Commented Apr 24, 2023 at 13:51

1 Answer 1


You did not show the error which is

! Undefined control sequence.
\@xfloat #1[#2]->\caption@ORI@xfloat 
                                     {#1}[#2]\caption@settype {#1}\caption@s...
l.66 \begin{figure}[h]
                       % error: Undefined control sequence.

so the undefined command is \caption@ORI@xfloat

You have loaded the caption package then broken its internal workings by doing

\makeatother % Erweiterter Zeilenabstand in Gleitumgebungen, Fußnoten und Minpages

you should delete that.

In general only have code in the preamble that you know you are using. It seems highly unlikely you are using all these packages, loading so many will lead to conflicts such as

Package tocloft Warning: \@starttoc has already been redefined; tocloft bailing
 out. on input line 1156.

You must log in to answer this question.

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