如何删除框架图形标题和文本后的空格?

如何删除框架图形标题和文本后的空格?

我有以下代码:

\documentclass[10pt,journal,compsoc]{IEEEtran}
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{graphics}
\usepackage{mdframed}
\usepackage{tikz}
\usepackage{subfigure}
\usepackage{float}
\restylefloat{table}
\usepackage{enumitem,kantlipsum}
\usepackage{framed}
\usepackage{wrapfig}

\begin{document}
\title{hi}
\maketitle
\IEEEdisplaynontitleabstractindextext
\IEEEpeerreviewmaketitle
\IEEEraisesectionheading{\section{Introduction}\label{sec:introduction}}

Blockchain
% Here first framed box fills complete first column.
\begin{framed}
 \scriptsize 
 Hello World. \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\  \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\  \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
 \end{framed} 

% On the second framed box on top right column there is additional space shows up.
\begin{figure}[htbp]
\begin{framed}
 \scriptsize 
 Hello World.
 \end{framed} 
 \vspace*{-5.0mm}
 \caption{Caption.} 
\end{figure}

Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\end{document}

我得到的输出是:

在此处输入图片描述

您可以在标题后看到额外的换行符。我想减少框架图形标题后面的空间,可以吗?请注意,我想将框架框视为图形。我希望得到的输出如下:

在此处输入图片描述

[问]如何删除框架图形标题和文本后的空格?

答案1

像这样?

\documentclass[10pt,journal,compsoc]{IEEEtran}

\usepackage{framed}

\begin{document}
\setlength{\abovecaptionskip}{0ex}
\begin{figure}[htbp]
\centering
\setlength{\OuterFrameSep}{0pt}
 \begin{framed}
 \scriptsize \bfseries
   \begin{verbatim}
    % Hello World.
   \end{verbatim}
 \end{framed}
  \caption{Caption.} \label{fig:sig}
\end{figure}
\vspace{-1ex}

Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

\end{document} 

在此处输入图片描述

对于第二个代码,方法相同:设置\OuterFrameSep为 0,\abovecaptionskip设置为比默认值更小的值,并插入负垂直空间标题:

\documentclass[10pt, journal, compsoc]{IEEEtran}
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{graphics}
\usepackage{mdframed}
\usepackage{tikz}
\usepackage{subfigure}
\usepackage{float}
\restylefloat{table}
\usepackage{enumitem,kantlipsum}
\usepackage{framed}
\usepackage{wrapfig}

\begin{document}
\title{hi}
\maketitle
\IEEEdisplaynontitleabstractindextext
\IEEEpeerreviewmaketitle
\IEEEraisesectionheading{\section{Introduction}\label{sec:introduction}}

Blockchain
% Here first framed box fills complete first column.
\begin{framed}
 \scriptsize
 Hello World. \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
 \end{framed}

% On the second framed box on top right column there is additional space shows up.
\begin{figure}[htbp]
    \setlength{\OuterFrameSep}{0pt}
    \setlength{\abovecaptionskip}{0pt}
\begin{framed}
 \scriptsize
 Hello World.
 \end{framed}
 \caption{Caption.}
\vspace*{-3ex}
\end{figure}
Some text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

\end{document} 

在此处输入图片描述

相关内容