You must have missed section
3.8. Extended Settings of the
titlesec manual. Here is a proof of concept that it
is possible to define different formats for numbered and unnumbered titles using different sections formats (I used two formats from the manual for this):
Code: Select all
\documentclass{article}
\usepackage{titlesec}
\titleformat{name=\section}[block]
{\normalfont\bfseries\filcenter}{\fbox{\itshape\thesection}}{1em}{}
\titleformat{name=\section,numberless}
{\titlerule\vspace{.8ex}\normalfont\itshape}{}{0pt}{}
\usepackage{lipsum}
\begin{document}
\section{foo}
\lipsum[1]
\section*{bar}
\lipsum[1]
\end{document}
Regards