LyX ⇒ How to insert correctly A Matlab code within Lyx
How to insert correctly A Matlab code within Lyx
Someone know how can I copy&paste a matlab script within lyx without loosing all the structure and colors?
Thank You!
/davide
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
How to insert correctly A Matlab code within Lyx
Code: Select all
\usepackage{color}\definecolor{hellgelb}{rgb}{1,1,0.85}\definecolor{colKeys}{rgb}{0,0,1}\definecolor{colIdentifier}{rgb}{0,0,0}\definecolor{colComments}{rgb}{1,0,0}\definecolor{colString}{rgb}{0,0.5,0}\lstset{%language=Matlab,%float=hbp,%basicstyle=\footnotesize\ttfamily,%identifierstyle=\color{colIdentifier},%keywordstyle=\color{colKeys},%stringstyle=\color{colString},%commentstyle=\itshape\color{colComments},%columns=fixed,tabsize=4,%frame=single,%framerule=1pt,extendedchars=true,%showspaces=false,%showstringspaces=false,%numbers=left,%numberstyle=\tiny\ttfamily,%numbersep=1em,%breaklines=true,%breakindent=10pt,%backgroundcolor=\color{hellgelb},%breakautoindent=true,%captionpos=t,%xleftmargin=1em,%xrightmargin=\fboxsep%}
Re: How to insert correctly A Matlab code within Lyx
Thank You,
davide
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to insert correctly A Matlab code within Lyx
Take a look at the code Juanjo gave you. There you will find lines which specify the layout of the listing. Refer to the documentation of lstlistings and you will know how to change the appearance.newnoise wrote:Thank You very much! It works! Just to know: as I do the PDF, the Program Listing is contained within a black frame. It is possible to take out that frame in some way? [...]
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: How to insert correctly A Matlab code within Lyx
/davide