LyX ⇒ minted | Get it working
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
minted | Get it working
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 2
- Joined: Mon Nov 07, 2011 9:13 pm
minted | Get it working
localghost wrote:Since minted is an official package listed on CTAN and part of the common TeX distributions, you should be able to install it by the package manager of your distribution and utilize it. I cannot tell you how to include the package in LyX.
Best regards and welcome to the board
Thorsten
Hmm, I can't seem to find it in Ubuntu 11.10. Is there a distro you know has it? Also, why can't you tell me how to include it in LyX? Do you not want to tell me, or do you not know?
Thanks
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
minted | Get it working
Check on the command line (terminal) whether the package can be found in your TeX installation tree.waspinator wrote:Hmm, I can't seem to find it in Ubuntu 11.10. […]
Code: Select all
kpsewhich minted.sty
Note that I was not talking about Linux distributions, but about TeX distributions like MiKTeX or TeX Live. Both contain the minted package.waspinator wrote:[…] Is there a distro you know has it? […]
What makes you think that I don't want? Would I be here else? I can't tell you because I just don't use LyX.waspinator wrote:[…] Also, why can't you tell me how to include it in LyX? Do you not want to tell me, or do you not know? […]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
minted | Get it working
First download (or make) minted.sty
Code: Select all
sudo mkdir "/usr/share/texmf-texlive/tex/latex/minted/"
sudo cp minted.sty "/usr/share/texmf-texlive/tex/latex/minted/"
sudo mktexlsr
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
\begin{minted}{python}
def boring(args = None): pass
\end{minted}
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