![如何删除框架图形标题和文本后的空格?](https://linux22.com/image/380893/%E5%A6%82%E4%BD%95%E5%88%A0%E9%99%A4%E6%A1%86%E6%9E%B6%E5%9B%BE%E5%BD%A2%E6%A0%87%E9%A2%98%E5%92%8C%E6%96%87%E6%9C%AC%E5%90%8E%E7%9A%84%E7%A9%BA%E6%A0%BC%EF%BC%9F.png)
我有以下代码:
\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}