Graphics, Figures & TablesImporting pictures/graphics

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
florin
Posts: 2
Joined: Sat Nov 21, 2020 11:28 am

Importing pictures/graphics

Post by florin »

Dear Latex Community,

I am having problems importing pictures to my Latex document. What confuses me is that I managed to import the first picture saved in a folder called "images" but for the second one I get the following message:

LaTeX error: File '2' not found.

How is it possible that using the same set of commands:

\begin{figure}
\centering
\includegraphics[width=1\textwidth]{1}
\caption{The pairs uniquely determine the transformation.}
\label{fig:1}
\end{figure}

with 2 instead of 1 (the names of the pdf documents imported)

works for 1 but does not work for 2. They are located in the same folder and the path has been shown at the beginning of the document:

\graphicspath{C:/Users/User/Desktop/LaTex/LaTexdoc/images}

Your advices will be highly appreciated. Thank you!!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Importing pictures/graphics

Post by Ijon Tichy »

florin wrote: \graphicspath{C:/Users/User/Desktop/LaTex/LaTexdoc/images}
This is wrong. The manual explains:
\graphicspath{〈dir-list〉}
This optional declaration may be used to specify a list of directories in which to search for graphics files. The format is the same as for the LaTeX2ε primitive \input@path. A list of directories, each in a {} group (even if there is only onein the list). For example:

Code: Select all

\graphicspath{{eps/}{tiff/}}
would cause the system to look in the subdirectories eps and tiff of the current directory. (All modern TeX systems use / as the directory separator, even on Windows.)
I've made the relevant sentence, you've missed, bold. So a correct setting would could be, e.g.,

Code: Select all

\graphicspath{{C:/Users/User/Desktop/LaTex/LaTexdoc/images}}
But I would recommend to use a relative path to a subdirectory of your document to make the document more portable. For global images you can use a subdirectory in your local or personal TEXMF tree. See the manual of your TeX distribution for more information about TEXMF trees.

BTW: Please always try to show a Infominimal working example instead of some code snippets. And please mark your code as code using either the Code button in the toolbar or selecting TeX (LaTeX) from the Select code selector.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
florin
Posts: 2
Joined: Sat Nov 21, 2020 11:28 am

Importing pictures/graphics

Post by florin »

Thank you very much!!
Post Reply