我想将这个框放在描述列表旁边。它应该不是影响列表本身。我使用 mbox,并且 mbox 内有一个高度为 0 的 vbox。但是,它仍然会将文本向下推。我该如何防止这种情况?
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{description}[style=multiline,leftmargin=3cm]
\item[Item 1]
\mbox{%
\vbox to 0cm{\hbox to 10cm{\hfill \fbox{OK}}}
}
\begin{minipage}{8cm}
Here is information. This is a multiline description. We will copy
these lines a few times. Here is information. This is a multiline description.
We will copy these lines a few times. Here is information. This is a multiline
description. We will copy these lines a few times. Here is information.
\end{minipage}
\item[Item 2]
\mbox{%
\vbox to 0cm{\hbox to 10cm{\hfill \fbox{Fail}}}
}
\begin{minipage}{8cm}
Here is information. This is a multiline description. We will copy
these lines a few times. Here is information. This is a multiline description.
We will copy these lines a few times. Here is information. This is a multiline
description. We will copy these lines a few times. Here is information. This is
a multiline description.
\end{minipage}
\item[Another item here]
\mbox{%
\vbox to 0cm{\hbox to 10cm{\hfill \fbox{OK}}}
}
\begin{minipage}{8cm}
Here is information. This is a multiline description. We will copy
these lines a few times. Here is information. This is a multiline description.
We will copy these lines a few times. Here is information. This is a multiline
description. We will copy these lines a few times. Here is information. This is
a multiline description. We will copy these lines a few times.Here is
information. This is a multiline description. We will copy these lines a few
time.
\end{minipage}
\end{description}
\end{document}
我希望第一行与描述标签出现在同一行:
知道应该改变什么吗?
答案1
排版\vbox
高度为零,但它位于小页面之上,并且其参考点位于基线。
您可以在以下内容中添加信息minipage
:
\documentclass{article}
\usepackage{enumitem}
\newcommand{\OF}[1]{%
\makebox[0pt][l]{\hspace{10cm}\fbox{#1}}%
\ignorespaces
}
\begin{document}
\begin{description}[style=multiline,leftmargin=3cm]
\item[Item 1]
\begin{minipage}[t]{8cm}\OF{OK}
Here is information. This is a multiline description. We will copy
these lines a few times. Here is information. This is a multiline description.
We will copy these lines a few times. Here is information. This is a multiline
description. We will copy these lines a few times. Here is information.
\end{minipage}
\item[Item 2]
\begin{minipage}[t]{8cm}\OF{FAIL}
Here is information. This is a multiline description. We will copy
these lines a few times. Here is information. This is a multiline description.
We will copy these lines a few times. Here is information. This is a multiline
description. We will copy these lines a few times. Here is information. This is
a multiline description.
\end{minipage}
\item[Another item here]
\begin{minipage}[t]{8cm}\OF{OK}
Here is information. This is a multiline description. We will copy
these lines a few times. Here is information. This is a multiline description.
We will copy these lines a few times. Here is information. This is a multiline
description. We will copy these lines a few times. Here is information. This is
a multiline description. We will copy these lines a few times.Here is
information. This is a multiline description. We will copy these lines a few
time.
\end{minipage}
\end{description}
\end{document}
如果你想使用更大的标签,你可以使用
\newcommand{\OF}[1]{%
\makebox[0pt][l]{%
\hspace{10cm}%
\raisebox{\dimexpr\fontcharht\font`T+\fboxsep+\fboxrule-\height}[0pt][0pt]{%
\fbox{\vphantom{A}#1}%
}%
}%
\ignorespaces
}
\OF{\Huge OK}
标签将会随之向下移动。