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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
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.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? [...]
Code: Select all
\lstset{%
...
frame=single,%
framerule=1pt,%
...
}
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