% `-' is a letter (round-precision is one word); xlstcsbreak still starts a
% new word at each backslash, except within \\ (so -\baselineskip splits).
\expandafter\edef\csname xlst@latex@restoreat\endcsname{\catcode64=\the\catcode64\relax}\catcode64=11
\ifcsname lst@ifxlstcsbreak\endcsname\else
\lst@Key{xlstcsbreak}{false}[t]{\lstKV@SetIf{#1}\lst@ifxlstcsbreak}
\expandafter\def\expandafter\xlst@latex@endsbs\expandafter#\expandafter1\csname lst@um\@backslashchar\endcsname
   \xlst@latex@stop#2\xlst@latex@nil{\if\relax\detokenize{#2}\relax\else\let\xlst@latex@next\relax\fi}
\edef\xlst@latex@csbreak{%
   \noexpand\lst@ifletter\noexpand\ifnum\noexpand\lst@length>\noexpand\z@
      \let\noexpand\xlst@latex@next\noexpand\lst@Output
      \noexpand\expandafter\noexpand\xlst@latex@endsbs\noexpand\the\noexpand\lst@token\noexpand\xlst@latex@stop
         \expandafter\noexpand\csname lst@um\@backslashchar\endcsname\noexpand\xlst@latex@stop\noexpand\xlst@latex@nil
      \noexpand\xlst@latex@next
   \noexpand\fi\noexpand\fi}
\lst@AddToHook{SelectCharTable}{\lst@ifxlstcsbreak
   \lst@DefSaveDef{92}\xlst@latex@bs{\xlst@latex@csbreak\xlst@latex@bs}\fi}
\fi
\xlst@latex@restoreat

\lstdefinelanguage{lLatex}{
number suffixes={},
morecomment = [l]{\%},
keywordstyle = [5]\xlstGetStyle{command}, % for commands, in this case, as we dont have literals
add to literate={\\$}{{\$}}1 {\\$}{{\$}}1 {\\\%}{{\%}}1 {\\(}{{{\textcolor{xlst@colors@lst@keywordC}{\textbackslash(}}}}2 {\\)}{{{\textcolor{xlst@colors@lst@keywordC}{\textbackslash)}}}}2 {\\[}{{{\textcolor{xlst@colors@lst@keywordC}{\textbackslash[}}}}2 {\\]}{{{\textcolor{xlst@colors@lst@keywordC}{\textbackslash]}}}}2 {\\;}{{{\textcolor{xlst@colors@lst@keywordA}{\textbackslash;}}}}2 {scrlayer-scrpage}{{{\xlstGet{highlight}{scrlayer-scrpage}}}}{16} {sopra-base}{{{\xlstGet{highlight}{sopra-base}}}}{10} {sopra-paper}{{{\xlstGet{highlight}{sopra-paper}}}}{11} {sopra-documentation}{{{\xlstGet{highlight}{sopra-documentation}}}}{19} {sopra-models}{{{\xlstGet{highlight}{sopra-models}}}}{12} {sopra-attachments}{{{\xlstGet{highlight}{sopra-attachments}}}}{17} {sopra-requirements}{{{\xlstGet{highlight}{sopra-requirements}}}}{18} {sopra-listings}{{{\xlstGet{highlight}{sopra-listings}}}}{14} {sopra-seraphim}{{{\xlstGet{highlight}{sopra-seraphim}}}}{14} {sopra-changelog}{{{\xlstGet{highlight}{sopra-changelog}}}}{15} {sopra-tables}{{{\xlstGet{highlight}{sopra-tables}}}}{12} {sopra-standard}{{{\xlstGet{highlight}{sopra-standard}}}}{14},
alsoletter={\\\#@*-},
moredelim=**[is][{\xlsthlboxd{\xlstcustom}}]{|custom|}{|custom|},
moredelim=[is][]{|plain|}{|plain|},
moredelim=[is][\xlstGetStyle{highlight}]{|ihl|}{|ihl|},
escapeinside={!*}{*!},
morekeywords = [5]{\\documentclass,\\usepackage,\\begin,\\end,\\input,\\include,\\title,\\author,\\date,\\maketitle,\\tableofcontents,\\section,\\subsection,\\subsubsection,\\paragraph,\\part,\\chapter,\\label,\\ref,\\cite,\\footnote,\\caption,\\item,\\newpage,\\clearpage,\\newline,\\linebreak,\\vspace,\\hspace,\\vfill,\\hfill,\\noindent,\\centering,\\emph,\\textbf,\\textit,\\texttt,\\textsf,\\textrm,\\textsc,\\textsl,\\textcolor,\\mathcolor,\\color,\\bfseries,\\itshape,\\scshape,\\ttfamily,\\sffamily,\\rmfamily,\\normalfont,\\begingroup,\\endgroup,\\colorbox,\\fbox,\\mbox,\\hbox,\\vbox,\\parbox,\\raisebox,\\rule,\\includegraphics,\\hline,\\cline,\\multicolumn,\\newcommand,\\renewcommand,\\providecommand,\\DeclareRobustCommand,\\newenvironment,\\renewenvironment,\\newcounter,\\setcounter,\\addtocounter,\\stepcounter,\\arabic,\\roman,\\Roman,\\alph,\\Alph,\\newlength,\\setlength,\\addtolength,\\def,\\let,\\gdef,\\edef,\\xdef,\\expandafter,\\noexpand,\\csname,\\endcsname,\\if,\\else,\\fi,\\ifx,\\ifnum,\\ifdim,\\relax,\\ignorespaces,\\protect,\\makeatletter,\\makeatother,\\jobname,\\the,\\value,\\hypersetup,\\href,\\url,\\hyperref,\\hypertarget,\\hyperlink,\\colorlet,\\definecolor,\\left,\\right,\\middle,\\frac,\\sqrt,\\sum,\\prod,\\int,\\lim,\\exp,\\binom,\\mathbb,\\mathcal,\\mathbf,\\mathrm,\\mathit,\\text,\\leq,\\geq,\\neq,\\land,\\lor,\\cap,\\cup,\\emptyset,\\pi,\\theta,\\tau,\\lceil,\\rceil,\\draw,\\node,\\path,\\fill,\\tikzset,\\pgfkeys,\\pgfkeysvalueof,\\lstset,\\lstinputlisting,\\lstdefinelanguage,\\lstdefinestyle,\\textbackslash,\\baselineskip,\\tiny,\\enquote,\\blindtext,\\lipsum,\\RegisterLanguage,\\LoadLanguages,\\xlstlangoverride,\\xlstsetstyle,\\xlstblacklistlinenumbers,\\xlstDefineStyles,\\xlstGet,\\xlstGetStyle,\\lstcolorlet,\\lstcolordef,\\BadgeNextListing,\\\\},
morekeywords = [3]{pmatrix,bmatrix,vmatrix,matrix,cases,tabular,tabular*,array,itemize,enumerate,description,equation,equation*,align,align*,alignat,alignat*,gather,multline,figure,table,center,flushleft,flushright,quote,quotation,verbatim,minipage,document,abstract,tikzpicture,axis,scope,frame,block,lstlisting,lstplain,lstnonum,multicols,minted,java,cpp,latex,plainjava,plainlatex},
morekeywords = [7]{\#1,\#2,\#3,\#4,\#5,\#6,\#7,\#8,\#9},
alsoother={!,"_^},
xlstcsbreak=true,
}

\RegisterLanguage{latex}{lLatex}