Skip to main content
6 votes
Accepted

`\lstinputlisting` not respecting basicstyle=\tiny

The matlab-prettifier package doesn't seem to have an extra field for setting the font size globally. But looking at the source code, it defines basicstyle = \color{black}\ttfamily\normalsize for all ...
siracusa's user avatar
  • 13.5k
4 votes
Accepted

Move listing numbers outside of framed box in Matlab Prettifier

If you just want to move the numbers, a quick hack could be to use numbersep=25pt or similar. However this will not change the margins around the code block, they will still be different then in the ...
samcarter_is_at_topanswers.xyz's user avatar
4 votes
Accepted

adding frame=none to lstlisting options in \lstdefinestyle gives error with tabular

looks like a bug but as usual with these things, an extra {} helps \documentclass[11pt]{article} \usepackage{listings} \usepackage{matlab-prettifier} \lstdefinestyle{matlab}{style=Matlab-editor, ...
David Carlisle's user avatar
4 votes
Accepted

How do I stop matlab-prettifier thinking print strings are comments?

You can use single quotes instead of double quotes to wrap the string Or else you can define some escape character and put '%' inside the escape characters. Here is a MWE. \documentclass{article} \...
nidhin's user avatar
  • 7,952
4 votes
Accepted

Why font missing message shows up when using standalone and import packages only?

Make the \ttfamily font available to the main document, which I did by typing \setbox0=\hbox{\ttfamily} as the last thing in the preamble, which leaves the document in \rmfamily while loading the \...
Steven B. Segletes's user avatar
3 votes
Accepted

Include MATLAB code listing compiled into HTML with correct colors

Working with colors is a bit complicated with TeX4ht. Stuff like \textcolor works, but colors that are set by \color cannot be supported out of the box. You need to add some HTML tags with color ...
michal.h21's user avatar
  • 51.3k
3 votes
Accepted

Using .\ inside lstlisting causes issues crashes

You shouldn't use beamer for your minimal examples if this is not needed. It is a nuisance to have to load all the pgf stuff. Beside this: listings has a documentation, and this documentation ...
Ulrike Fischer's user avatar
3 votes
Accepted

Matlab Code in a Thesis

You are using the package matlab-prettifier. This package has a manual, see here. There is a Matlab-bw option, see the screenshot below which solves your problem that you mention in your comment "...
Dr. Manuel Kuehner's user avatar
3 votes
Accepted

Degree symbol and \lstinputlisting

Check that the .m file is UTF-8 encoded and convert it if not. \begin{filecontents*}{\jobname.m} function [others] = Create_structure_others() others.a = struct('value', [], 'unit', '°'); end \...
egreg's user avatar
  • 1.1m
3 votes
Accepted

why is adding subdepth package makes lstlisting give Matlab error loading file?

The subdepth package changes some \fontdimen parameters for the math fonts and it has to do it when those fonts are first loaded. In your case, the first loading happens during initialization of ...
egreg's user avatar
  • 1.1m
3 votes

Why font missing message shows up when using standalone and import packages only?

The problem is not related to standalone. You need it as your input has a preamble but you would get a similar problem with a normal input. The problem is the \subimport* command. It changes the ...
Ulrike Fischer's user avatar
3 votes

How do i remove numbered lines from the main text in doccument using Matlab-prettifier

Add numbers=none to the lstlisting options: \documentclass{article} \usepackage[numbered]{matlab-prettifier} \begin{document} \begin{lstlisting}[style=Matlab-editor, numbers=none] ....... \end{...
Torbjørn T.'s user avatar
3 votes
Accepted

numbering isn't showing with matlab-pretifier package

Seems you need \usepackage[numbered]{matlab-prettifier} to turn on numbering, it's not enabled by default. (You could also have added numbers=left to the lstlisting options). You also want \...
Torbjørn T.'s user avatar
2 votes

Use of Bera Mono font with \mlttfamily described by matlab-prettifier

This fixes the problem, \lstset defines the default setting for \lstlisting and I was overwriting this style setting earlier without the change in font. The following code now correctly changes the ...
Lonny T's user avatar
  • 151
2 votes
Accepted

Different Matlab code listings environment in same document with Matlab-prettifier

You load the mcode package with the framed option, which adds the thin (undesired) frame around the code. Your mylisting environment is a color box from the tcolorbox package, which adds another frame ...
hbaderts's user avatar
  • 3,930
2 votes
Accepted

matlab-prettifier: How to insert a green-colored dots as prebreak argument?

I tried prebreak={\color{green}\ldots} and got an error. What did work was to shove the green dots into a savebox first: \newsavebox{\dotbox} \sbox{\dotbox}{{\color{green}\ldots}} \lstset{ ...
Michael Palmer's user avatar
2 votes
Accepted

latex interpretation of selected German and Latin as well as mathematics-physics characters via matlab-prettifier

There's no coverage of UTF-8 by listings, unfortunately. But \UseRawInputEncoding is not the right tool. \documentclass{article} \usepackage[T1]{fontenc} \usepackage[framed,numbered]{matlab-...
egreg's user avatar
  • 1.1m
2 votes

How to get listings to identify \ as letter?

If you want backslashs to be colored you need only one literate: literate=*{\\}{{\textcolor{IndianRed1}{\textbackslash}}}{1} % all \ in IndianRead1 regardless of the number Note, that the first ...
cabohah's user avatar
  • 14k
1 vote
Accepted

tcolorbox in a footnote

You can insert a tcolorbox --with Matlab code inside-- in a footnote. For listing the code I found two options. See the answers to typeset matlab code in a document In both cases you can directly ...
Simon Dispa's user avatar
  • 39.6k
1 vote

How to improve spacing in `lstlisting` environment?

Answers for 1. & 2 and maybe 4. \documentclass[aspectratio=169, xcolor={x11names}, t]{beamer} \usefonttheme{professionalfonts} \renewcommand{\sfdefault}{ppl} \BeforeBeginEnvironment{frame}{\...
Erwann's user avatar
  • 2,130
1 vote

Numbers not shown with matlab-prettifier and beamer

Not a complete answer, but to help you quickly: The numbers are there, but they leaked from the page. Try to compile using an adjustbox and you see them on the left. \documentclass{beamer} \usetheme{...
Leone's user avatar
  • 586
1 vote
Accepted

Matlab Prettifier Package Question

The source of matlab-prettifier has the following style definition as the 'base style' (starting at line 447, see the manual on page 34): language = \languageNormedDefd@mlpr, ...
Marijn's user avatar
  • 38.8k
1 vote
Accepted

Can't get Bera font with Matlab-prettifier

Following suggestions in the comments it turned out the font was simply missing (I'm using a very slim distribution) – a set of warnings could be found in the log file. Fixed the problem by ...
Andy Donzelli's user avatar
1 vote
Accepted

Problem with Chapterbib and Matlab-prettifier

This looks like a bug in listings, revealed in specific circumstances, but I don't know enough to make the MWE without matlab-prettifier, and the three dots (which are special syntax for matlab). The ...
Donald Arseneau's user avatar
1 vote
Accepted

Different programming language environment using \newtcblisting

To answer your questions: Syntax highlight is supported by BOTH the language=... key AND your style of the listings library/package, like keywordstyle, commentstyle, stringstyle, and numberstyle (for ...
wklchris's user avatar
  • 511
1 vote
Accepted

compile/interpret matlab code with one single greek character with matlab prettifier

As micrometer only occurs one place (or, all occurrences of micrometer are to be replaced), you can use the literate option of the listings package. matlab-prettifier is based on listings. That is: \...
Torbjørn T.'s user avatar
1 vote

How do I stop matlab-prettifier thinking print strings are comments?

Try: \lstset{style=Matlab-editor} \lstset{morestring=[m]"} \lstinputlisting{filename.m} It really ought to be added to the style file, perhaps with a version option so that buggy pre-2017 code ...
Philip's user avatar
  • 208

Only top scored, non community-wiki answers of a minimum length are eligible