Laurent Duperval wrote:

I want to create a paragraph (or two) that have a different background
color. I also want them to be framed. How do I do that?


The following works in LyX 1.5.x; not sure about 1.4.x.

1.  Add "\usepackage{xcolor}" to the preamble.

2. Select your paragraphs and then Insert -> Box to put them in a minipage.

3. Right-click the "handle" of the minipage and adjust the settings. You want minipage for the box type, and no frame decoration (it's coming later). You'll probably want to adjust the box width to conform to the surrounding margins.

4. If the left side of the box is not where you want it, put the cursor just before the box handle and use the paragraph settings button to toggle indent on or off (whichever you need).

5. If you are indenting paragraphs, insert the following in ERT as the first bit of the box content: "\setlength{\parindent}{3ex}". (Adjust the indentation amount to taste.) LaTeX apparently zeros out the paragraph indentation inside a minipage.

6. Place the following in ERT just before the box: "\fcolorbox{black}{cyan}{". The first color is the frame color, the second is the background color (again, adjust to taste). Put "}" in ERT just after the box.

The box will be treated as an indivisible block (if any of it trails over to the next page, the whole box will move).

HTH,
Paul

Reply via email to