我正在尝试将一些文本放在一个框内,但我写的文本不起作用:
\fbox{The \textit{two-step} model of XMCD:
\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}
}
它不能构建和编译,我得到的最好的结果是在第一个句子周围出现一个框,然后出现一些奇怪的格式问题...TexStudio 不喜欢我将右括号放在\fbox
其他任何地方。
答案1
您可以将文本括在\parbox
first then中\fbox
,例如:
\fbox{\parbox{\textwidth}{The \textit{two-step} model of XMCD:
\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}}}
生成:
此外,不要用括号括住项目的文本[]
。
答案2
Francis 已经给出了答案使用 \parbox。Werner 对边界给出了注释。
我建议使用框架环境:
\documentclass{scrartcl}
\usepackage{framed}
\begin{document}
\section{With parbox}
\fbox{\parbox{\textwidth}{The \textit{two-step} model of XMCD:
\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}}}
\section{framed}
\begin{framed}
The \textit{two-step} model of XMCD:
\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{framed}
\end{document}
在框架环境下,你会得到更美观的外观:
除了更好的结果之外,TeX 源看起来也更标记-喜欢。
答案3
对于格式的灵活性,我建议看一下包tcolorbox
、,mdframed
甚至bclogo
,从带有尖角的简单框架到非常花哨的盒子。运行 texdoc tcolorbox
、texdoc mdframed
和texdoc bclogo
以查看很多选项。一些示例:
\documentclass{scrartcl}
\usepackage{microtype}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{tcolorbox}
\usepackage[tikz]{bclogo}
\usepackage{lipsum}
\begin{document}
\section{With tcolorbox}
\begin{tcolorbox}[
colframe=blue!25,
colback=blue!10,
coltitle=blue!20!black,
fonttitle=\bfseries,
adjusted title=The {\em two-step} model of XMCD:]
\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{tcolorbox}
\section{With mdframed}
\begin{mdframed}[
linecolor=black!40,
outerlinewidth=1pt,
roundcorner=.5em,
innertopmargin=1ex,
innerbottommargin=.5\baselineskip,
innerrightmargin=1em,
innerleftmargin=1em,
backgroundcolor=blue!10,
%userdefinedwidth=1\textwidth,
shadow=true,
shadowsize=6,
shadowcolor=black!20,
frametitle={The \textit{two-step} model of XMCD:},
frametitlebackgroundcolor=cyan!40,
frametitlerulewidth=10pt
]
\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{mdframed}
\section{With bclogo}
\renewcommand\logowidth{16pt}
\begin{bclogo}[
couleur = blue!10,
marge=20,
cadreTitre = true,
arrondi = 0.3,
epBarre=3.5,
logo = \bcnucleaire,
couleurBarre = red!80!blue!60,
ombre=true,
couleurOmbre = blue!20!black!20,
]
{The \textit{two-step} model of XMCD:}
\bigskip
\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{bclogo}
\end{document}