![框架和边距](https://linux22.com/image/323496/%E6%A1%86%E6%9E%B6%E5%92%8C%E8%BE%B9%E8%B7%9D.png)
我有 2 个小页面,其中第二个是\frameboxed
。
正如您所见,该\framebox
命令似乎将小页面推到了右边距。
[这与上一个问题不同: 框架和 fbox/minipage 之间的右边距差异。虽然它可能有相关的答案,但这不是同一个问题。我对命令\fbox
或framed
包不感兴趣。]
我该如何防止\framebox
以这种方式超出右边距?这会对我的 RTL 文档造成严重破坏!
MWE 在这里:
\documentclass{article}
\begin{document}
\begin{minipage}{\textwidth}
word word word word word word word word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
\end{minipage}%
\bigskip
\framebox{
\begin{minipage}{\textwidth}
word word word word word word word word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
\end{minipage}%
}
\end{document}
答案1
这有意义吗?
\documentclass{article}
\usepackage{showframe}
\begin{document}
\noindent
\begin{minipage}{\textwidth}
word word word word word word word word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
\end{minipage}%
\bigskip
\noindent
\framebox{%
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}
word word word word word word word word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
\end{minipage}%
}
\end{document}
如您所见,盒子没有突出到右边距。我添加了包装showframe
以更好地显示边缘。应该注意的是,这种方法与这个问题。
答案2
@AboAmmar 提出的解决方案效果很好,但我建议使用framed
允许在框架内分页的环境,但minipage
不允许:
\documentclass{article}
\usepackage{geometry}
\usepackage{framed}
\usepackage{lipsum}
\begin{document}
\vspace*{12cm}
\noindent\begin{minipage}{\textwidth}
word word word word word word word word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
\end{minipage}%
\bigskip
\noindent\framebox{\noindent
\begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep\relax}
word word word word word word word word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
\end{minipage}%
}
\bigskip
\setlength\FrameSep{\fboxsep}
\begin{framed}\noindent
word word word word word word word word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
\lipsum[1]
\end{framed}
\end{document}