Graphics, Figures & TablesError when trying to add pictures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
naufrager
Posts: 3
Joined: Mon Dec 16, 2019 7:26 pm

Error when trying to add pictures

Post by naufrager »

Hello !

My images doesn't show up on my LaTex (I use Miktex and TexMaker).

I have tried many many things, including many formats like .jpg, .eps, .ps ... but there's no format working properly.

In .eps format, the image is detected by LaTeX (when i change the path, it says "image not found") but it appears as a white square.

In .jpg format, I get this error message :
! LaTeX Error: Cannot determine size of graphic in Rplot.jpg (no BoundingBox).
Here is the code I used :

Code: Select all

\documentclass{article}           
    \usepackage[latin1]{inputenc}    
    \usepackage[T1]{fontenc}          
    \usepackage[final,dvips]{graphicx}      
    \usepackage{fancybox}		  
    \usepackage{makeidx}           
    \usepackage{gensymb}

    
    \title{Project}     
    \author{Name}   
    
    \makeindex		    
    \bibliographystyle{prsty}	 
    \begin{document}
    
    \maketitle                  
    \newpage
    \tableofcontents                 	
    \newpage
    \section{Preliminary}  
    
    \subsection{Dataset}
    We chose to study the temperature of London.
    \begin{itemize}
       \item Date : Month/Year from January 2009 to December 2019 
       \item Temperature: Average temperature in London($^{\circ}$C)
       \item Rain (mm)
       \item Sunshine (h)
       \item Wind (km/h)
    \end{itemize}
    
    \subsection{Descriptive statistics}
    
    \begin{figure}[ht!]
    \centering
    \includegraphics[width=90mm]{Rplot.eps}
    \caption{A simple caption \label{overflow}}
    \end{figure}
    
    
    %%\includegraphics[width=3in]{Rplot.eps} 
    
   
    
    
    \end{document}
Please note that I have tried with an without options *dvips* and *final* when calling the package *graphicx*

Image
[Screenshot of what appears in my PDF output]


Any ideas ?

Thanks !

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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Error when trying to add pictures

Post by Stefan Kottwitz »

Welcome to the forum!

jpg and png are supported by pdfLaTeX, while eps is supported by classic LaTeX in DVI mode. Choose the right compiler version.

For eps files, compile with LaTeX to dvi and then to ps / pdf (dvips/ps2pdf), editors can have compiler settings for doing that. You may post your .log file here, as attachment, as well as the .eps file (maybe that is not a valid one) - we could test that.

Stefan
LaTeX.org admin
naufrager
Posts: 3
Joined: Mon Dec 16, 2019 7:26 pm

Error when trying to add pictures

Post by naufrager »

[EDIT: FIXED ! see below]

Thanks !

Got that. In TexMaker, I chose this "fast compiler" option:

Image

Here is what I get in the log :

Code: Select all

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250 64-bit) (preloaded format=latex 2019.12.16)  17 DEC 2019 13:48
entering extended mode
**./test.tex
(test.tex
LaTeX2e <2019-10-01> patch level 3
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2019/10/25 v1.4k Standard LaTeX document class
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\size10.clo"
File: size10.clo 2019/10/25 v1.4k Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\inputenc.sty"
Package: inputenc 2018/08/11 v1.3c Input encoding file
\inpenc@prehook=\toks14
\inpenc@posthook=\toks15

("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\latin1.def"
File: latin1.def 2018/08/11 v1.3c Input encoding file
))
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\fontenc.sty"
Package: fontenc 2018/08/11 v2.0j Standard LaTeX package

("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\t1enc.def"
File: t1enc.def 2018/08/11 v2.0j Standard LaTeX file
LaTeX Font Info:    Redeclaring font encoding T1 on input line 48.
))
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphicx.s
ty"
Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\keyval.sty
"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks16
)
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\graphics.s
ty"
Package: graphics 2019/11/01 v1.3d Standard LaTeX Graphics (DPC,SPQR)

("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-cfg\graphi
cs.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: dvips.def on input line 105.

("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-def\dvips.
def"
File: dvips.def 2017/06/20 v3.1d Graphics/color driver for dvips
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/fancybox\fancybox.s
ty"
Package: fancybox 2010/05/15 1.4

Style option: `fancybox' v1.4 <2010/05/15> (tvz)
\@fancybox=\box27
\shadowsize=\dimen105
\@Sbox=\box28
\do@VerbBox=\toks17
\the@fancyput=\toks18
\this@fancyput=\toks19
\EndVerbatimTokens=\toks20
\Verbatim@Outfile=\write3
\Verbatim@Infile=\read1
) ("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\makeidx.sty"
Package: makeidx 2014/09/29 v1.0m Standard LaTeX package
) ("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/was\gensymb.sty"
Package: gensymb 2003/07/02 v1.0 (WaS)
)
\@indexfile=\write4
\openout4 = `test.idx'.

Writing index file test.idx
No file test.aux.
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Info: Redefining \celsius on input line 16.
Package gensymb Info: Faking symbols for \degree and \celsius on input line 16.


Package gensymb Warning: Not defining \perthousand.

LaTeX Info: Redefining \ohm on input line 16.
Package gensymb Info: Using \Omega for \ohm on input line 16.

Package gensymb Warning: Not defining \micro.

LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <12> on input line 18.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <8> on input line 18.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <6> on input line 18.
[1

]
No file test.toc.
\tf@toc=\write5
\openout5 = `test.toc'.

[2]
LaTeX Font Info:    Trying to load font information for OMS+cmr on input line 2
7.
 ("C:\Users\Hugo\AppData\Local\Programs\MiKTeX 2.9\tex/latex/base\omscmr.fd"
File: omscmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info:    Font shape `OMS/cmr/m/n' in size <10> not available
(Font)              Font shape `OMS/cmsy/m/n' tried instead on input line 27.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 28.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 28.
File: Rplot.eps Graphic file (type eps)
 <Rplot.eps> [3] (test.aux) ) 
Here is how much of TeX's memory you used:
 1131 strings out of 492485
 13819 string characters out of 3122079
 74189 words of memory out of 3000000
 5501 multiletter control sequences out of 15000+200000
 10990 words of font info for 29 fonts, out of 3000000 for 9000
 1141 hyphenation exceptions out of 8191
 30i,6n,25p,265b,258s stack positions out of 5000i,500n,10000p,200000b,50000s

Output written on test.dvi (3 pages, 1796 bytes).
It still doesn't work ... :?

Oh, and here is the .eps file I use https://mega.nz/#!o8FDFC4B!OPRoqpCCSSZZ ... b3WZ77ifKw
Last edited by naufrager on Tue Dec 17, 2019 3:29 pm, edited 2 times in total.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Error when trying to add pictures

Post by Ijon Tichy »

LaTeX + dvips does not support JPEG. You have either to convert the JPEG to EPS or use PDFLaTeX, LuaLaTeX or XeLaTeX to generate the PDF without using DVI and PS as intermediate formats.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
naufrager
Posts: 3
Joined: Mon Dec 16, 2019 7:26 pm

Error when trying to add pictures

Post by naufrager »

But the thing is that I use a .eps file.

EDIT : I got it to work in the end. It's really weird, but with the .png or .jpg format, it worked with PdfLaTex compiler. I really don't know how as it's just what I did 10 times before trying things out with a .eps format in LaTeX + dvi2ps + ps2pdf and it never worked before (I had the "Cannot determine size of graphic in Rplot.jpg (no BoundingBox)." error)

So, in the end, i'll stay with jpg and png formats using the PdfLaTex compiler in TexMaker.

However, I'm still a bit frustrated not to have achieved to make it work with .eps formats
Last edited by naufrager on Tue Dec 17, 2019 3:32 pm, edited 1 time in total.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Error when trying to add pictures

Post by Ijon Tichy »

The conversion of EPS to PDF can be done on the fly. If you use a TeX distribution that does not do this automatically you can explicitly use package epstopdf. And XeLaTeX does also support EPS. And I've also told you another choice if you insist in using LaTeX + dvips …
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Error when trying to add pictures

Post by Stefan Kottwitz »

That eps file works me. Also with pdfLaTeX. I use TeX Live 2019 though.
naufrager wrote:it never worked before (I had the "Cannot determine size of graphic in Rplot.jpg (no BoundingBox)." error)
Well that bounding box error points to non-pdfLaTeX since LaTeX requires a bounding box when it expects an eps file. That's the line %%BoundingBox: 0 0 649 413 in your eps file, which is not in a jpg file. At some time when you updated your LaTeX distribution (or installed a new one), you can try again using eps files with pdfLaTeX, or with \usepackage{epstopdf} right now.

Stefan
LaTeX.org admin
Post Reply