
図の内側を折り返したいのですlisting
が、そうするとキャプションの間にたくさんの空白ができてしまいます。図の内側を折り返すときに、図のキャプションの余分な空白を削除するにはどうすればよいでしょうか?
次のコードがあります。起源:
\expandafter\def\csname [email protected]\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}
こんにちは。
function hello() public returns (bool) {
uint256 amount = 100
return amount * 100
return true;
}
出力:
ここでは、キャプションのフォントが小さく、キャプションの上部と下部に十分な空白が生成されていることがわかります。これらを削除することは可能ですか?
内部にキャプションがある場合、それを置き換えることlisting
ができれば、私の場合はうまくいきます。Listing
Figure
答え1
MWE は外部ファイルに依存しないでください。可能であれば、コピーして貼り付けることができるスタンドアロン コードを提供してください。
listings
ただし、図に頼るのではなく、のキャプション機能を使用するという解決策もあります。figure
環境と\caption
コマンドを削除して、次のようにします。
\lstinputlisting[caption={hello world.}, captionpos=b, frame=tlrb, rulecolor=\color{black}]{hello.sol}