3

I am using framed package to draw a box around some texts. When I compile it without wrapping it up in the figure command I have no problem. However, when I use it like this:

\documentclass[a4paper,12pt]{report}
\usepackage{setspace} % for switching between double/single space in document‎
\usepackage{framed}‎‎
\usepackage[top=3cm,right=3cm,bottom=2.5cm,left=2.5cm]{geometry}‎

\doublespacing‎‎

\begin{document}‎
this is a line

this is a line

\begin{figure}‎
\begin{framed}
this is a line

this is another line
\end{‎framed}‎‎
\caption[figure1]‎{description for figure1}‎‎‎
\label{Fig_1}‎‎ %for Lockstep point!see the comments!  
\end{figure}

\end{document}‎

the linespacing reverts to default (see the attached image). Am I missing something?
BTW, I have seen Post1 and Post2, still no clue. If it is important why I used framed, I must mention that when using double spacing, the text spans more than 1 page and framed does a nice job.

alt text

  • Please post a complete but minimal example. – Axel Sommerfeldt Jan 2 '11 at 14:06
  • I have just edited the code. – Yasser Sobhdel Jan 2 '11 at 14:22
  • The \label command should be placed after the \caption command. – lockstep Jan 2 '11 at 14:26
  • Why? I don't get the point. What is the difference? But I just edited it and added a comment! – Yasser Sobhdel Jan 2 '11 at 14:43
  • 2
    The \label command will refer to the last command that stepped a "referable" counter (e.g., \section or \caption). To observe this in your code example, add two sections before the figure and \ref{Fig_1} after the figure. A \label before \caption will actually refer to the second section, not to the figure. – lockstep Jan 2 '11 at 15:00
7

The setspace package patches floating environments, footnotes etc. to be single-spaced. Unfortunately there is no package option to suppress that, so if you don't like your float single-spaced as default, insert the following code immediately after loading of the setspace package:

\usepackage[...]{setspace}
\makeatletter
\let\@xfloat=\latex@xfloat % revert setspace patch of floating environments
\makeatother

But please note that this will increase the vertical distance between figure body and figure caption, too. (And make the captions double-spaced as well.) If you don't like this, forget about the code above and better use \doublespacing inside your framed environments.

  • 1
    I just added the \doublespacing in the first line of code after \begin{framed} and that did the job. Thanks – Yasser Sobhdel Jan 2 '11 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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