[Tex/LaTex] How to change the section font to specific size by using \titleformat

fontsizesectioningtitlesec

I want to set the section font to the specific size and type. But using \titleformat can only give few standard types, like Large, large…

\titleformat*{\section}{\LARGE\headingfont} 
\titleformat*{\subsection}{\Large\headingfont} 
\titleformat*{\subsubsection}{\large\headingfont} 

I wonder is there any way to use

\fontencoding{OT1}\fontfamily{cmr}\fontseries{m}\fontshape{n}\fontsize{11pt}{11}\selectfont

to change the section font size?
Thanks a lot!

Best Answer

You can simply use your commands as arguments for \titleformat*:

\titleformat*{\section}{\fontencoding{OT1}\fontfamily{cmr}\fontseries{m}%
  \fontshape{n}\fontsize{11pt}{11}\selectfont}