On Tuesday 02 October 2001 14:28, Robin Turner wrote:
> On Tuesday 02 October 2001 13:42, Myriam Abramson wrote:
> > Hi!
> >
> > I'm trying to put a box around a description (describing an
> > algorithm with keywords) but I get errors even in the tex file!
>
> \fbox is fragile, if I remember rightly.  You can get out of this by using
> a minipage.  Put something like this in your preamble:
>
[cut]

On closer inspection ... the problem is that LaTeX is reading the closing 
brace of your fbox command as an item in the description environment.

I got round this eventually with the solution I mentioned before (i.e. create 
your own boxed minipage environment) but still can't get it to work with 
plain fbox.  See attached LaTeX file for the workable version.

Robin
%% LyX 1.2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{babel}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 \newenvironment{myBox}{%
   \vspace{4mm}
   \noindent%
   \begin{lrbox}{\@tempboxa}%
   \begin{minipage}[c]{0.5\columnwidth}%
 }{%
   \end{minipage}%
   \end{lrbox}%
    \centering
   \fbox{\parbox{0.5\columnwidth}{\usebox{\@tempboxa}}}\\%
   \vspace{4mm}
   }%

\makeatother
\begin{document}
\begin{myBox} boxing test algorithm

\begin{description}
\item [push]x on stock
\item [while](stack)\\
y $\leftarrow $ pop stack

\begin{description}
\item [Foreach]neighboring i\\
i$_{s} $ $\leftarrow $ $\frac{1}{8}\sum _{j} weight_{j} $ where $j$ is a neighbor of 
$s$\\
if $\Delta weight$ > $\epsilon $\\
push $s$ in stack
\end{description}
\end{description}
\end{myBox}
\end{document}

Reply via email to