# extra } when use titlesec package

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}

• Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Anke Mar 18 '13 at 8:19
• Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or hit Ctrl+K. – Claudio Fiandrino Mar 18 '13 at 8:20
• The llncs class is used for submissions to Springer; it's not a good idea to change the setup. In any case, the class explicitly disables \subparagraph: “You should not use \subparagraph with this class” is what appears when you try using it under normal setting. – egreg Mar 18 '13 at 10:10
• Please let us know if you got the answer figured out for this. – Phani Mar 27 '13 at 13:22

## 2 Answers

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.

You can comment out the lines that have \subparagraph in titlesec.sty. I am not sure if this is the correct way to go about but it compiles fine for this way.

• Please have a look to the comment of @egreg. BTW: It is not a good choice to change a package file like titlesec.sty. If a change is needed, copy the file, rename it to mytitlesec.sty for example and change this one. Now you can use your changed package using \usepackage{mytitlesec.sty} without any bad effects to other documents using the original titlesec.sty. – Kurt Mar 27 '13 at 14:40