此代码
\documentclass[]{scrbook}
\usepackage{mdframed} %
\usepackage{boxedminipage}
\begin{document}
\noindent
\begin{boxedminipage}{1.0\textwidth}
Box of 100 \% width
\end{boxedminipage}
\begin{mdframed}[
linecolor=black,%
leftmargin =-1cm,
rightmargin=+1cm,
]
Sample Text to fill the line. Sample Text to fill the line.
Sample Text to fill the line. Sample Text to fill the line.
Sample Text to fill the line. Sample Text to fill the line.
\end{mdframed}
\end{document}
左侧或右侧不显示任何边距。
是我做错了什么,还是这个包里有错误?
mdframed 的版本是2012/01/09 v1.2a
答案1
这不是一个错误。您正在使用具有默认设置的 documentclass twoside
。mdframed
检测到工作twoside
模式。
在这种情况下,你有两种可能性。
使用选项
usetwoside=false
。然后您可以使用leftmargin
/rightmargin
。但这些边距在奇数页和偶数页上将相等。使用选项
innermargin
/outermargin
来影响行为。
以下是一个例子:
\documentclass[]{scrbook}
\usepackage{showframe}
\usepackage{mdframed} %
\usepackage{boxedminipage}
\begin{document}
\noindent
\begin{boxedminipage}{1.0\textwidth}
Box of 100 \% width
\end{boxedminipage}
\begin{mdframed}[
linecolor=black,%
leftmargin =-1cm,
rightmargin=+1cm,
usetwoside=false,
]
Sample Text to fill the line. Sample Text to fill the line.
Sample Text to fill the line. Sample Text to fill the line.
Sample Text to fill the line. Sample Text to fill the line.
\end{mdframed}
\begin{mdframed}[
linecolor=black,%
innermargin =-1cm,
outermargin =+1cm,
]
Sample Text to fill the line. Sample Text to fill the line.
Sample Text to fill the line. Sample Text to fill the line.
Sample Text to fill the line. Sample Text to fill the line.
\end{mdframed}
\end{document}