我正在使用以下代码借用自这里:
\documentclass{article}
\begin{document}
\fbox{\parbox{\textwidth}{The \textit{two-step} model of XMCD:
\hline
\begin{itemize}
\item In the \textit{first step}, circularly polarized X-rays generate photoelectrons with a spin and/or orbital momentum from a localized atomic inner shell.
\item In the \textit{second step}, the 3d shell serves as the detector of the spin or orbital momentum of the photoelectron. For maximum effect, the photon spin needs to be aligned with the magnetization direction.
\end{itemize}}}
\end{document}
使用 创建的第一行之后的水平线\hline
在末端不与垂直线相交。如何才能使这条水平线在末端也与垂直线相交?
答案1
有更好的方法可以完成你正在尝试的事情,但\hline
你调用的是用于tabular
环境中,而不是用于一般文本。使用这种方法,最接近的方法可能是以下内容。
正如 David 所说,由于 是\fbox
填充的,因此您必须从 中减去填充和线条的宽度\textwidth
,以获得 的大小\parbox
。然后,我使用\hrulefill
代替不正确的\hline
。但是,这也需要向左移动\fboxsep
,并在长度上增加2\fboxsep
,以填补 造成的两侧的间隙\fbox
。
\documentclass{article}
\begin{document}
\fbox{\parbox{\dimexpr\textwidth-2\fboxsep-2\fboxrule}%
{The \textit{two-step} model of XMCD:
\\[-8pt]\mbox{}\hspace{-\fboxsep}%
\makebox[\dimexpr\linewidth+2\fboxsep\relax]{\hrulefill}
\begin{itemize}
\item In the \textit{first step}, circularly polarized X-rays generate photoelectrons with a spin and/or orbital momentum from a localized atomic inner shell.
\item In the \textit{second step}, the 3d shell serves as the detector of the spin or orbital momentum of the photoelectron. For maximum effect, the photon spin needs to be aligned with the magnetization direction.
\end{itemize}}}
\end{document}
答案2
我根据该framed
包提出了两种使用简单代码的解决方案:
\documentclass{article}
\usepackage{enumitem}
\usepackage{framed}
\usepackage[svgnames]{xcolor}
\colorlet{TFFrameColor}{Gainsboro!30!Lavender}
\colorlet{TFTitleColor}{black}
\begin{document}
\noindent
\begin{titled-frame}{The \textit{two-step} model of XMCD:}
\begin{itemize}[wide=0pt, leftmargin=*]
\item In the \textit{first step}, circularly polarized X-rays generate photoelectrons with a spin and/or orbital momentum from a localized atomic inner shell.
\item In the \textit{second step}, the 3d shell serves as the detector of the spin or orbital momentum of the photoelectron. For maximum effect, the photon spin needs to be aligned with the magnetization direction.
\end{itemize}
\end{titled-frame}
\begin{framed}
The \textit{two-step} model of XMCD:\\
\hspace*{-1.25\FrameSep} \rule{\dimexpr\textwidth + 2\FrameSep}{0.4pt}
\begin{itemize}[wide=0pt, leftmargin=*]
\item In the \textit{first step}, circularly polarized X-rays generate photoelectrons with a spin and/or orbital momentum from a localized atomic inner shell.
\item In the \textit{second step}, the 3d shell serves as the detector of the spin or orbital momentum of the photoelectron. For maximum effect, the photon spin needs to be aligned with the magnetization direction.
\end{itemize}
\end{framed}
\end{document}