2

I am trying to import on my document several tables in png format that where created with excel. They already include the caption and the table number so I don't want to include a caption. Following advises given here and there I use the following command:

\begin{table}
\centering
\stepcounter{table}
\includegraphics{mytable.png}
\addcontentsline{lot}{section}{\protect\numberline\thetable\ignorespaces mytable title}
\end{table}

That way I can import my table and have it listed in the LoT with the correct number. This works perfectly until table 9. For table 10, the list of table splits the 1 and the 0: the 1 is place at the right place but the 0 ends up with the table title.

What I am doing wrong here?

Thanks so much for your help

Best

1 Answer 1

2

\numberline has an argument which should be used with a pair of braces: {...}, otherwise \thetable will be expanded and from 10,.... \numberline sees the leading figure first, i.e. 1, but not the following ones (0,1,etc.) -- those will be treated as being part of the title:

(the \foreach loop is only for demo purposes)

\documentclass{article}

\usepackage{pgffor}
\begin{document}

\listoftables


\setcounter{table}{9}%
\foreach \x in {10,...,20} {%
\begin{table}
\centering
\stepcounter{table}
%\includegraphics{mytable.png}
\addcontentsline{lot}{section}{\protect\numberline\thetable\ -- wrong usage}
\addcontentsline{lot}{section}{\protect\numberline{\thetable} -- mytable title}
\end{table}
}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .