[Tex/LaTex] Use \titleformat inside \begin{document}

sectioningtitlesec

I would like to adjust section headings at some point in the document. However, \titleformat can only be used in preamble, something like the following fails:

\documentclass{article}
\usepackage{titlesec}

\begin{document}
\titleformat{name=\section}[display]
  {\huge} % format
  {} % label
  {10pt} %sep
  {} %before

\section{test}
\end{document}

Is it possible to adjust \titleformat in the middle of a document?

Edit:

\begin{document}
\titleformat{\section}[display]
  {\huge} % format
  {} % label
  {10pt} %sep
  {} %before

\section{test}
\end{document}

works, but then how do I use page=even in the \titleformat?

Best Answer

My edit of the question already says that I can use \titleformat{\section}[display] instead of \titleformat{name=\section}[display] outside of the preamble. I still had an issue with page=odd and page=even, which can only be set with the \titleformat{name=\section}[display] format.

I've circumvented the problem with:

\titleformat{\section}[display]
  {\secstyle} % format
  {} % label
  {10pt} %sep
  {\vspace{-15mm}%
\ifthenelse{\isodd{\thepage}}%
  {\fancytab{\chaphead}{\arabic{chapter}}}%
  {}%
\filcenter\textls[-35]} %before

to apply only on odd pages.

Related Question