I wonder how to make the frame line around caption of listing not being printed (top line being broken into two by caption in the middle) when matlab-prettifier (or listings package) are being used, just like fancyvrb package:

Example 1

Example 2

I have been reading the documents of matlab-prettifier and listings, and do not quite understand the interface between listings and fancyvrb. I can only find a solution for minted package:

Minted with fancyvrb label

Here is a MATLAB code demonstration MWE, only for convenience to you guys doing copy and paste as an example to improve. This example is with line number and frame:

%!TEX program = xelatex

\begin{lstlisting}[style = Matlab-editor, caption = {My 1st Code}, label = first]
% a comment
clear all, clc

x = [1.00; 1.00; 1.00];
beta0 = [1 1 1];

modelfun = 'y ~ k*x^2+b'

mdl = fitnlm(tb,modelfun,beta0)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.