# Boxes in LaTeX not proper

\setlength\fboxrule{2pt}\setlength\fboxsep{2mm} \fbox{ Let $f:[0,1] \to \mathbb{R}$ be a continuous function. If $f$ is infinitely differentiable, \ then prove that $f$ coincides with a polynomial.}

When i use this command, boxes are being created but the text is not aligning properly, means the text doesn't take the next line automatically it continues in some erratic manner. I hope someone is able to understand what i want to say.

-
You'd be best off creating a minimal example. What's needed is a complete .tex file which both manifests the problem and includes nothing not required to make the problem occur. –  vanden Sep 16 '10 at 16:20
Why do you have the \  after the comma? That's going to put two spaces, the first one of which will be slightly larger because it comes after the comma, the second will be a normal intrasentence space. As a side note, your mathematical statement is incorrect. –  TH. Sep 17 '10 at 1:53
Why did you use a blockquote (> ) instead of a code block (indent with four spaces by selecting code and clicking the toolbar button consisting of 1s and 0s)? –  SamB Dec 27 '10 at 22:37
Also \colon not :. The usual : has the wrong spacing for function definitions (but correct spacing for e.g. $\{ x : x > 0 \}$. –  jmc Feb 4 at 14:40

What you describe isn't improper; it's normal behavior for \fbox, which does not put its text in paragraph mode.

You either need to use a parbox inside the fbox, as so:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent\setlength\fboxrule{2pt}\setlength\fboxsep{2mm}%
\newlength{\boxwidth}%
\setlength{\boxwidth}{\textwidth}%
\fbox{\parbox{\boxwidth}{Let $f:[0,1] \to \mathbb{R}$ be a continuous function. If $f$ is infinitely differentiable, \ then prove that $f$ coincides with a polynomial.}}
\end{document}


Or better, yet use the framed package and its namesake environment.

\documentclass{article}
\usepackage{amsmath,framed}
\begin{document}
\setlength{\FrameRule}{2pt}
\setlength{\FrameSep}{2mm}
\begin{framed}
\noindent Let $f:[0,1] \to \mathbb{R}$ be a continuous function. If $f$ is infinitely differentiable, \ then prove that $f$ coincides with a polynomial.}
\end{framed}
\end{document}

-