Hi Siep, Many thanks for your response.
Unfortunately, the listings package doesn't give us quite what we need. It provides formatting and token lighting. We need to mark arbitrary sequences of code to emphasize code changes from previous listings. I've attached an examples of what we have so far, both screen shots and LaTex code: listing_9.2.png shows our original attempt at styling code lists. listing_3.8.png shows our more recent attempt listings.txt shows code for both approaches Our problem is that we need to convert several hundred such listings into a visually attractive style. Best wishes, Lloyd -----Original Message----- From: "Siep Kroonenberg" <si...@cybercomm.nl> Sent: Wednesday, February 7, 2018 4:42pm To: "LuaTeX discussion." <luatex@tug.org> Subject: Re: [luatex] Computer code listings in attractive labeled boxes On Wed, Feb 07, 2018 at 12:37:00PM -0500, Lloyd R. Prentice wrote: > Help! > > I’m a long-time lyx user, but brand new to LuaTeX. > > I need to know if something is possible and, if so, guidance on how to do it. > > My co-author and I have written a computer programming book and typeset it > with lyx. It has several hundred code listings. We first formatted the > listings with available lyx tools. But they were rather ugly. My co-author > found a way to make them more attractive, but the process is kludgy and > inordinately time-consuming. > > We need a better way. > > I’m digging into LuaTeX docs. So far I’ll found tantalizing hints. But it’s > still not clear whether or not we can really accomplish in LuaTeX what I hope > we can do. From my notes: > > Need to know how to: > > Create LuaTeX functions > Call LuaTeX functions from lynx > Create LuaTeX function to display block of code with normal, bold, and > strikeout characters > Create LuaTeX function to display chapter number (CN) > Create LuaTeX function to display listing number (LN) > 6. Create LuaTeX function to display listing header: > “Listing <CN>.<LN> <comment> > 7. Create LuaTeX function to display an attractive box around > listing header and code block > 8. Automate or efficiently replace all listings in current Build It lyx > file Did you try to export your book to LaTeX? When using LaTeX (or pdflatex or lualatex) directly, you can use e.g. the listings package, which supports syntax highlighting and can typeset code from external files. -- Siep Kroonenberg
***** Code for Listing 3.8 ****** \inputencoding{latin9}\begin{lstlisting}[caption={Changing index}] inner_body() -> [ @\x{\#h1 \{ text="Welcome to Nitrogen" \},}@ @\x{\#p\{\},}@ @\x{"}@ @\x{If you can see this page, then your Nitrogen}@ @\x{server is up and running. Click the button}@ @\x{below to test postbacks.}@ @\x{",}@ @\n{\#h1\{ text="Erlingo! WEBSPINNERS" \},}@ @\n{\#h1\{ text="WELCOME!" \},}@ @\n{\#h2\{ text="Joe Armstrong" \},}@ @\n{\#h2\{ text="Rusty Klophaus" \},}@ #p{}, #button { id=button, text="Click me!", postback=click \end{lstlisting} \inputencoding{utf8} ******** Code for Listing 9.2 ********** \begin{lyxcode} \noindent\fbox{\begin{minipage}[t]{1\columnwidth - 2\fboxsep - 2\fboxrule}% Listing 9.2% \end{minipage}} \medskip{} nnote\$~\textbf{cd~etc} etc\$~\textbf{ls} ~~~...~simple\_bridge.config~... etc\$~\textbf{vim~simple\_bridge.config} ... \{port,~8000\}, \%\%~Port~to~bind\medskip{} \end{lyxcode}