0

I am searching to put a figure/image next to a TOC chapter element.

At the moment I only found a way to put it just under it but not either before the number of the chapter or after the page. \addstufftotoc{\nobreak\protect\includegraphics[height=1\baselineskip]{Image/en.jpg}\par}

TOC element

Hekmil
  • 33

2 Answers2

2

Here I use the feature of specifying a separate heading in the toc to add the graphic, via lap, if necessary.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\tableofcontents

\noindent\hrulefill

\section{Normal section}

\section[{\llap{\includegraphics[height=\baselineskip]{example-image}% \kern20pt}Left of section number}]{Left of section number}

\section[{Right of title \includegraphics[height=\baselineskip]{example-image}}]% {Right of title}

\section[{Right of page number\hfill\rlap{\kern20pt\includegraphics% [height=\baselineskip]{example-image}}}]{Right of page number} \end{document}

enter image description here


SUPPLEMENT

In response to comments about the use of \chapter in the book class, and vertical alignment of the image, I provide an additional MWE:

\documentclass[a4paper,openright]{book}
\usepackage{graphicx}
\DeclareRobustCommand\addimg[1]{\llap{\raisebox{-\dp\strutbox}%
  {\includegraphics[height=\baselineskip]{#1} \kern20pt}}}
\begin{document}
\tableofcontents

\noindent\hrulefill

\chapter[\addimg{example-image}Left of section number]{Left of section number}

\chapter[\addimg{example-image}Machines d'audit et processus MCO et MCS]{Machines d'audit et processus MCO et MCS} \end{document}

enter image description here

  • Alright I didn't know we could do such thing !

    I'm trying to apply this to my chapter definition but I'm getting an error here :

    
    

    It's saying that @chapter doens't match its definition, maybe it's not possible using chapter ?

    – Hekmil Aug 27 '20 at 13:01
  • What document class are you using @Hekmil? – Steven B. Segletes Aug 27 '20 at 13:24
  • \documentclass[a4paper,openright]{book} – Hekmil Aug 27 '20 at 13:27
  • @Hekmil I can get it to work using \DeclareRobustCommand\addimg[1]{\llap{\includegraphics[height=\baselineskip]{#1} \kern20pt}} as a definition and then \chapter[\addimg{example-image}Machines d'audit et processus MCO et MCS]{Machines d'audit et processus MCO et MCS}. Please let me know if this works for you. – Steven B. Segletes Aug 27 '20 at 13:40
  • @Hekmil To accomplish a vertical shift, try this: \DeclareRobustCommand\addimg[1]{\llap{\raisebox{-\dp\strutbox}{\includegraphics[height=\baselineskip]{#1} \kern20pt}}} – Steven B. Segletes Aug 27 '20 at 13:52
0

I'm coming back here because I didn't notice that the image is showing up on the header where it's used : enter image description here

I would like to remove the image or put it on the side, if it's possible.

Hekmil
  • 33