Graphics, Figures & Tables ⇒ Graphics in table of contents
Graphics in table of contents
I'm trying to do something like below where I have a small icon in the section heading and the same image in the table of contents, but I get a "! Missing \endcsname inserted." error when I try.
MWE
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\tableofcontents
\section{ Section \includegraphics[height=1.25ex]{foo.pdf} Heading}
\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: Graphics in table of contents
I tried your MWE and get the same error. I tried to replace the parameter [height=1.25ex] with something like [scale=0.5] and get the same error.
I tried with no parameter at all and get an output PDF, but there are two errors yet. Those errors are "! Argument of \@sect has an extra }.", and "! Paragraph ended before \@sect was complete.". Although, the errors seem not to affect the output PDF.
http://latexlive.wordpress.com/
TeX Live 2009/TeXmaker
Powered by Debian Squeeze
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Graphics in table of contents
Code: Select all
\section{Section {\includegraphics[height=1.25ex]{foo}} Heading}
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Graphics in table of contents
I tried the extra curly brackets but it doesn't seem to make any difference.
I tried without the parameter at all and get the same error that joe74 got. I do eventually get an output file, but for me there is no contents line for the section with the image.
Has anyone ever seen putting an image in the table of contents work or am I in uncharted territory here?