目次でタイトルの代わりに図を使用する方法

目次でタイトルの代わりに図を使用する方法

目次の特別なセクションに図 (小さなアイコン) を使用したいと思います。何か提案はありますか? 通常、私は \addcontentsline{toc}{section}{Name} 目次への参照を作成するために使用します。

答え1

ToCは (特別な) ファイルなので、情報を書き込む際に特別なことは基本的に何もありません。ただし、いつものように、ファイルに書き込む場合は、コンテンツを堅牢にするか、などの脆弱なコマンド.texを使用する必要があります。 \protect\includegraphics

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\tableofcontents
\section{Foo}
\addcontentsline{toc}{section}{\protect\includegraphics[scale=0.2]{beeduck}}
\section{Other foo}
\end{document}

ここに画像の説明を入力してください

答え2

\documentclass{scrartcl}
\usepackage{graphicx}

\begin{document}
    \tableofcontents
    \section{Foo}
    \addsec[{\protect\includegraphics[width=1cm]{tiger}}]{}
    \section{Other foo}
\end{document}

ここに画像の説明を入力してください

関連情報