0

I'm very new to Latex and this is my first document in it. Can someone please guide as to how I can bring the figure under my Results heading. I've tried implementing [H] and \userpackage{float} as well but nothing seems to be working


\documentclass[conference,12pt]{IEEEtran}
\usepackage{blindtext, graphicx}
\usepackage{listings}
\lstset { %
    language=C++,
    numbers=left,
    breaklines=true,
    xleftmargin=4em,
    resetmargins=true,
    basicstyle=\footnotesize,
    numberstyle=\footnotesize,
}
\usepackage{graphicx}
\usepackage[font=small]{caption}
\usepackage[utf8]{inputenc}
\begin{document}
\section{Results}
Text

\begin{figure} \centering \includegraphics[width=8.5cm]{Picture1.png} \caption{Comparing Results of Logistic Regression with two different Feature Extraction Methods } \label{fig:} \end{figure}

\addtolength{\textheight}{-12cm} \end{document}

  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for the users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – samcarter_is_at_topanswers.xyz Jan 02 '23 at 17:26
  • (why not create this table in latex instead of including it as png? This way your readers could search or copy text from it and the file size of your article would also be smaller) – samcarter_is_at_topanswers.xyz Jan 02 '23 at 17:27
  • 4
    I would look at the second highest voted answer there, which begins "do not use a floating environment if you do not want it float." (I second samcarter's suggestion to use a table, but the {table} environment will still have the same floating aspect.) – Teepeemm Jan 02 '23 at 17:29
  • thankyou for the response everyone, I'll try them out. And yes my code is compatible. – Maryam Faheem Jan 02 '23 at 17:29
  • 1
    samcarter meant make the code compilable for us. At the moment, we can't copy and paste what you've shown, because we don't have the image and don't have the surrounding text and preamble. – Teepeemm Jan 02 '23 at 17:30
  • oh ok let me edit it – Maryam Faheem Jan 02 '23 at 17:31
  • I've edited the code, could you take a look at it – Maryam Faheem Jan 02 '23 at 17:34
  • @MaryamFaheem With your updated code, a simple \begin{figure}[htbp] places the figure in the results section. However from the picture of your real document, I suspect there is not enough space left at the bottom of the page to place the figure there. – samcarter_is_at_topanswers.xyz Jan 02 '23 at 17:36
  • @samcarter_is_at_topanswers.xyz I've already tried that and it doesnt work – Maryam Faheem Jan 02 '23 at 17:38
  • That's why it would be helpful to have a minimal working example which reproduces your problem. – samcarter_is_at_topanswers.xyz Jan 02 '23 at 17:40
  • Is there any solution to this ? – Maryam Faheem Jan 02 '23 at 17:41
  • 1
    Your code only has "Text" for text. It doesn't have the 5+ paragraphs of text that are in your image. We can't easily discern out why the figure is moving without that text (I'm not even sure where you want the figure.) – Teepeemm Jan 02 '23 at 17:42
  • Just judging from the screenshot: placing your figure in the results section would either leave the page slightly too short or make it too long and it will be difficult to position the next section heading – samcarter_is_at_topanswers.xyz Jan 02 '23 at 17:42
  • 2
    Two possible solutions: accept that latex floats to image to a better position or don't use a floating environment like the figure environment. – samcarter_is_at_topanswers.xyz Jan 02 '23 at 17:43
  • @Teepeemm the figure needs to be under the Results section. I can update the paragraphs under the result – Maryam Faheem Jan 02 '23 at 17:44
  • @samcarter_is_at_topanswers.xyz will it work if I insert a table in latex? – Maryam Faheem Jan 02 '23 at 17:45
  • Assuming the latex table has the same size you'll have the exact same problem to place it. However there is potential to make it less tall, maybe(!) the outcome could be different. The main advantage of using a table will be searchability, copy+pasting and accessibility for people using screen readers or similar assistive technology. – samcarter_is_at_topanswers.xyz Jan 02 '23 at 17:46
  • 1
    instead of the figure, use table in latex as it can be more understandable, as samcarter suggested. and also, we cannot give a solution until we can exactly recreate your issue – afaq Jan 02 '23 at 18:19
  • Thankyou everyone, I did end up finding a solution to it by managing my paragraphs. – Maryam Faheem Jan 02 '23 at 18:55

0 Answers0