I am making a custom sty file in which I intend to change the spacing before and after sections, subsections and subsubsections.

I use the command \titlespacing{<command>}{<left>}{<before-sep>}{<after-sep>} but it doesn't have any effect. May someone help me, please?

My MWE for the sty file is the following


\definecolor{coolblack}{rgb}{0.0, 0.18, 0.39}
    \definecolor{darkcerulean}{rgb}{0.03, 0.27, 0.49}
\definecolor{blue(ncs)}{rgb}{0.0, 0.53, 0.74}



And for the test document is as following:




\section{Título nivel 1}


\subsection{Titulo nivel 2}


\subsubsection{Titulo nivel 3}



Thanks in advance


The titlesec and sectsty packages don't work well together, you could consider just using titlesec with its \titleformat* command instead of using \sectionfont etc. from sectsty:


does exactly what you want. Alternatively you could try to use both (not recommended) and just change the order of calling them. Call sectsty first and it works.




  • Thank you! I followed your advice of not using titlesec and sectsy together and it worked! – user151562 Jun 29 '18 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.