Categories: Example<< | Page list | >>
How to include external program listings using pygments
This automatically uses the source code, and any change in the external source code will be visible in the LyX output.
Notice that you can skip the -l cpp parameter and then the pygmentize program will automatically select the appropriate language.
(but do not include these two lines!) to the LaTeX Preamble window in document settings. Add these two lines at the beggining of the preamble:
Click the Save as Document Defaults button.
gedit is the texteditor that I use to write program code. Change to what you want to use. Notice that the Format name must be something unique that is not used elsewhere.
Add the same thing for conversion from C++ to LATEX(plain). Dont forget to change to reﬂect the language you are using. Also make sure that you don't use any "extra parameters".
You will likely want to use your code in figures as well. The process for this is fairly simple: