如何在双框 parbox 内插入边距?

如何在双框 parbox 内插入边距?

我只是想在我的 parbox 里面插入一点空间,但是下面的内容会弄乱框架:

\documentclass{article}

\begin{document}
\begin{center}
    \fbox{
        \setlength\fboxsep{1cm}
        \fbox{
            \parbox{0.80\textwidth}{
                \textbf{Rules :}
                \vskip 1em%
                \begin{itemize}
                    \item 1st rule: You do not talk about Fight Club.
                    \item 2nd rule: You do not talk about Fight Club.
                    \item 3rd rule: If someone yells "Stop!", ...
                    \item 4th rule: Only two guys to a fight.
                \end{itemize}
            }
        }
    }
\end{center}
\end{document}

在此处输入图片描述

我尝试过使用mdframed但是双框架不是那么简单。

答案1

与许多类似问题一样,问题在于在行尾处引入了杂散空格。补救措施是%在行尾后添加一个来删除杂散空格。

\documentclass{article}

\begin{document}
\begin{center}
    \fbox{%
        \setlength\fboxsep{1cm}%
        \fbox{%
            \parbox{0.80\textwidth}{%
                \textbf{Rules :}
                \vskip 1em%
                \begin{itemize}
                    \item 1st rule: You do not talk about Fight Club.
                    \item 2nd rule: You do not talk about Fight Club.
                    \item 3rd rule: If someone yells "Stop!", ...
                    \item 4th rule: Only two guys to a fight.
                \end{itemize}
            }%
        }%
    }%
\end{center}
\end{document}

在此处输入图片描述

答案2

另一种选择是tcolorbox

\documentclass{article}

\usepackage[most]{tcolorbox}

\begin{document}


\begin{tcolorbox}[enhanced, sharp corners, center, 
    valign=center, colback=white, boxsep=8mm,
     borderline={.5mm}{3mm}{black},
     width=.85\linewidth,
    ]
                \textbf{Rules:}
                \vskip 1em%
                \begin{itemize}
                    \item 1st rule: You do not talk about Fight Club.
                    \item 2nd rule: You do not talk about Fight Club.
                    \item 3rd rule: If someone yells "Stop!", ...
                    \item 4th rule: Only two guys to a fight.
                \end{itemize}
\end{tcolorbox}
\end{document}

在此处输入图片描述

相关内容