[Tex/LaTex] extra } when use titlesec package

errorssectioningtitlesec

In the .tex file, I want to use the package titlesec. But there is a error:

! Argument of \subparagraph has an extra }.

Is there some simple method to fix this?

The code is:

\documentclass{llncs}    
\usepackage[compact]{titlesec}

Best Answer

The titlesec package assumes that the usual sectioning levels are defined with the standard method, basically

\def\section{\@startsection...}

However, the llncs class defines \subparagraph to produce a warning text that the command should not be used.

If you really want to change the appearance of section titles, ignoring the fact that you probably are using llncs for submissions to Springer, where the changes will quite surely be overridden, you can do in the following way:

\documentclass{llncs}

%% Save the class definition of \subparagraph
\let\llncssubparagraph\subparagraph
%% Provide a definition to \subparagraph to keep titlesec happy
\let\subparagraph\paragraph
%% Load titlesec
\usepackage[compact]{titlesec}
%% Revert \subparagraph to the llncs definition
\let\subparagraph\llncssubparagraph

This will produce no error when loading titlesec.

Related Question