Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here is an MWE which shows that something is weird in the framed package.

\documentclass{article}
\usepackage{lipsum}
\usepackage{framed}
\setlength{\FrameSep}{3pt}
\setlength{\fboxsep}{3pt}
\begin{document}
\begin{framed}
  \noindent\lipsum[2]
\end{framed}

\noindent\fbox{%
  \begin{minipage}{1.0\linewidth}
    \lipsum[2]
  \end{minipage}
}

\end{document}

right margin discrepancy

Why does the framed environment disagree with minipage about where the right margin should be? Is there an easy way to get the two to line up?

(The framed package claims to be a "preproduction version" and its documentation is dated 2007. Could we have new maintainers maybe?)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

framed does it well. The way you use \fbox, framing over the complete linewidth, exceeds the text width. The minipage has correct width, but \fbox adds to it. This should cause a warning.

As written in the comment below, calculating the width of the minipage would solve it:

\noindent\fbox{%
  \begin{minipage}{\dimexpr\linewidth-2\fboxrule-2\fboxsep}%
    \textbackslash fbox: \lipsum[1]
  \end{minipage}%
}

For illustration, here's a screenshot without that correction, comparing normal text, framed and fboxed text:

frames example

share|improve this answer
    
So would \fbox{\begin{minipage}{\linewidth - 3pt}... work? –  Seamus Mar 5 '11 at 10:55
1  
@Seamus: It works similarly. I would calculate it: \dimexpr\linewidth-2\fboxrule-2\fboxsep. –  Stefan Kottwitz Mar 5 '11 at 11:08

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.