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

115 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
527 views

Copyable tabs in minted

I'm preparing tutorial for students with code fragments that they will copy to a text editor. Is there a way to make syntax-highlighted code copyable to text editor so that indentation is preserved, ...
8
votes
0answers
1k views

\inputminted: distinct file parts in one listing (equivalent to linerange in listings)

I want to include code from a file into my document. However, several distinct line ranges should appear in the same listing. Also, I want to use gobbling, and it would be nice to include some blank ...
7
votes
0answers
196 views

Defining a two part environment using minted and listings

I am writing some programming instructions for students, and I am trying to format the code so that it looks like the cell input/output structure of a Jupyter or Google Colab notebook. So I want it ...
6
votes
1answer
284 views

One tcolorbox with alternative color in different lines

This is what I want to get This is what I already have \documentclass{article} \usepackage{geometry} \geometry{left=2.5cm,right=2cm,top=2.5cm,bottom=2.5cm} \usepackage{fontawesome} \usepackage{...
5
votes
1answer
751 views

minted escapeinside and code ligatures

When using Fira Code in listings you'll get programming/code ligatures. This behavior has to be enabled and usually minted does nothing special. But if you turn on escapeinside with any character that ...
5
votes
0answers
162 views

How can I use scintillua lexers to replace minted or listings with luatex?

Scintilla is a text editor. Scintillua adds dynamic Lua LPeg lexers to Scintilla for multiple languages. According to the documentation, Scintillua can be used as a library: Using Scintillua as a ...
4
votes
0answers
180 views

Typesetting MAGMA code with minted?

I enjoy highlighting my Python code with minted. However I now would like to do the same with my Magma code (Magma is a commercial computer algebra system of broadly similar scope as GAP). However ...
4
votes
0answers
699 views

tcolorbox line numbers

I am trying to make a generic environment to use for all my boxes in my document. I want all my boxes to have line numbers. I can only get this to work some of the time. I don't get line numbers when ...
3
votes
1answer
75 views

minted escapeinside works for all supported languages except LaTeX

I want to add some math symbols into the escaped contents, minted works well for languages like Python, but not LaTeX. A sample code: \documentclass{article} \usepackage{minted} \begin{document} \...
3
votes
0answers
290 views

How to split long C/C++ code line on two lines without inserting new line number?

I am using the following snippet to insert C/C++ code into my LaTeX document but the problem is that the code on one line is too long and it goes over the right side of the document page. How to split ...
3
votes
0answers
1k views

Minted & Fonts Types/Families

I am typesetting some code in my document. In my preamble I include some packages to make the font a Times style font. \documentclass[11pt,letterpaper]{article} \usepackage[utf8]{inputenc} \...
3
votes
0answers
537 views

How to give the same height to side by side minipages?

I tried putting two minted environments next to each other. I decided to use minipage for that purpose. Each of the minted environments has a grey background. Unfortunately, the two code snippets do ...
3
votes
0answers
104 views

How to Mimic Line Breaks from listings in minted

I'm like the syntax highlighting of minted but cannot get it to mimic the "more pleasing" line breaks for long code strings found in listings. In the example below, I have three snippets: the first ...
3
votes
0answers
528 views

How to you properly specify an alternative to the pygmentize external command for minted?

A while ago I asked how to extend minted to colour-highlight my chosen key words. The consensus was "make the changes in the external pygment program" -- so I did. The changes are small and the ...
3
votes
0answers
1k views

minted doesn't seem to use cache when outputdir option given

I am building out-of-source so my build command looks like this pdflatex -shell-escape --halt-on-error -output-directory="/tmp/build" book.tex I have been using minted for syntax highlighting \...
3
votes
0answers
176 views

Highlight commands with @ (\@title) using minted

I'm writing a document which contains some code snippets such as: \newcommand\section{\@startsection {section}{1}{\z@}% {-3.5ex \@plus -1ex \@minus -.2ex}% ...
3
votes
0answers
279 views

minted or listings input a file between markers

Is it possible, using the minted or listings package to format a file between or till a certain textual marker automatically. E.g. consider a source file: code code //marker code ... //end marker ...
2
votes
0answers
30 views

in source code comments $ gets turned into £

I'm creating pdfs of source code using the minted package... and surprised to see $ get turned into £. pdflatex --shell-escape create_array.tex is the command. create_array.tex looks like: \...
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 ...
2
votes
0answers
833 views

Highlight JSON code snippet with minted

I have a JSON code snippet that I like to include into my LaTeX document: "builders": [ { "type": "test", "image": "ubuntu:latest", "changes": [ "EXPOSE 123 ...
2
votes
0answers
224 views

How to reduce the space before and after minted text with captions (listing)?

I have to write an article with many blocks embedding equations and code and decided to use the package minted. I would like to reduce the spacing (margins) before and after each minted block, just ...
2
votes
0answers
2k views

Complete setup for XeLaTeX or LuaLaTeX in VSCode with Julia Code using Minted

I've asked the Julia community here my question, and have gotten some nice help. I thought I might cast a wider net for clarification. TL; DR: What is the complete setup for VSCode to run XeLaTeX or ...
2
votes
0answers
448 views

Option clash for textcomp with newtxtext, minted and xwatermark

I am having an option clash for package textcomp, it happens with this code: \documentclass{book} \usepackage{newtxtext} \usepackage{minted} \usepackage{xwatermark} \begin{document} Hi \end{...
2
votes
0answers
207 views

How to keep formating when copy-paste code sections with minted?

I am using the minted package for syntax highlighting code in my slides, but I have some problem to make this code easily copyable directly from the PDF to the console. it seems that the whitespaces ...
2
votes
1answer
555 views

OSX Sierra - Pygmentize sometimes not recognized

I've recently decided to switch to minted due to way better Python highlighting. I am having weird issues with minted sometimes not being able to find pygmentize on my Mac - never had the same issues ...
2
votes
0answers
193 views

Red squares with minted and mathescape=true

Using the following code: \documentclass{article} \usepackage{minted} \usepackage{mathabx} \begin{document} \begin{minted}[escapeinside=||,mathescape=true]{http} POST /shop/28/Shop.aspx HTTP/1.1 ...
2
votes
0answers
415 views

How to put the caption of a listing on the right margin?

I am currently using the package floatrow to put the captions of my figures on the right margin. How to achieve the same result for the captions inside listing environment (provided by \usepackage[...
2
votes
0answers
128 views

suppress highlight around special characters in tcolorbox and minted

I am using tcolorbox for listing some (bash) code. I'd like to suppress the dimmed highlighting around special characters ($, { and }) in the following MWE: \documentclass{article} \usepackage{...
2
votes
0answers
568 views

TEXINPUTS equivalent for inputminted to make relative paths work?

A while ago I griped about LaTeX not supporting relative paths by default. It turns out I can export the TEXINPUTS=/path/to/source environment variable to make \input{foo} look in /path/to/source/foo. ...
2
votes
0answers
342 views

Determine equal spacing before and after minted environment

I have some code in a minted-environment that I want to separate from the rest of the text by equal spacing before and after the environment. I successfully used the method described here for an ...
2
votes
0answers
1k views

Python console code with minted

I am using minted to highlight source code in my document. I have defined \definecolor{codeyellow}{RGB}{255,251,204} \newminted{python}{linenos,breaklines,frame=lines,bgcolor=codeyellow} in the ...
2
votes
0answers
397 views

Possible bug in minted package

(just now while typing the topic title I found possible related but my post is too long to discard it now :-) ) (the minipages is only to show side by side. I'll not use it) I'm using minted package ...
1
vote
0answers
23 views

How do I “disable” code lines in minted (in beamer)?

I want to reproduce the following screenshot with minted (in beamer, though I don't think that matters). How would I go about doing that?
1
vote
0answers
20 views

How to insert python code inside multicols environment

I'm new to latex. I'm having a multicols table. Below is the latex code - \documentclass[10pt,english,landscape]{article} \usepackage{multicol} \usepackage{calc} \usepackage[landscape]{geometry} \...
1
vote
0answers
39 views

How can I highlight specific lines of code with minted in beamer?

I've been working on a set of slides in beamer, and one feature I really like as I'm learning is alert. In one part of my presentation, I have a relatively complex bit of code that's 12 lines long ...
1
vote
0answers
25 views

Todo notes inside minted

I'm trying to use Todonotes inside minted in order to easily annotate some code. I tried using escapeinside but the following code results in 5 errors unfortunately. \documentclass{article} \...
1
vote
1answer
45 views

How can I manually add italics or underlines to code listings using minted?

I'm a new user of minted, and I have a LaTeX fragment that looks like this: \begin{minted}{python} `s` = input(`prompt`) \end{minted} I was previously using the listings package: \begin{lstlisting} `...
1
vote
0answers
24 views

Use mintinline to textformat a glossary category using glossaries-extra

I am using glossaries-extra and bib2gls. I'd like to format the text of glossary entries of certain categories using mintinline. texttt works fine however, I would prefer to have some syntax ...
1
vote
0answers
32 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} ...
1
vote
0answers
67 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
0answers
72 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 "...
1
vote
0answers
102 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 ...
1
vote
0answers
65 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 ...
1
vote
0answers
82 views

How can I use a minted listing inside a tcolorbox's top half *and* bottom half?

I'm creating reference documentation for a intro-to-programming class. As part of this, I'm going to have syntax definitions and examples of the syntax. To write this, I'd like to have LaTeX syntax ...
1
vote
0answers
215 views

Gummi cannot compile with minted package, but can compile at command line

I'm working off of an example from https://www.overleaf.com/learn/latex/Code_Highlighting_with_minted that shows how to import code into a LaTeX document, which I've simplified to give a minimal ...
1
vote
0answers
338 views

How to reduce space above and below minted?

I'm using minted to display some code in my document and I noticed an uncomfortably large space above and below the minted environment and I wasn't able to find out where does the space come from, and ...
1
vote
0answers
45 views

How to force minted to hide any overflow?

minted package in LaTeX has a possibility to automatically wrap lines. But how to let the lines as they are and force the minted package to hide any possible overflow? This might be useful for a ...
1
vote
0answers
112 views

Wrong space in minted bash

I have the following code: \mint{bash}{printf "\xc3\xb1/"} The syntax highlighting is nice, but it adds additional spaces in the wrong place. How can I avoid it? I've compiled the document in my ...
1
vote
0answers
156 views

Caption setup for package Minted

When using minted, the spaceing below and above the code is too high. In comparsion when using a new created environment (mintedlisting) with the package caption, the spaceing seems to be right but ...