0

I would like to know how I can create the following types of section headings enter image description here

Note that the image is loaded using the graphics package. I have tried the following

\section{\includegraphics[scale=0.2]{Images/introduction}\quad Introduction}

Unfortunately, this code shows with the image in the table of contents. What I want is the code not to show with the image in the table of contents and the Image to be on the left of the section title. I would appreciate it if this can be done like a macro as I have a big document so everywhere with sections I want this to repeat

5
  • Looks like tex.stackexchange.com/q/531625/73317 (by an ungrateful question asker).
    – frougon
    Jun 23 at 20:49
  • @frougon. Thank you. The solution only works for unnumbered ones I have just tried it. Is it possible to modify it so it works for all? Jun 23 at 21:03
  • @frougon I want for the numbered sections the Icon comes before the number as shown in the picture I attached Jun 23 at 21:05
  • The solution works both for numbered and unnumbered sections. The icon is printed to the left of the section number, as shown in the pictures of my answer there.
    – frougon
    Jun 23 at 22:07
  • @frougon I am trying your solution in The Legrand Orange Book available at latextemplates.com/template/legrand-orange-book. Can it happen that something is clashing with numbered sections? Please put your answer here so that I can mark your answer at the end. Thank you very much. Jun 24 at 1:16

1 Answer 1

1

The reason is the LegrandOrangeBook.cls file use titlesec package to customize the section heading. You could simple replace the corresponding codes in LegrandOrangeBook.cls file from line 211 to 226 with following code:

\titleformat
    {\section} % Section type being modified
    [block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
    {\bfseries\sffamily\Large} % Format of the whole section
    {\llap{\textcolor{ocre}{\thesection}\hspace{1em}}} % Format of the section label
    {0cm} % Space between the title and label
    {\includegraphics[height=1.5ex]{example-image}\quad#1} % Code before the label
    [] % Code after the label
\titleformat
    {name=\section, numberless} % Section type being modified
    [block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
    {\bfseries\sffamily\Large} % Format of the whole section
    {\includegraphics[height=1.5ex]{example-image}\quad#1} % Format of the section label
    {0cm} % Space between the title and label
    {} % Code before the label
    [] % Code after the label

enter image description here

1
  • Thank you this is what I needed Jun 24 at 7:34

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.