Questions tagged [minted]

{minted} is a package that facilitates expressive syntax highlighting in LaTeX using the powerful Pygments library. The package provides options to customize the highlighted source code output using {fancyvrb}. You'll need to install the Python package Pygments (e.g using pip install Pygments). If you want to run your file with pdflatex, then you need to do so with the -shell-escape flag, e.g. pdflatex -shell-escape myfile.tex

Filter by
Sorted by
Tagged with
1
vote
2answers
204 views

@ in python code with minted

I want to add some python code using the minted package to my latex file. I used \begin{minted} [ frame=lines, framesep=2mm, baselinestretch=1.2, fontsize=\footnotesize, linenos ] {python} A @ B \end{...
2
votes
1answer
39 views

Using the minted escapeinside option with the pycon lexer

What's going on here? \documentclass{article} \usepackage{minted} \begin{document} % I want to show the output as latex, this is a minimal repro without any output at all \begin{minted}[escapeinside=...
1
vote
0answers
33 views

Why do I need a blank line in the listing environment when using the minted package with the newfloat option in a tufte-handout

As described in the title. MWE: \documentclass{tufte-handout} \usepackage[newfloat]{minted} \begin{document} \begin{listing} \begin{minted}{python} a = 666 \end{minted} \end{listing} \end{document} ...
2
votes
1answer
383 views

Use minted for plain-text? (without syntax-highlighting) [duplicate]

I'm possibly too lazy to find how to do it without minted, but since I already use minted and I want top keep it's styles it applies to code boxes (like background color, the line break features, ...
0
votes
0answers
25 views

How to use captions in the style of headings in the appendix of floating environments?

TL;DR: If I have to word it differently, I could also ask: How can I use headings instead of captions for these entries (listings or figures)? I do have these elements: pictures in figure floats ...
1
vote
1answer
51 views

How can I make minted in newfloat mode work with dot2texi?

The following gives a compilation error: \documentclass{report} \usepackage{dot2texi} \usepackage[newfloat]{minted} \begin{document} Content \end{document} with output ... Package: dot2texi 2008/05/...
2
votes
1answer
72 views

Using minted in subfiles in a subdirectory

The answer here gives a MWE that shows how to make \inputminted work in a subfile. However, the approach does not work for \begin{minted}. For the following setup main.tex: \documentclass{article} \...
3
votes
2answers
159 views

Using the minted package breaks my paragraph indentation

I'm using the minted package for a paper that I'm writing and everything works perfectly fine and compiles without errors, except that, after the first time I use \begin{minted}{csharp} the usual ...
2
votes
1answer
94 views

tcolorbox & parskip & minted

I want to use minted code extract within tcolorbox, but it fails to properly set the parskip of the first box. I already use parskip=false inside the tcolorbox, but it doesn't solve the issue. \...
0
votes
0answers
37 views

How can I patch mintinline to work with breaklines and mathmode?

I've recently reported a bug in the minted package that this works: \documentclass{article} \usepackage{minted} \begin{document} $\mintinline{c}{void foo}$ \end{document} but \documentclass{article} \...
4
votes
2answers
194 views

Creating better HTML code with minted and tex4ht

I have a web publishing setup where I compile my LaTeX down to static HTML templates using tex4ht. I end up creating my own styling for these pages. I also use the minted package to style code in my ...
0
votes
0answers
10 views

Highlighting part of a XML code inside the minted environment in LaTeX

I want to highlight part of a xml code in LaTeX; however, it doesn't work. This is my code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{listings} \...
1
vote
1answer
104 views

About verbatim in LaTeX (and LuaTeX)

What I intend to do... Initially, I wanted to write a series of environments that help me typeset verbatim environments. For example, I would like \begin{myverb}{stylea} \end{myverb} to be equivalent ...
0
votes
0answers
33 views

Toggle minted highlighting using OCG layers

I have a document which contains a minted listing spanning multiple pages. I would like the ability to toggle the highlighting using OCG layers. More specifically, I'd like the listing to have black ...
0
votes
0answers
45 views

Place two different snippets side by side in latex via minted package

I would like to place two different snippets side by side in latex. Currently, I am using 'minted' and 'minipage' packages, unfortunately I can not get my desired output. Here is my last try: \...
2
votes
2answers
103 views

Characters are not displayed correctly by using FiraMono font (dvips -> ps2pdf)

My tags are follows: \documentclass{book} \usepackage{minted} \usemintedstyle{default} \usepackage[T1]{fontenc} \usepackage{FiraMono} \begin{document} \begin{minted}[]{python} with open('data/anna-...
0
votes
1answer
30 views

multiple breaklines symbols for minted

I would like to allow minted to break lines after either ., , or a space. Currently I could only break lines either after , or before . How can I allow more characters? \documentclass{article} \...
0
votes
1answer
27 views

\mintinline double-renders # symbol in footnote

I'm using minted to display inline code in a footnote. For some reason the # symbol is rendered twice o.O This does not happen outside footnotes. \footnote{bla bla \mintinline{python}{x = 5 # text} ...
1
vote
0answers
23 views

Minted remove red rectangles around characters [duplicate]

I need to typeset a Perl Mason HTML template file. Unfortunately, there is no minted format for it, so I used standard HTML: \documentclass[12pt]{article} \usepackage[a4paper]{geometry} \geometry{...
1
vote
1answer
87 views

changing all colors to Black/White using minted.sty

My tags are follows: \documentclass{book} \usepackage{minted} \usemintedstyle{default} \begin{document} \begin{minted}[]{python} saying = "It's turtles all the way down" \end{minted} \...
2
votes
1answer
124 views

Custom styles for minted in Overleaf

So I just moved from listings to minted, as listings had super annoying problems with lines showing up when the background color is set to dark. Minted, on the other hand, is annoying as there doesn't ...
1
vote
1answer
129 views

Highlight labeled lines of code with minted

I was wondering whether I could use the labeling mechanism explained here to get the line numbers that I want to use for highlighting code via highlightlines in minted. I am imagining something like ...
0
votes
1answer
37 views

Minted set manual hyphenation

MWE: \documentclass[12pt]{article} \usepackage[a4paper]{geometry} \geometry{tmargin=2cm,bmargin=2cm,lmargin=2cm,rmargin=2cm} \usepackage{minted} \begin{document} \begin{minted}[breaklines, tabsize=2]{...
0
votes
2answers
64 views

minted does not break lines based on breakbefore

I want minted to break lines after ".", so I use breakbefore=. and breakbytokenanywhere=true but minted still breaks the line before "." instead of after. What am I missing? \documentclass{article} \...
2
votes
1answer
86 views

How to use escapeinside in a json file while using minted package

\documentclass{article} \usepackage{minted} \begin{document} This is a python \begin{minted}[escapeinside=||]{py} def f(x): y = x|\colorbox{green}{**}|2 return y \end{...
1
vote
1answer
49 views

How to Reset line numbers in minted code?

i have a portion of code in minted package: \begin{minted}[ frame=single, numbersep = 1pt, breaklines=true, framesep=1mm, baselinestretch=1, bgcolor=LightGray, fontsize=\footnotesize, linenos ...
0
votes
0answers
33 views

Error when using \inputminted with a file with a unicode character

I'm writing a document with the minted package. I've already rendered dozens of code listings with it, so it works under normal conditions. I now have a file with a unicode character in the file name:...
0
votes
1answer
51 views

Custom Enviroment with tcolorbox/minted inside of marginfigure

Trying to set up the following, \documentclass{tufte-handout} % Code Formatting Stuff \usepackage{tcolorbox} \usepackage{minted} \tcbuselibrary{minted} \tcbuselibrary{breakable} \setminted{style=...
0
votes
0answers
25 views

Cannot get minted and beamer to work together in MikTex [duplicate]

Edit: This was solved by changing \begin{frame} to \begin{frame}[fragile] as suggested by @ulrike-fischer. Here is a detailed answer: https://pbelmans.ncag.info/blog/2011/02/20/why-latex-beamer-needs-...
2
votes
0answers
80 views

tcolorbox with minted option + glossaries + biblatex: limitation, incompatibility or bug?

An issue occurs when one wants, on one hand, to have more than five "local" glossaries and a main glossary (glossaries packages) and, on the other hand, to use also biblatex and tcolorbox with its ...
0
votes
0answers
23 views

Editing highlighting rules for bash in the minted package

I use the minted package for syntax highlighting of bash scripts. I use texlive. I have some problems of the typeset output. Where can I find the rules for bash scripts? Are those in the Pygments ...
0
votes
1answer
53 views

Is there a way to prepend something on every line using tcolorbox and minted? [duplicate]

The tcolorbox manual shows a nice example of prepending a command prompt on every line of a shell input (page 317), but it apparently only works for the listings library. Is there a similar option for ...
1
vote
0answers
69 views

minted package -shell-escape error

I am using TeXStudio with LuaLaTeX on Windows 10. When I call \usepackage{minted} I get Package minted Error: You must invoke LaTeX with the -shell-escape flag. \usepackage How can I solve the ...
1
vote
1answer
751 views

Minted change text color

I'm putting some C code on my report using minted package, but the comment color is blue while I want it to be gray. \documentclass[11pt]{article} \usepackage[cache=false]{minted} \begin{document} \...
0
votes
2answers
112 views

Strange behaviour of tcolorbox using the minted library

So I've been loosing my mind over typesetting a document with some code examples. After a few days of investigations I was able to narrow down the issue. This is the preamble (edit: shorter code): \...
0
votes
0answers
75 views

Minted breaks the bibliography formatting

Does anybody know if {minted} in latex has any conflict with other referencing packages? Why does it have this weird impact on the formatting of the reference? The references continue growing in one ...
1
vote
0answers
73 views

How to show the vertical indent guides of a code in minted?

I'm using minted for a competitive programming reference, I'm using a tool that given a template lets you create a .tex file with all of your codes highlighted with minted. So I know that a lot of ...
1
vote
0answers
52 views

How to highlight lines on a pattern using minted?

The Answer in "How to highlight (color/draw attention to) a particular snippet in Minted" is very helpful. But, is there a way to highlight lines in minted on a pattern? E.g. not to say "...
2
votes
2answers
76 views

Hiding an environment that contains minted code

Task: I want to create a 'notes' command and an environment which can be hidden by a boolean flag. Problem: These 'notes' can contain minted code blocks which mess up previous solutions found on the ...
1
vote
0answers
103 views

Centering \newtcblisting

Continuing with my book in xelatex, I could't solve how to center a tcblisting. Here is my (i hope this time), MWE: % !TEX encoding = UTF-8 % !TEX program = xelatex % !TEX spellcheck = es_ES % !TEX ...
2
votes
1answer
71 views

How to parametrize newminted environments in the point of use

In my tex files I currently have the following newminted definitions for various Java code listings. \newminted[javacode]{java}{% tabsize=4, fontsize=\footnotesize, xleftmargin=30pt, ...
0
votes
0answers
308 views

Problems with minted package in overleaf

I am using overleaf for my LaTeX document and I need to add a snippet of some Python code. I have the following packages: \documentclass[twoside,11pt]{Latex/Classes/PhDthesisPSnPDF} \input{Latex/...
4
votes
1answer
2k views

minted environment not working in overleaf

The code it's not working on Overleaf when it comes to minted environment (or mint command) used in a file placed in a subdirectory. Note that the very same code works if placed in main directory. ...
0
votes
0answers
45 views

I am having problem to construct minted style listings with tcolorbox. Please help! [duplicate]

Here's my latex project on Overleaf.com and errors and logs: I created a .cls by loading the class file \LoadClass[12pt, a4paper]{book} And then I add some packages essential \RequirePackage[utf8]{...
0
votes
0answers
68 views

Minted listings spanning across multiple pages with caption

I'm using the lncs class and I'm trying to have long code highlighted with minted to span across multiple pages with a caption. According to the minted documentation, a new environment is needed. I'm ...
1
vote
0answers
67 views

Beamer: \begin{frame} + minted package for syntax highlighting

I am trying to define a .sty file to help adding slides with code samples in my presentations. The minted package is a nice-looking solution for adding syntax-highlighting, but I can't get it to work ...
0
votes
0answers
22 views

Put some code with minted in an a0poster

I am using Overleaf to create my poster with the class a0poster. I have a question about introducing a code (SPARQL) in a minted block for a poster. When I used a minted block, with beamer or article ...
1
vote
1answer
83 views

Controlling minted cache filenames (.pygtex)

I have two nearly-identical documents with slightly different settings (one with 11pt font, and the other with 10pt), say book10.tex and book11.tex. They import a code snippet with minted using \...
3
votes
2answers
294 views

tcolorbox inserting indent after code box

(the commented lines will be used later but as we can see in MWE, they aren't related with the problem) Why is there a par indent after the code box? MWE \documentclass{report} \usepackage{lipsum} ...
2
votes
1answer
54 views

mintinline in footnote doesn't resize properly

When setting up the minted environment to use a specific fontsize, it is not correctly resize with the environment. This is a MWE: \documentclass{scrbook} \usepackage[chapter]{minted} \setminted[c++]...

1
2
3 4 5
16