I use a program called "highlight" to highlight the source code, and all this 
is done by adding an external template (insert -> external template)

In the file .lyx/external_templates I add

Template CppKod
        GuiName "[C++ $$Basename]"
        HelpText
                Snyggar till C++ kod
        HelpTextEnd
        FileFilter "*"
        ViewCommand "nedit $$FName"
        EditCommand "nedit $$FName"
        AutomaticProduction true
        Format LaTeX
                Product "{\\small \\input{$$FName.tex} }"
                UpdateCommand "highlight -A -L -t 4 -I -S cpp -f -r -q 
$$FName -o $$FName.tex"
                UpdateResult "$$FName.tex"
        FormatEnd
TemplateEnd

and it works quite well for me. Dynamically also!

Reply via email to