Erro ao inserir figura! O uso de \@xnext não corresponde à sua definição

Erro ao inserir figura! O uso de \@xnext não corresponde à sua definição

Estou tentando inserir uma figura no meu documento de látex. Isso infelizmente me dá o erro

! Use of \@xnext doesn't match its definition.
\@freelist ->,
              \bx@E ,,\bx@F ,,\bx@G ,,\bx@H ,,\bx@I ,,\bx@J ,,\bx@K ,,\bx@L ...
l.20   t
        estfigure
?

Este é o meu arquivo de látex reduzido

%% ----------------------------------------------------------------
%% test.tex -- main
%% ---------------------------------------------------------------- 

\documentclass[a4paper, 10pt, oneside]{memoir}
\usepackage[citeauthor]{basilea}


\title                  {title}
\thesistype         {thesis}

\department         {department}
\faculty                {Faculty }
\research           {research}

\examiner           {examiner}
\supervisor         {supervisor}

\authors            {authors}
\email                {email}
\immatriculnr       {matr}

\date                       {\today}

\ulogo              {example-image-a} 


\begin{document}

\selectlanguage{english}
\thesisfront
\maketitle
\pagestyle{thesis}
\thesistoc
\thesismain
\begin{figure}
  
\end{figure}
\thesisappendix
\thesisbib
\thesisback
\end{document}

E o pacote 'basilea.sty', que é um modelo para teses da minha universidade.

%%
%%  This file is originally based on 'ECSthesis.cls' by Steve R. Gunn
%%  and 'phdthesis.sty' by Jamie Stevens. In this new version many parts
%%  have been replaced by calls to the memoir package. Many existing
%%  templates using the memoir served as model.
%%
%%  v.2.0
%%
%%  2014, Ivan Giangreco
%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{basilea}[2014]

\newcommand*{\basileaBibStyle}{thesis}

%%
%% Provides the option to use \citet to get the authors name
%% Internally, this changes the bibliographystyle from thesis to plainnat
%%
\DeclareOption{citeauthor}{
    \renewcommand*{\basileaBibStyle}{plainnat}
}
%%
%% Provides the default option to not use \citet to get the authors name
%% Internally, this sets the bibliographystyle to thesis
%%
\DeclareOption{citenumber}{
    \renewcommand*{\basileaBibStyle}{thesis}
}

\ExecuteOptions{citenumber}

\ProcessOptions\relax

\usepackage[ngerman, english]{babel}
%\makeatletter\AtBeginDocument{\let\@elt\relax}\makeatother
\usepackage[utf8]{inputenc}

% text to be set for frontpage
\newcommand*{\supervisor}[1]{\def\supervisorint{#1}}
\newcommand*{\examiner}[1]{\def\examinerint{#1}}
\newcommand*{\authors}[1]{\def\authorsint{#1}}
\newcommand*{\email}[1]{\def\emailint{#1}}
\newcommand*{\ulogo}[1]{\def\universitylogoint{#1}}
\newcommand*{\department}[1]{\def\departmentint{#1}}
\newcommand*{\faculty}[1]{\def\facultyint{#1}}
\newcommand*{\research}[1]{\def\researchgroupint{#1}}
\newcommand*{\thesistype}[1]{\def\thesistypeint{#1}}
\newcommand*{\immatriculnr}[1]{\def\immatriculnrint{#1}}

\def\titleint{\@title}
\def\dateint{\@date}

% settings for nomenclature (i.e. the abbreviations)
% - for using in text use e.g. \nomenclature{LED}{Light-Emitting Diode}
% this will print the text directly as Light-Emitting Diode (LED)
% - the abbreviations for the whole document can be printed with the command \thesisnomencl
% - invoke MakeIndex to create a *.nlo file (see also documentation of nomenclature package)
\usepackage{nomencl}
\newcommand*{\nomenclint}{}
\let\nomenclint\nomenclature
\renewcommand*{\nomenclature}[2]{\textit{#2} (#1) \nomenclint{#1}{#2}}
\makenomenclature
\newcommand*{\thesisnomencl}{\renewcommand{\nomname}{\iflanguage{english}{Abbreviations}{Abkürzungsverzeichnis}}\printnomenclature\addcontentsline{toc}{chapter}{\iflanguage{english}{Abbreviations}{Abkürzungsverzeichnis}}}

% graphics 
% (see also floats section in this document for more options)
\usepackage{eso-pic}
\usepackage{everyshi}
\usepackage{ifthen}
\usepackage{calc}
\usepackage{pdfpages}
\graphicspath{{Figures/}}
\newsubfloat{figure}

% definition of fonts (phv is Helvetica, pcr is Courrier)
\renewcommand{\sfdefault}{phv}
\renewcommand{\ttdefault}{pcr}
  
% definition of colors
\usepackage{color,graphicx}
\definecolor{chaptercolor}{rgb}{.7,.7,.7}
\definecolor{emphasizecolor}{rgb}{.7,.7,.7}

% margins
\setlrmarginsandblock{3.5cm}{3.5cm}{*}
\setulmarginsandblock{3.5cm}{3.5cm}{*}
\checkandfixthelayout

% document organization
\setsecnumdepth{subsubsection}
\setcounter{tocdepth}{3}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}

% definition of chapter style (i.e. large number and text)
\setlength{\beforechapskip}{50pt}
\setlength{\afterchapskip}{1pt}
\newcommand*{\colorchapnumber}{\color{chaptercolor}}
\newcommand*{\fontchapnumber}{\usefont{T1}{phv}{b}{n}\fontsize{100}{130}\selectfont}
\newcommand*{\fontchaptitle}{\sffamily\bfseries\huge}
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchaptername}{}
\setlength{\midchapskip}{20mm}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\printchapternum}{\raggedleft{\colorchapnumber\fontchapnumber\thechapter}\par}
\renewcommand*{\printchaptertitle}[1]{\raggedleft\fontchaptitle{#1}\par \vspace{30pt} \nobreak}

% definition of (subsub)section styles
\setsecheadstyle{\sffamily\Large}
\setbeforesecskip{25pt}
\setaftersecskip{1pt}

\setsubsecheadstyle{\sffamily\large}
\setbeforesubsecskip{20pt}
\setaftersubsecskip{1pt}

\setsubsubsecheadstyle{\sffamily\normalsize}
\setbeforesubsubsecskip{20pt}
\setaftersubsubsecskip{1pt}

% definition of line spacing, indent of paragraph, etc.
\OnehalfSpacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\raggedbottom

% header, footer
\nouppercaseheads
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}

\makepagestyle{thesis}
\makeevenhead{thesis}{\leftmark}{}{\thepage}
\makeoddhead{thesis}{\leftmark}{}{\thepage}
\makeheadrule{thesis}{\textwidth}{0.2pt}
\makeevenfoot{thesis}{}{}{}
\makeoddfoot{thesis}{}{}{}
\copypagestyle{chapter}{empty}

% footnotes
\setlength{\skip\footins}{20pt}
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{10pt}
\usepackage{chngcntr} 
\counterwithout{footnote}{chapter}

% add highlighting possibilities
% use \hlt to highlight parts of text, e.g. \hlt{this is important}
\usepackage{soul}
\newcommand{\hlt}[1]{\hl{#1}}

% various imports
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm}

% clearing pages
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else\hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\newcommand*{\tmpcleardoublepage}{}
\let\tmpcleardoublepage\cleardoublepage

% floats
\captionstyle{\raggedright}
\setfloatlocations{figure}{ht!}
\setlength{\intextsep}{10pt}
\setlength{\textfloatsep}{10pt}

% definition of table of contents (i.e. title, header text, appearance in pdf-TOC, etc.)
\newcommand*{\thesistoc}{\cleardoublepage\renewcommand*{\contentsname}{\iflanguage{english}{Table of Contents}{Inhaltsverzeichnis}} \createplainmark{toc}{both}{\iflanguage{english}{Table of Contents}{Inhaltsverzeichnis}} \currentpdfbookmark{\iflanguage{english}{Table of Contents}{Inhaltsverzeichnis}}{toc} \tableofcontents*}
% adds the word "Appendix" in front of chapters in the appendix section
\renewcommand*{\cftappendixname}{\iflanguage{english}{Appendix}{Anhang}\space}

% definition of bibliography
\newcommand*{\thesisbib}{\cleardoublepage\renewcommand*{\contentsname}{\iflanguage{english}{Bibliography}{Literaturverzeichnis}} \createplainmark{bib}{both}{\iflanguage{english}{Bibliography}{Literaturverzeichnis}}\bibliographystyle{\basileaBibStyle}\bibliography{thesis}}
\usepackage[square, numbers, comma, sort&compress]{natbib}

% document structure
\newcommand*{\thesisfront}{\frontmatter \let\cleardoublepage\clearpage }
\newcommand*{\thesismain}{ \addtocontents{toc}{\vspace{2em}} \mainmatter \let\cleardoublepage\tmpcleardoublepage }
\newcommand*{\thesisappendix}{ \addtocontents{toc}{\vspace{2em}} \appendix \let\cleardoublepage\clearpage}

\newcommand*{\thesisback}{ \addtocontents{toc}{\vspace{2em}} \backmatter \let\cleardoublepage\clearpage}

% title page
\renewcommand\maketitle{
  \hypersetup{pdftitle={\@title}}
  \hypersetup{pdfauthor=\authorsint}
  \thispagestyle{empty}
  {\raggedright\includegraphics{\universitylogoint}}\par
    \begin{center}
      \vspace{3cm}
      {\Huge \sffamily \bfseries \@title \par}
      \vspace{0.5cm}
      {\thesistypeint \par}
      \vspace{3cm}    
      {\facultyint \par}
      {\departmentint \par}
      {\researchgroupint \par}
      \vspace{1.5cm}
      {\iflanguage{english}{Examiner}{Beurteiler}: \examinerint \par}
      {\iflanguage{english}{Supervisor}{Zweitbeurteiler}: \supervisorint \par}
      \vspace{1.5cm}
      {\authorsint \par}
      {\emailint \par}
      {\immatriculnrint \par}      
      \vfill
      {\@date \par}
   \end{center}
}

% declaration
\newcommand{\formlabel}[2]{\vspace{0.25cm}\textbf{\sffamily \footnotesize #1 --- #2}\\}

% urls
\usepackage{url}
\urlstyle{same}

% footnotes
\usepackage{chngcntr}
\counterwithout{footnote}{chapter}

% math
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}

% reference settings
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
   bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
   colorlinks,linkcolor={black},citecolor={black},urlcolor={black}, filecolor={black},
   pdfstartview={FitV}, breaklinks=true, unicode]{hyperref}
\usepackage[capitalize]{cleveref}
% rename here, e.g. \crefname{listing}{Algorithm}{Algorithm}  



% todos
\usepackage[colorinlistoftodos, textwidth=4cm]{todonotes} % add ",disable" in [] to remove all todos, missing figures and the todo list
\newcommand{\todoEmpty}[2][]{\todo[fancyline, #1]{#2}}
\newcommand{\todoMissing}[2][]{\todoEmpty[color=magenta!80, linecolor=magenta!80, #1]{Missing: #2}}
\newcommand{\todoCheck}[2][]{\todoEmpty[color=red!80, linecolor=red!80, #1]{Check: #2}}
\newcommand{\todoRevise}[2][]{\todoEmpty[color=orange!80, linecolor=orange!80, #1]{Revise: #2}}
\newcommand{\todoCitation}[2][]{\todoEmpty[color=yellow!80, linecolor=yellow!80, #1]{Citation: #2}}
\newcommand{\todoLanguage}[2][]{\todoEmpty[color=blue!40!white, linecolor=blue!40!white, #1]{Language: #2}}
\newcommand{\todoQuestion}[2][]{\todoEmpty[color=green!80!white, linecolor=green!80!white, #1]{Question: #2}}
\newcommand{\todoNote}[2][]{\todoEmpty[color=black!20!white, linecolor=black!20!white, #1]{Note: #2}}
\newcommand{\todoFigure}[5]{\begin{figure}[#1]\centering\missingfigure[figwidth=#2]{#3}\caption{#4}\label{#5}\end{figure}}

\endinput

%% End of file 'basilea.sty'

Eu já encontrei outros problemas com um problema semelhante, comoaquimas a solução alternativa mencionada me dará a seguinte mensagem de erro:

(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1phv.fd)
! You can't use `\spacefactor' in vertical mode.
\@->\spacefactor
                 \@m {}
l.34 \pagestyle
               {thesis}
?

Estou no WSL2 Ubuntu versão Ubuntu 20.04.1 LTS e atualizei todos os meus pacotes, incluindo texlive. versão pdflatex:

pdflatex --version
pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian)
kpathsea version 6.3.1
Copyright 2019 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.01

informação relacionada