New answers tagged

0

Being in the same situation and having many code listings, I didn't want to make a separate tex file for each listing. I found that by declaring the minted environment as a "standalone environment", on line 4 below, you can have multiple listings that get separate pages in the produced pdf: \documentclass[varwidth=6cm, border={0.5cm 0.1cm 0.1cm ...


3

The package documentation mentions \newmintinline: \documentclass{article} \usepackage{minted} \newmintinline[cc]{latex}{} \begin{document} \mintinline{latex}{\mycommand{argument}} \cc{\mycommand{argument}} \end{document}


5

your class defines listing for an unrelated purpose. If you do not need that you can re-assert the minted version: \documentclass[english,12pt]{toptesi} \usepackage[utf8]{inputenc} \usepackage{minted} \let\IWANTTHISlisting=\listing \begin{document} \let\listing=\IWANTTHISlisting \begin{listing}[!ht] \begin{minted}[tabsize=4]{json} { "type": "Room" ...


0

Update for the curious. If you're seeking to modify just one or two stylings, the prefix is no longer PY, it's PYG, and if you want to override something for just one particular color scheme ('perldoc' as an example), you have to do something like this: \makeatletter \AtBeginDocument{% ...


5

This should do what you want. \newenvironment{sourcecode}[1] {% \VerbatimEnvironment \def\savedcaption{\caption{#1}}% \begin{listing}[ht]% \begin{python3code}% } {% \end{python3code}% \savedcaption \end{listing}% } You need \VerbatimEnvironment, because you are creating an environment that uses fancyvrb internally. You need a ...


1

In my case, the solutions above does not work. I was trying to print the following Python 3 line, using minted 2.1: >>> print("Instalação!") Instalação! I ended by disable the color boxes around "çã" e "!", by inserting in the preamble: \AtBeginEnvironment{minted}{% \renewcommand{\fcolorbox}[4][]{#4}} This solution I found here.


2

You can use BVerbatim instead of Verbatim, but the line numbers and the frame must be added manually. \documentclass{article} \usepackage{minted} \usepackage{lipsum} \setminted[c++]{ % linenos=true, % Line numbers autogobble=true, % Automatically remove common white space frame=lines, framesep=2mm, ...


2

You should load minted before classicthesis, otherwise you get a pdfTeX warning (ext4): destination with the same identifier (name{figure.0.1}) has been already used, duplicate ignored warning, with incorrect hyperlinks. Then you can make \l@listing the same as \l@figure, which is what newfloat does anyway, but after classicthesis has modified the ...


1

minted loads the newfloat-Package if the identical option is applied. newfloat uses the \listoffigure command for new lists. Looks like this is a bit buggy - but I'm not sure who to blame: me, newfloat, minted or classicthesis. In order to fix the list of listings I had to overwrite the \cftfigpresnum command. ...



Top 50 recent answers are included