0
votes

I’ve been trying for the days now to format attractive code listings in lyx for an Erlang programming book that I’m working on.

The tcolorbox package looks like it should do the trick, but frustrates me at every turn,

Requirements:

  • Shaded Box with rounded corners, white header text on black, black outline, black on white body text

  • Head centered and of the form “Listing CN.LN comment” where CN is chapter number and LN is listing number and comment is in italics.

I can do this with a LaTeX macro, but can’t make it work in the head of a shaded box.

  • Code listing in the body must be mono space font with bold face highlighting.

I’ve read the tcolorbox manual, but still don’t understand how it works in lyx.

Can some kind souls please help dispel my ignorance?

LRP

1

1 Answers

0
votes

I'm not sure about all the details of your requirements (could you post the LaTeX that works?) Try the following to get you started (I'm using LyX 2.2.x):

  • Document > Settings > Modules > Fancy Colored Boxes > Add > Apply
  • Insert > Custom Insets > Color Box
  • Inside the Color Box inset, you can find Color Box Options (right-click, or ALT-A 1 in Windows). Those options look similar to the syntax of tcolorbox, e.g.:

    title=An enhanced box with a color gradient, enhanced, frame style={left color=red!75!black, right color=blue!75!black}, interior style={left color=red!20!white, right color=yellow!50!white}
    

Finally, there's an Example (in the LyX Resources/Examples folder) called colored-boxes.lyx that has a lot of info.