2

I am trying to add a picture in the same folder, subfolder pictures, named iphone.png, but it will terminate with an error.

\documentclass[journal]{IEEEtran}

\usepackage{graphicx}
\usepackage{hyperref}
\DeclareMathOperator{\Alt}{alt}

\begin{document}

\begin{figure}
    \label{fig:iphoneCropped}
    \begin{center}
        \includegraphics[trim=0 5cm 0 5cm, clip]{../pictures/iphone.png}
        \caption{Pictures of site on iphone}
    \end{center}
\end{figure}

\autoref{fig:iphoneCropped}
Also it will refer to this picture as being subsubsection III-A1, instead of as figure.


\end{document}
  • 1
    what error message did you get? Also note that \label must be after \caption. – David Carlisle Dec 18 '18 at 12:58
  • 3
    from your description I would expect you want {pictures/iphone.png} rather than {../pictures/iphone.png} but impossible to say. (The comment in the last line of your example is due to \label being in the wrong pace as noted in the first comment) – David Carlisle Dec 18 '18 at 12:59
  • Package pdftex.def Error: File '../pictures/iphone.png' not found: using draft setting. Thank you David it now finds the picture, and the right ref type :)!!! I didn't know the label placing meant so much. – yoshi Dec 18 '18 at 13:03
3

The path needs to be relative to the directory where tex is run, and \label needs to be after, or in, \caption

\documentclass[journal]{IEEEtran}

\usepackage{graphicx}
\usepackage{hyperref}
\DeclareMathOperator{\Alt}{alt}

\begin{document}

\begin{figure}
\centering
        \includegraphics[trim=0 5cm 0 5cm, clip]{pictures/iphone.png}
        \caption{Pictures of site on iphone\label{fig:iphoneCropped}}

\end{figure}

\autoref{fig:iphoneCropped}
Also it will refer to this picture as being subsubsection III-A1, instead of as figure.


\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.