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
1answer
40 views

escapeinside doesn't work with tcolorbox in beamer

I am trying to make a beamer presentation with the following tcblisting declaration in the preamble. \newtcblisting{ListingBoxWithEscape}[2][]{ minted language=#2, minted style=friendly, minted ...
0
votes
0answers
35 views

How to use escapeinside from minted in an external file

I have managed to do the following \documentclass[12pt]{extbook} \usepackage{geometry} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{microtype} \usepackage{xcolor} \usepackage{...
1
vote
1answer
51 views

How to style when writing code with minted or listings

I have some style references to use style in python highlighted code: or Can you achieve this type of style with minted or listings? By the way, the language is Python. please give an example of ...
0
votes
1answer
12 views

hyperref to sublistings

I'm using the subcaption package to define sublistings that I can put in my listing float environments. The listing float is defined by minted. This has all been working well so far (see full code ...
0
votes
0answers
34 views

Minted package on MacOSX

I am doing some troubleshooting on a Macbook Air (Linux user here) that has got an issue with running minted on MacOSX Mojave. I've been doing so successfully in Ubuntu, and never had any issues there....
1
vote
1answer
49 views

Closing braces become quotes when using inconsolata in minted listings

I am using inconsolata font for monospace text. When I use it in minted environments, closing braces are shown as quotes in output. The following is a minimal example showing the issue, and the two ...
1
vote
1answer
44 views

Using minted inside listing causes Problems

I am farly new to LateX, so please be kind ;-). I am using minted to show off some code I wrote. I want the code to have a caption and label so i can refer to it from the text and have it appear in ...
1
vote
1answer
34 views

Pass as argument options to environment inside \newenvironment

I take advantage of my previous question to ask this one, since from now on I want to implement my environments as much as possible and yet I have not found information about the topic of this ...
2
votes
1answer
50 views

Set minted colored background length

Is there a way to modify the code that minted uses to draw the background to have it up to the middle of the page, or a custom length? I think it should be done with a \newcommand or something like ...
1
vote
1answer
36 views

Space between number and item in List of Listings

I have a report with several code blocks (made with minted), and I would like to have a List of Listings to ease searching. However, currently the number and the caption of the elements are ...
0
votes
0answers
24 views

Minted package does not recognize class object names

I'm using minted to format some C++ code and I realized that it does not color the class objects with the same color that it colors the class name, and to fix that I've created the objectcolor myself (...
0
votes
0answers
31 views

Remove weird default starting characters in minted [duplicate]

Problem I am trying to typeset my code using package minted. However, when I chose the default setting (where showspaces and showtabs options are both false by default), some characters (i.e. ^^I)...
6
votes
1answer
100 views

How to stop macros from processing arguments?

Disclaimer: I don't know how to word this properly so the title might be misleading - edits and comments of advice or correction are very welcome! I use the minted package to add code to my documents,...
0
votes
1answer
61 views

Minted error: Missing pygments error

I have installed the minted package and inserted the --shell-escape command in the settings of TexWorks. \documentclass{article} \usepackage{minted} \begin{document} \begin{minted}{python} import ...
0
votes
0answers
24 views

Wrong results combining breaklines with pagebreaks in minted

I am trying to use the minted package to typeset my code. Everything seems to work fine until a linebreak occurs together with a pagebreak. How should I handle this correctly to avoid the margin ...
1
vote
0answers
50 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{...
1
vote
1answer
28 views

Formatting LaTeX code with minted: makeatletter

I am trying to set some LaTeX code with minted. However, minted (or rather the lexer which it is using) assumes the @ character to be catcode other, as it usually is. In the code that I want to ...
2
votes
2answers
48 views

Infinite compilation with minted, bgcolor, and disabling \let\par\relax

I had defined an environment which disabled \par temporarily with \let\par\relax precisely to disallow paragraph breaks in that environment. It was working fine until I last compiled the document (mid ...
0
votes
1answer
38 views

minted code samples more “condensed” than lst-listing

I want to switch to minted over listings for the superior syntax highlighting, especially for C++. But I can't get the font to look as nicely as with listings. Somehow the font is heavier and more ...
2
votes
0answers
32 views

The minted not working with bash code [duplicate]

I don't know why my MWE is not work for some keywords Here is my MWE \documentclass{article} \usepackage[outputdir=output]{minted} \usepackage[skins,minted]{tcolorbox} \newtcblisting{bashcode}[1][]...
1
vote
0answers
63 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 ...
5
votes
1answer
104 views

How to draw curly braces on minted and tcolorbox?

I have the code below to generate minted code inside box (credit:Ignasi). That format (code inside box) is heavely needed in my previous report paper. \documentclass[12pt,a4paper,oneside]{report} \...
0
votes
0answers
52 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 ...
1
vote
1answer
40 views

Nesting of minted and listing

Can the coupling of minted and listing be wrapped into a new environment? I'm unable to make this code work: \documentclass[a4paper]{article} \usepackage{minted} \usepackage{xparse} \...
2
votes
1answer
38 views

How do I avoid \PYG{err} in minted with pygments when using unicode/UTF-8 input?

Consider the following code: \documentclass{minimal} \usepackage[utf8x]{inputenc} \usepackage{minted} \usepackage{newunicodechar} \newunicodechar{→}{\ensuremath{\to}} \begin{document} \begin{minted}{...
0
votes
0answers
19 views

newline lost with python code generated with minted in a pdf

I'm trying to insert python3 code in a Latex document with `Texstudio`` I have the following code: % !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape] \documentclass[a4paper, 12pt]{book} \...
0
votes
0answers
26 views

Minted package does not recognize lexer inside listing

I have a problem with the minted package. I am using two different lexers, juliaand jlcon. The first one properly highlights code, but the second one only works if the code is not inside a ...
0
votes
0answers
14 views

Importing “minted”s from a subdirectory to another subdirectory

My hierarchy goes like this: Main Folder SubFolderForCode(1) doc.tex code.py SubFolderForCode(2) doc.tex code.py SubFolderForDoc doc.tex I want to ...
0
votes
1answer
33 views

pagenote converts spaces to newlines and breaks verbatim typesetting

I want to typeset verbatim end notes (using minted). Unfortunately pagenote converts all spaces in my page notes into newlines, as the following minimal example shows: \documentclass{memoir} \...
1
vote
1answer
226 views

TexStudio doesn't find the package “Pygments” although it is installed [duplicate]

I'm try to use the minted package in latex to display code in latex document. From Texstudio, I get an error message you must have pygmentize installed to use this package. If I type pip3 install ...
0
votes
1answer
168 views

How to change overall font size of minted? [duplicate]

While using minted I can change font size (Change font size in minted) on each individual place using the fontsize=\footnotesize: \begin{listing} \inputminted[fontsize=\footnotesize]{javascript}{file....
1
vote
0answers
13 views

Minted vhdl show ¡ instead of < [duplicate]

I have some troubles with my latex document. I'm using minted to put on my file some VHDL code. However, when i compile it, all < are replaced by ¡. Does anyone have an idea ? Here is an example :...
1
vote
1answer
38 views

A minted block changes paragraph style for rest of document

I'm using a minted block in my document as follows \captionof{listing} {Salt state for setting up a PostgreSQL server. \label{lst:salt_state_postgres}} \begin{minted} [ breaklines=true, linenos, ...
1
vote
1answer
28 views

textbf in mintinline

I am trying to have bold font in a subsection*{} with using \mintinline. Is there anyway to accomplish that? Here is the example: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{...
4
votes
1answer
58 views

Latex, how to highlight code with different background colors

I saw the example of minted: I write my java code like that: \begin{minted}[breaklines, breakanywhere, escapeinside=||]{java} private byte[] doEncryption(String data, SecretKey key){ |\colorbox{...
0
votes
1answer
59 views

Minted changes text position in slides

I am making a beamer presentation. I have this slide: The code is \begin{frame} Il problema viene affrontato utilizzando il metodo degli elementi finiti che spesso però pone numerose restrizioni ...
1
vote
1answer
28 views

Hide minted output completely without taking up space

Due to issues with Minted's escapeinside option, I would like to include, but completely hide (without taking up any space), a minted environment within my document. I do not want any of the content ...
0
votes
0answers
27 views

Minted snippet with single quotes [duplicate]

I want to create a Python's code snippet which includes single quotes using minted package. I've put it altogether like this: \begin{minted}[ autogobble, frame=lines, framesep=4mm, ...
1
vote
0answers
64 views

minted environment with prefix

I would like to create a new environment using minted, inside which there is always a prefix string. For example, following this answer I have tried \documentclass{article} \usepackage{minted} \...
1
vote
0answers
61 views

Minted does not split code when reaching end of the page

I am trying do to a custom template for minted with background color, line number, title,... However I have an issue with the end of the page. The code are not splitting to a new page but just ...
2
votes
1answer
47 views

minted: why are field variables colored and how can I change that for Java code?

As a minimal example I would want to highlight the following code: (new Thread(() -> { System.out.println("Hello"); })).start(); Given the MWE: \documentclass{article} \usepackage{minted} \...
1
vote
1answer
118 views

Custom Pygments styles in minted not taking effect

I have a fairly minimal document: \documentclass[]{article} \usepackage{minted} \usemintedstyle{github} \begin{document} \begin{minted}{java} public static void main(String[] args) { System.out....
2
votes
1answer
27 views

Using varwidth within an environment definition with minted

I'm trying to create a new environment which holds a centered code snippet using minted. Firstly I came across to a minipage package, however it needs the width specification. I just want it to be ...
3
votes
1answer
55 views

How to put code with minted in the margin?

how to put code with the package minted in the margin (marginpar did not work)? I want my code in the marge like the document but I want use the package minted. Thank you. \documentclass{article} \...
0
votes
0answers
53 views

Change caption setup in listing/minted environment [duplicate]

I would like to change the appearance of the caption of a code snippet that I have created with minted and listing. However, using \captionsetup[listing]{<options>} does not change anything. ...
3
votes
1answer
74 views

minted environment inside subcaptionbox is not working

I've seen some similar questions here and here, but none mention the \subcaptionbox command. Here is my MWE: \documentclass{article} \usepackage{subcaption} \usepackage{minted} \begin{document} \...
0
votes
0answers
11 views

How to get line number within minted using Verbatim figure environment? [duplicate]

I noticed that using Verbatim to use minted within a figure environment removes the line number, compare the following: 1) the figure environment: \begin{figure}[htp] \centering \...
3
votes
2answers
58 views

Directory for importing minted snippets

Is there a way to tell minted to import the snippets from a certain directory? I'm looking for something similar to the way \graphicspath{{img/}} works for images. Right now, all the files I need to ...
0
votes
0answers
37 views

Remove selectable text from source code PDF output

I am writing my master thesis in LaTeX. For source code listings I use minted package. However, my thesis supervisor pointed out that the anti-plagiarism software that is now used in my country will ...
0
votes
1answer
72 views

Caption fontsize in a listing using minted

With listing and minted and a pycon lexer to emulate an IPython console, I'd like to change the caption font size to be footnotesize. Unfortunately, my code below does not change the fontsize of the ...