TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This code

\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}

does not show any margin on the left or right side.

Am I doing something wrong, or is this a bug in the package ?

Version of mdframed is 2012/01/09 v1.2a

enter image description here

share|improve this question
    
It seems to be a bug. – egreg Jan 14 '12 at 9:57
    
@egreg: I'm glad that it isn't bug. – Marco Daniel Jan 14 '12 at 11:02
    
@MarcoDaniel I'm glad too. :) – egreg Jan 14 '12 at 11:15
    
@MatthiasPospiech: Was the answer helpful? – Marco Daniel Jan 14 '12 at 20:47
    
@MarcoDaniel: Yes. I was just surprised, that my code worked a few month ago. – Matthias Pospiech Jan 15 '12 at 12:41
up vote 9 down vote accepted

It isn't a bug. You are using a documentclass with the default setting twoside. mdframed detects the working in twoside mode.

In this case you have two possibilities.

  1. Use the option usetwoside=false. You can then work with leftmargin/rightmargin. But these margins will be equal on odd and even pages.

  2. Use the options innermargin/outermargin to influence the behavior.

Here's an example:

\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}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.