> How can I put a box around several paragraphs? > > I tried \parbox and \begin{minpage} according to the books, but why > not box lines show up? What should I do?
They don't give box lines. A "box" in that context is an object that holds its contents together in one piece; makes it behave like a single character, according to the LaTeX manual.
What you seek is a "frame". Thus \fbox{} or \framebox{}. To frame a paragraph, you need to put \fbox{parbox{}{ }}. You probably also want a larger setting of \fboxsep.
> \begin{center}\begin{figure}[!ht]\begin{center} > \parbox{5in}{\begin{flushleft} > Given query instance $x_q$, \newline > first locate nearest training example $x_n$, \newline > then estimate $\hat{f}(x_q) \equiv f(x_n)$. > \caption{Nearest Neighbor Algorithm} > \end{flushleft}}\end{center} > \end{figure}\end{center}
Get rid of the outermost center environment; it introduces space outside of the figure.
You may also want to look up the simple sty file boxedminipage.sty.
Finally, for this algorithmic example, which is not a natural paragraph, I think it would work better as a tabular, which can also provide the frame:
\begin{figure}[!ht] \centering % no extra space that {center} would give
\begin{tabular}{|l|}\hline Given query instance $x_q$, \\ first locate nearest training example $x_n$, \\ then estimate $\hat{f}(x_q) \equiv f(x_n)$. \\ \hline \end{tabular}
\caption{Nearest Neighbor Algorithm}
\end{figure}
Donald Arseneau