[Tex/LaTex] How to break too long chapter title into multiple lines

line-breakingtitlesec

I have titleformat for chapter title specified like this:

\documentclass{report}

\usepackage[sf,sl,outermarks,explicit]{titlesec}

\titleformat{\chapter}{\normalfont\sffamily\Large\bfseries}{\thechapter \quad \MakeUppercase{#1}}{.5em}{}

\begin{document}

\chapter{Too long chapter name needs to be split into multiple lines}

\end{document}

Now my chapter title is too long so it cannot be displayed well in one line and needs to be splitted into multiple lines. Ive tried adding \\ or \newline but without success.

\chapter{Too long chapter name needs to be split into multiple lines}

enter image description here
How can I split this title into multiple lines? Ive tried to search for similar questions but couldnt find anything useful.

Best Answer

You're putting the title in the wrong place:

\documentclass{report}

\usepackage[sf,sl,outermarks,explicit]{titlesec}

\titleformat{\chapter}
  {\normalfont\sffamily\Large\bfseries}
  {\thechapter}
  {1em}
  {\MakeUppercase{#1}}

\begin{document}

\chapter{Too long chapter name needs to be split into multiple lines}

\end{document}

enter image description here

Without explicit it can be

\titleformat{\chapter}
  {\normalfont\sffamily\Large\bfseries}
  {\thechapter}
  {1em}
  {\MakeUppercase}