Fri Oct 20 16:09:22 2023, comment #1:
I've tried this now, and it worked, except the fact that the box wasn't closed correctly. The Listings library uses a different macro to be called at the end of the environment that it defines, so we need to patch it to close the box. There was also some wrong formatting, so I fixed that too.
|
Fri Jun 10 01:25:10 2016, original submission:
This MWE
\documentclass[12pt]{book}%
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{listings}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\usepackage{matlab-prettifier}
\definecolor{bg}{RGB}{240,240,240}
\usepackage{upquote} %to fix string quotes
\newtcblisting{matlab}[1]{
nobeforeafter, % <--- added
colback=bg,
size=minimal,
hbox,
listing only,
listing options={
style=Matlab-editor,
basicstyle=\ttfamily#1,
breaklines = false,
escapechar = `,
mlshowsectionrules = true
},
}
\begin{document}
\begin{matlab}{\small}
clear all;
m_zeros = [-1 -2];
m_poles = [0 -4 -6];
gain = 5;
sys = zpk(m_zeros,m_poles,gain);
[num,den] = tfdata(sys,'v');
printsys(num,den,'s')
\end{matlab}
\end{document}
Does not produce similar output as lualatex when compiled with make4ht foo.tex or htlatex
All newlines in the listings are removed in HTML and all the code listings comes out in one long line in the web page.
Using TL 2015 on Linux mint.
|