This doesn't really add much to @Ignasi's answer, but you could declare \section
as a display heading (like a chapter), which makes it slightly easier to lay out TOPIC and the section name.
I also pointlessly used expl3
coffins so things would line up without me having to do any thinking. There are absolutely better ways of doing this…
\documentclass{book}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{fontawesome5}
\ExplSyntaxOn
\dim_const:Nn \c__kidegalize_section_ht_dim { 30 pt }
\coffin_new:N \l__kidegalize_nib_coffin
\coffin_new:N \l__kidegalize_section_coffin
\hcoffin_set:Nn \l__kidegalize_nib_coffin
{
\color_select:n { white }
\LARGE
\faPenNib
}
\coffin_rotate:Nn \l__kidegalize_nib_coffin { 135 }
\hcoffin_set:Nn \l__kidegalize_section_coffin
{
\color_select:n { black!50 }
\rule { \c__kidegalize_section_ht_dim } { \c__kidegalize_section_ht_dim }
\skip_horizontal:n { \c__kidegalize_section_ht_dim / 3 }
\rule { 2pt } { \c__kidegalize_section_ht_dim }
\skip_horizontal:n { \c__kidegalize_section_ht_dim / 3 }
}
\coffin_attach:NnnNnnnn
\l__kidegalize_section_coffin { hc } { vc }
\l__kidegalize_nib_coffin { hc } { vc }
{ -\c__kidegalize_section_ht_dim / 3 - 1pt } { 0pt }
\coffin_resize:Nnn \l__kidegalize_section_coffin
{ \coffin_wd:N \l__kidegalize_section_coffin } { 0pt }
\NewDocumentCommand \nib { }
{
\coffin_typeset:Nnnnn \l__kidegalize_section_coffin
{ r } { b } { 0pt } { 0pt }
}
\dim_const:Nn \nibwidth { \coffin_wd:N \l__kidegalize_section_coffin }
\ExplSyntaxOff
\titleformat{\section}[display]
{\normalfont\Large\sffamily\bfseries}
{TOPIC-\thesection}
{0pt}
{\nib\normalfont\large\sffamily\color{black!50}}
\titlespacing*{\section}{\nibwidth}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
\begin{document}
\setcounter{chapter}{1}
\setcounter{section}{1}
\section{Raoult's law, Ideal and Non-ideal Solutions}
\end{document}