[luatex] Computer code listings in attractive labeled boxes
Siep Kroonenberg
siepo at cybercomm.nl
Wed Feb 7 22:42:52 CET 2018
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
More information about the luatex
mailing list