如何將圖形/圖像放置在目錄元素旁邊

如何將圖形/圖像放置在目錄元素旁邊

我正在尋找將圖形/圖像放在目錄章節元素旁邊。

目前我只找到了一種方法將其放在它的下面,而不是放在章節號之前或頁碼之後。 \addstufftotoc{\nobreak\protect\includegraphics[height=1\baselineskip]{Image/en.jpg}\par}

總有機碳元素

答案1

在這裡,如果需要,我使用在目錄中指定單獨標題的功能來透過圈添加圖形。

\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}

在此輸入影像描述


補充

\chapter為了回應有關在類別中使用book和圖像垂直對齊的評論,我提供了一個額外的 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}

在此輸入影像描述

答案2

我回到這裡是因為我沒有註意到圖像顯示在使用它的標題上:在此輸入影像描述

如果可能的話,我想刪除該圖像或將其放在一邊。

相關內容