Hi, guys, here is how I got minted.sty working in lyx. (alternatively minted is an official CTAN package so it could be done that way)
First download (or make) minted.sty
- Code: Select all • Open in writeLaTeX
sudo mkdir "/usr/share/texmf-texlive/tex/latex/minted/"
sudo cp minted.sty "/usr/share/texmf-texlive/tex/latex/minted/"
sudo mktexlsr
Then in lyx, go to Tools/Tex Information, select latex styles and click rescan. minted.sty should appear in the list
in lyx, go to "Tools>preferences>file handling>converters" and find the converter from tex to pdflatex. Edit its command line adding the option "-shell-escape" (no quotes) into the Converter field, then click the Modify button next to the list of converters. Then click Apply
in lyx, go to Document>Settings and enter "/usepackage{minted}" (no quotes) in the latex preamble
in lyx, in the part of your document where you want the highlighted code to appear, go to "Insert>TEX code" to get an Evil Red Text (ERT) box
in the ERT box, type:
- Code: Select all • Open in writeLaTeX
\begin{minted}{python}
def boring(args = None): pass
\end{minted}
Then render your lyx file as a pdf by clicking the render pdf button in lyx. If you get an error message post it here.
Hope this helps! Telewatho
EDIT: oh, and make sure you get ERT boxes in the right place in lyx or you will get errors when you try and render