0

I have the following but the image does not show up for some reason.

\begin{figure}[htbp]
{
    \centering
    \includegraphics[scale=0.5]{figures/stats_count.png}
    \caption{The number of sentences from each category}
    \label{fig:sent_diagram}
}
\end{figure}

I am using following packages:

\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,total={6in, 9.5in}]{geometry}
\usepackage{multicol}
\usepackage{indentfirst}
\graphicspath{ {Figuras/} }
\usepackage{sectsty}
\usepackage{tocloft}
\usepackage{placeins}
\usepackage{hyperref}
\usepackage{url}
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{caption}
\usepackage{color}
\usepackage{algorithmicx}
\usepackage{algcompatible}
\usepackage{adjustbox}
\usepackage{listings}
\usepackage{courier}

1 Answer 1

0

Turns out the problem was caused by multicol package. Did these to fix:

\newenvironment{Figure}
  {\par\medskip\noindent\minipage{\linewidth}}
  {\endminipage\par\medskip}

Then just replaced "figure" with "Figure":

\begin{Figure}
    \centering
    \includegraphics[scale=0.5]{figures/stats_count.png}
    \captionof{figure}{The number of sentences from each category}
    \label{fig:sent_diagram}
\end{Figure}

EDIT

The better solution is to use twocolumn option instead of multicol package:

\documentclass[twocolumn]{article}
2
  • The problem is that a minipage with spaces is a poor substitute of a true float. For the usual two-columns only documents, the right fix is not multicol with a custom Figure environment and \captionof that need another package, but just twocolumn option in the first line. Reserve multicol and their drawbacks only for more complex layouts. BTW, if you want the images sizes fitting consistently in surrounding text, use some like width=0.8\linewidth instead of scale=0.5.
    – Fran
    Apr 25, 2021 at 23:59
  • Yes you are right. I ended up implementing that method, however, the one posted does the job as well. Apr 27, 2021 at 0:57

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.