On Mon, 19 Mar 2007 11:56:11 -0400
"Paul A. Rubin" <[EMAIL PROTECTED]> wrote:

> Micha Feigin wrote:
> > I'm trying to set a colored background for some definitions in my document
> > (course notes and I want to get the effect of using a marker to highlight
> > some things).
> > 
> > using the package xcolor and the \colorbox{gray!30}{text} inside the
> > definition mostly achieves the desired effect, although it fails if I have
> > nested environments
> > 
> > definition: \colorbox{gray}{
> > blah balh
> > enumerate:
> > 1. text
> > 2. text
> > \end enumerate
> > }
> > \end definition
> > 
> > throws errors (this is not the actual latex ...) it says, something wrong,
> > perhaps missing \item
> 
> I think the problem is that a colorbox is the wrong kind of box (does 
> not allow enumerations inside) (maybe).
> > 
> > Is there a good way to achieve this?
> 
> You can nest a minipage or parbox inside the colorbox, but unless you 
> want the color to extend to the margin, you'll need to fiddle with the 
> width of the minipage manually.  I've attached a small example.
> 

The problem is not with the color extending to the margin but also with the
text being very badly lined up (at least with hebrew).

You suggestion finaly lead to a working solution. I also needed to add
\setlanguage commands because if the \colorbox is used in a hebrew environment,
the box shows up fine but the text doesn't show up at all.

The only problem is that lyx makes a rather serious mess with the layout

the enumeration numbers and definition text are aligned to the left while the
text is aligned to the right (hebrew - right to left text), and the minipage is
clipped off to the right of the screen

> There may be better ways to do this.  (I'm no TeXpert.)
> 
> /Paul

Attachment: newfile2.lyx
Description: application/lyx

Reply via email to