I want to wrap listing inside a figure. But when I do that there is plent white space in between its caption. How can I remove extra white space of Figure's caption when listing wrap inside a figure?
I have following code, origin:
\expandafter\def\csname ver@fixltx2e.sty\endcsname{}
\documentclass[10pt,journal,compsoc]{IEEEtran}
\PassOptionsToPackage{table}{xcolor}
\ifCLASSOPTIONcompsoc\usepackage[nocompress]{cite}
\else
\usepackage{cite}
\fi
\ifCLASSINFOpdf\else\fi
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage[english]{babel}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{listings, xcolor}
\begin{document}
\section{Introduction}
hello world hello world hello world hello world
\begin{figure}[htp]
\lstinputlisting[frame=tlrb, rulecolor=\color{black}]{hello.sol}
\caption{hello world.}
\end{figure}
hello world hello world hello world hello world
\end{document}
hello.sol:
function hello() public returns (bool) {
uint256 amount = 100
return amount * 100
return true;
}
output:
Here you can see that font of the caption is smaller and there is plenty white space generated on top and bottom of the caption. Is it possible to remove those?
When I have caption inside listing if I can replace Listing with Figure it works for me as well.

figureat all, what about cross referencing - Label and caption without float - TeX - LaTeX Stack Exchange ? – user202729 May 08 '22 at 11:01Listingtag withFiguretag? I am not sure would it be ok to refere it as Figure though – alper May 08 '22 at 11:17