0

I'm using one of the preset project formats provided by Sharelatex (thesis template with memoir). The .tex file looks like:

\documentclass[11pt,a4paper,oldfontcommands]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage[dvips]{graphicx} %I've tried removing [dvips] here but this doesn't make a difference?
\usepackage{xcolor}
\usepackage{times}

\usepackage[
breaklinks=true,colorlinks=true,
linkcolor=black,urlcolor=black,citecolor=black,% PRINT
bookmarks=true,bookmarksopenlevel=2]{hyperref}

\usepackage{geometry}
\geometry{total={210mm,297mm},left=25mm,right=25mm, bindingoffset=0mm, top=25mm,bottom=25mm}
\OnehalfSpacing

%%% CHAPTER'S STYLE
\chapterstyle{bianchi}
%%% STYLE OF SECTIONS, SUBSECTIONS, AND SUBSUBSECTIONS
\setsecheadstyle{\Large\bfseries\sffamily\raggedright}
\setsubsecheadstyle{\large\bfseries\sffamily\raggedright}
\setsubsubsecheadstyle{\bfseries\sffamily\raggedright}

%%% STYLE OF PAGES NUMBERING
\pagestyle{plain}
\makepagestyle{plain}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}
\makeevenhead{plain}{}{}{}
\makeoddhead{plain}{}{}{}

\maxsecnumdepth{subsection}
\maxtocdepth{subsection} 

\begin{document}

Then, later on in my script I use:

\begin{figure}[h]
\includegraphics[width=8cm]{Xray}
\centering
\end{figure}

But this doesn't produce a picture, just a box where the picture should be with "Xray.png" in it. I have the .png file in the same folder as the .tex file so I am a little lost as to what could be the problem. Anyone who knows what could be the cause of the problem?

  • Welcome to TeX.SE!. You need to include the image extension: .jpg, .png. E.g.: Xray.jpg – Cragfelt Dec 12 '17 at 16:18
  • 1
    Remove option [dvips] from \usepackage[dvips]{graphicx} – Cragfelt Dec 12 '17 at 16:36
  • 2
    @Cragfelt why would anyone need to include the extension? – David Carlisle Dec 12 '17 at 17:24
  • 1
    you have specified [dvips] but dvips can not include png files. If you use pdflatex rather than latex/dvips then it will work. – David Carlisle Dec 12 '17 at 17:25
  • 1
    it will sort of work by accident but it is much better to put \centering at the start of the figure, not the end. – David Carlisle Dec 12 '17 at 17:27
1

Remove option [dvips] from \usepackage[dvips]{graphicx} in preamble. As @DavidCarlisle stated, place \centering command before the figure command line.

\begin{figure}[h]
\centering
\includegraphics[width=8cm]{Xray}
\end{figure}
  • Hi Cragfelt, I've removed dvips and tried using .png , .jpeg and .pdf as format, but all of those won't show me an image still (also I placed the \centering command to before the figure command line like you said). Also I am using pdfLatex as a compiler. Any idea what else could be the cause of the problem? Thanks for the help! – Kroepoek Dec 14 '17 at 8:35
  • @Kroepoek Well, in that case, it would be better if you show us your work by including a minimal working example (MWE) to your original question so we can compile it and find the actual issue you are having. – Cragfelt Dec 14 '17 at 9:46
  • @Kroepoek any news about this? – Cragfelt Dec 20 '17 at 8:27

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.