-1

I have the problem that LaTeX doesn't show the List of figures and List of Listings. I don't know where the problem is.

I'm working with TeXstudio and the code was defined as follows:

\begin{document}

\begin{lstlisting}[caption={Testcode is here}\label{lst:Testcode is here},frame=single] 
//here is the code
\end{lstlisting}

\begin{figure}[H]
    \centering
    \includegraphics[width=0.5\textwidth]{pic1.jpg}
    \caption{That is a pic}
    \label{fig: That is a pic}
\end{figure}

\listoffigures

\lstlistoflistings

\end{document}

Both lists remain empty. Can anyone tell me what the problem is??

yuro
  • 2,189
  • 6
  • 40
  • 76
  • 1
    What `\documentclass` are you using? Perhaps you could provide the community with a [minimal working example (MWE)](http://goo.gl/dtPzv) rather than just your document code (the preamble may play an important role in your current problem). – Werner Feb 10 '16 at 17:35

2 Answers2

-1

I am able to generate the list of figures by doing these modifications on your file; Adding these two lines to the very beginning of the file:

\documentclass{article}
\usepackage{listings}

and then, changing [H] into [h] (lower case).

Winsoft
  • 119
  • 5
-1

@Winsoft There is nothing wrong with using [H] you just need to add the float-package (see https://tex.stackexchange.com/questions/132106/difference-between-h-and-h-in-float-position).

Adding the minimal set of needed packages compiled to the desired result. Please note that the list of figures and list of listings won't show up before compiling the document twice.

\documentclass{article}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}

\begin{document}

\begin{lstlisting}[caption={Testcode is here}\label{lst:Testcode is here},frame=single] 
//here is the code
\end{lstlisting}

\begin{figure}[H]
    \centering
    \includegraphics[width=0.5\textwidth]{pic1.jpg}
    \caption{That is a pic}
    \label{fig: That is a pic}
\end{figure}

\listoffigures

\lstlistoflistings

\end{document}
Paul Stahr
  • 41
  • 6