LaTeX forum ⇒ Graphics, Figures & TablesLatex images are not showing!

Information and discussion about graphics, figures & tables in LaTeX documents.
yurica
Posts: 7
Joined: Thu Mar 23, 2017 9:54 pm

Latex images are not showing!

Postby yurica » Thu Mar 23, 2017 10:15 pm

Hi Latex Community!

I am facing some issues trying to insert images on my code. The problem is: none of them are being displayed. However, I am not getting any errors and the file compiles normally. Here is the library packages I am using followed by an image insertion code example (I am using this same code for all my images):

Note 1: Ignore the portuguese comments in my code, I am from Brazil :)
Note 2: The packages with "%" are packages that I've already tried to use to insert the images, and none of them worked.

  1. \documentclass[11pt]{book}
  2.  
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. % Inclusão de pacotes e bibliotecas
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. \usepackage[portuguese]{babel} %Português Brasil
  7. \usepackage[latin1]{inputenc} %uso de acento direto do teclado
  8. \usepackage[dvips]{graphicx,color} %incluir figuras
  9. \usepackage{amsthm,amsfonts} %fontes matemáticas
  10. \usepackage{adjustbox} %Alinhar figuras
  11. %\usepackage[pdftex]{graphicx} %incluir figuras PDF
  12. %\usepackage{epsfig} %inserir figuras eps
  13. %\graphicspath{{Figuras/}} %Buscar imagens nessa pasta
  14.  
  15. \definecolor{cinza}{RGB}{238,238,238} %define um padrão de cor
  16. \definecolor{cinza1}{RGB}{150,150,150} %define um padrão de cor
  17. \usepackage[Bjornstrup]{fncychap} %estilo para titulo do capitulo
  18. \usepackage{verbatim} %comentários de várias linhas
  19.  
  20. %\usepackage[tc]{titlepic} %estilo para figura na capa
  21. %\titlepic{\includegraphics[width=\textwidth]{fig/capa.eps}}
  22.  
  23. \usepackage{fancyhdr} %rodape e cabeçalho
  24. \pagestyle{fancy} %estilo de cabecalho
  25. \fancyhf{} % apagar as configuracoes atuais
  26. \fancyhead[LE,RO]{\footnotesize\bfseries\thepage}
  27. \fancyhead[LO]{\scriptsize\bfseries\rightmark}
  28. \fancyhead[RE]{\scriptsize\bfseries\leftmark}
  29. \renewcommand{\headrulewidth}{0.2pt}
  30. \renewcommand{\footrulewidth}{0pt}
  31. \addtolength{\headheight}{0.3pt} % fazer espaço para o risco
  32. \fancypagestyle{plain}{%
  33. \fancyhead{} % Tirar cabeçalhos de página vazias
  34. \renewcommand{\headrulewidth}{0pt} % e o risco
  35. }
  36.  
  37.  
  38. \usepackage{listings} %inserção de códigos-fontes de programação
  39. % opções do pacote listings
  40. \lstset{numbers=left,
  41. language=C,
  42. basicstyle=\ttfamily\footnotesize,
  43. keywordstyle=\color{red}\bfseries,
  44. stringstyle=\color{blue},
  45. commentstyle=\color{cinza1},
  46. extendedchars=true,
  47. showspaces=false,
  48. showstringspaces=false,
  49. numberstyle=\tiny,
  50. breaklines=true,
  51. backgroundcolor=\color{cinza},
  52. breakautoindent=true,
  53. captionpos=b,
  54. xleftmargin=0pt,
  55. }


  1. \begin{figure}[!htb]
  2. \centering %centralizar a figura
  3. \includegraphics[height=5cm]{Figuras/Imagem001.eps}
  4. \end{figure}


Thanks in advance! Any help would be appreciated. I am completely new in the latex language and syntax.

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Mar 24, 2017 12:01 am

Hi yurica,

welcome to the forum!

Your code has to run LaTeX in DVI mode. Perhaps the editor or something causes it to run in pdfLaTeX mode. Could you please post your .log file, as attachment?
EPS files are only supported by LaTeX in DVI mode that produces DVI, and PDF is created for example using dvi2ps and ps2pdf. pdfLaTeX goes the direct way but doesn't support EPS, but with epstopdf in addition.

Stefan
Site admin

yurica
Posts: 7
Joined: Thu Mar 23, 2017 9:54 pm

Postby yurica » Thu Mar 30, 2017 9:38 pm

Helo Stefan,

Thanks for the quick reply, and sorry for my late answer. I figured it out that my LaTeX was running in pdfLaTeX mode. So I converted my first image (Imagem001.pdf) to a pdf file and now I get an error while trying to compile it:

"Cannot determine size of graphic in Figuras/Imagem001.pdf (no BoundingBox). ...aphics[height=5cm]{Figuras/Imagem001.pdf}"

I am using this code to insert it:

  1. \begin{figure}[!htb]
  2. \centering %centralizar a figura
  3. \includegraphics[height=5cm]{Figuras/Imagem001.eps}
  4. \end{figure}


Also, how do I "copy" my log to post it here as an attachment? Sorry, I am really a beginner using this software. Thanks again for the answer!

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Thu Mar 30, 2017 11:01 pm

Hi yurica!

In your code, there is ".eps", not ".pdf".

Besides that, the "Cannot determine size of graphic" still looks like LaTeX is running in DVI mode, trying to get bounding box information from an eps but that doesn't work worth pdf. Ensure that it's really pdf.

You can attach a .log file here, this way: below the edit field for writing a post, when writing, there's a tab options and a tab "Attachments", click this. Then click the "Add files" button.

Stefan
Site admin

yurica
Posts: 7
Joined: Thu Mar 23, 2017 9:54 pm

Postby yurica » Fri Mar 31, 2017 9:13 pm

Hi Stefan!

Thank you! I got every image showing up perfectly now in the .eps format and DVI mode! But now that they showed up, I got another problem. They are not in the position that I want them to be. How do I insert them exactly at the place where the code is? Also, using .eps format, how do I move the image to the right/left and also change its size? Thank you again for your patience and time.

Yuri.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Mar 31, 2017 11:44 pm

LaTeX figures are designed to move to an optimal place for best page breaks, filling the page. If you place them exactly in the code, you can get page break issues since the code place may not be the best fit for page breaks - often one can then get white space at page bottoms. The figure philosophy, also in good books, is placing figure near, such as at the top of the next page, floating text before, filling the page. And that's why book's figures have numbers for referencing: they appear a bit later in the text, for page design.

So, I would use \begin{figure}[!htbp] to allow floating but to the next possible place here, top, bottom or page.

If you insist on here, definitely, even if there's no space, you can use \begin{figure}[H] but before load the float package: \usepackage{float}.

Stefan
Site admin

yurica
Posts: 7
Joined: Thu Mar 23, 2017 9:54 pm

Postby yurica » Thu Apr 06, 2017 8:48 pm

Hi Stefan!

Thank you for the help. I have one last (maybe) question. When compiling and previewing my DVI file using the standard "Yet Another Previewer (YAP)", I can see that everything is okay. However, if I update anything in my code (text, images...) and compile it again, I keep seeing the "old" preview file, without the new changes. Do you know how to fix this? Thank you in advance.

Ps.: I am writing a SciLab programming book for one of my professors in the university. I work with him only on Thursdays and Fridays, and that's why I take some time to answer/ask.

Yuri

User avatar
Stefan Kottwitz
Site Admin
Posts: 8536
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Thu Apr 06, 2017 10:16 pm

Hi Yuri,

is the file actually changed? So, is it updated if you close the previewer and open it again? I just think about the possibility that an error in the code may prevent creating a new output file.

As far as I know, YAP is for previewing DVI, not PDF. That may also be a reason. SumatraPDF is a very good and fast PDF reader on windows, syncing with TeX.

Stefan
Site admin

yurica
Posts: 7
Joined: Thu Mar 23, 2017 9:54 pm

Postby yurica » Fri Apr 07, 2017 9:06 pm

Hi Stefan,

I am constantly changing the file and even if I close YAP and open it again, it shows me an old version of it. Many people have the same problem with YAP, and I never find a solution. I was wondering if you knew a fix for this issue. I am working with DVI format for now on, as well as EPS images, not a PDF file. Anyway, thanks for the tips and I'll try to find a new DVI previewer. See ya!

Yuri


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Bing [Bot] and 11 guests