Reputation: 47
Does anybody know how to set up commands for displaying pictures in Overleaf? I was searching everywhere but I found nothing. This is what I'm currently using:
\graphicspath{ {images/} }
\usepackage{graphicx}
\FloatBarrier
\begin{figure}[H]
\centering
\includegraphics[width=\textwidth]{imgname}
\caption{Caption text}
\end{figure}
\label{fig:}
\FloatBarrier
It is displaying a white rectangle with the image name in it:
Can anyone help me?
Upvotes: 2
Views: 14086
Reputation: 99
It may be due to a long name of figure in the Overleaf environment. For example, naming a figure with "Blockchain - Smart Home (Authentication) flowchart update.pdf" was a long term issue until it was renamed as "b1.pdf" and updated accordingly in the editor before displaying the image properly; hence, resolving the issue. There is no specific Uniform Resource Locator/link as it was a practical experience as seen in LaTeX (the figures attached showed when the names were "too long" and "optimized" respectively
Upvotes: -1
Reputation: 470
The initial setting you should verify is whether the compiler is in Normal mode rather than Fast (draft) mode. You can find this setting in the drop-down menu under the Recompile button. The Fast (draft) mode is designed to expedite compilation by skipping certain steps, but it may not display included images as a result.
Upvotes: 0
Reputation: 1
The error lies in not specifying the [final] option in the graphicx package (the [draft] option will give the same error as well). This option does not allow overleaf to load the image properly, to fix the problem you should put the option [final] in the graphicx package, so the line should look like this:
\RequirePackage[final]{graphicx}
Greetings.
Upvotes: -1
Reputation: 1
Was figuring this one out for an hour now. I didn't notice there were instructions in the template I was using in Overleaf. It worked when I commented them out.
If you wish to display your graphics for your own use using includegraphic or includegraphics, then comment out the following two lines of code. NB: These line must be included when submitting to BMC. All figure files must be submitted as separate graphics through the BMC submission process, not included in the submitted article.
%\def\includegraphic{}
%\def\includegraphics{}
Upvotes: -1
Reputation: 1
I had the same problem and I found a solution by removing "babel" package.
Upvotes: -2
Reputation: 111
If you are using overleaf , then go to the compile button and select Normal instead of fast(draft) from the dropdown menu. The image will appear allright then. Here is a link to the solution : https://www.overleaf.com/learn/how-to/Images_not_showing_up
Upvotes: 11
Reputation: 15095
The following minimal example replicates your behaviour:
\documentclass{article}
\usepackage[draft]{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[width = .5\linewidth]{example-image}
\caption{A figure}
\end{figure}
\end{document}
Note that the option draft
has been passed to graphicx
. It may also be the case that you \usepackage{graphicx}
without the draft
option, but that you have
\documentclass[...,draft,...]{<class>}
Identify where you have draft
passed to the class/package and then remove it.
Upvotes: 3