On Sun, Feb 25, 2018 at 12:49:47AM +0000, Paul A. Rubin wrote:
> On 02/24/2018 02:40 PM, ll...@writersglen.com wrote:
> > 
> > Hello,
> > 
> > I've been struggling to format attractive code listings. The boxes in
> > the attached mini-lyx document show my feeble attempts so far.
> > 
> > Box 2 is close to what I want, but has numerous problems:
> > 
> > 1. Rather than red and white, I'd want black and light gray
> > 
> > 2. I'd like width to be full width of text area of my page
> > 
> > 3. I'd to use \listno\ in header, but get this error message when I try:
> > 
> > File ended while scanning use of \codelist.
> > 
> > <*> listno.tex
> > 
> > *** (job aborted, no legal \end found)
> > 
> > 4. If I try to add a second code listing I get error messages or a
> > broken box depending upon how I try to terminate the first list
> > specification
> > 
> > 5. I'd like to use a monospace font in the code area that has both
> > normal and bold face
> > 
> > Most of all, I'd like to understand how to gain programming control over
> > the appearance of my code list boxes. I've been studying the tcolorbox
> > manual. But when I try to change parameters in the lyx preamble nothing
> > seems to change. So I'm guessing there's a lyx issue I'm ignorant of.
> > 
> > I'd much appreciate any and all tips to help solve these issues.
> > 
> > Many thanks,
> > 
> > Lloyd R. Prentice
> > 
> [I screwed up and replied privately rather than to the list, so I'm
> repeating the reply here.]
> 
> Lloyd,
> 
> There are a couple of problems with your MWE. One is that it won't compile
> due to a typo. In the TeX box after "More code", you have a left parenthesis
> where you need a left brace. The other is that you seem to be using a
> nonstandard document class. It's a good idea to keep MWEs as vanilla as
> possible.
> 
> To make the background for the text in your code box more gray, ratchet up
> the "5" in colback settings. Right now you have gray!5!white, which is a mix
> of 5% gray and 95% white. Try something like 25 rather than 5.
> 
> I believe the specification red!1175!black for the colframe parameter is
> illegal; the xcolor package wants numbers between 0 and 100. Since I'm not
> sure what you're going for here, I can't make a useful suggestion, other
> than to say the closer you get to 0 (100) the more red (black) you get in
> the mix.
> 
> If you want the box header to have a pure black background, add
> "colbacktitle=black" to the definition of the box.
> 
> To get full text width, you may need to use \newtcolorbox rather than
> \newtcbox (which does not seem to like the width option). That will mean
> using \begin{my box name} and \end{my box name} to create the box. The extra
> option you give in the definition of the color box is "width=\textwidth".
> 
> An easier approach, in my opinion, is to use the features of the LyX module
> to define a custom color box. I've attached a hacked copy of your file,
> changing the document type to plain old book, fiddling a bit with your
> preamble (while noting that the color box stuff in the preamble won't be
> needed at all if you use the module features), and demonstrating the custom
> color box feature from the module.
> 
> As for your other questions, it's dinner time here, so you're on your own.
> Hopefully someone else will pick up the thread.
> 
> Paul

I'm CC'ing Lloyd. Since I did not see a reply, I'm guessing that he did
not receive the email.

Scott

Attachment: signature.asc
Description: PGP signature

Reply via email to