Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
1answer
15 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
33 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 ...
1
vote
1answer
35 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 ...
2
votes
1answer
48 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 ...
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
97 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
47 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
23 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
38 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
26 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 ...
1
vote
2answers
116 views

How do I display Unicode characters with minted?

I use a minimal code example with Julia \documentclass{article} \usepackage[cache=false]{minted} \begin{document} \inputminted{julia}{polynomial_regression.jl} \end{document} on # Polynomial ...
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 ...
3
votes
1answer
2k views

Package minted Error: Missing Pygments output [closed]

I installed minted today as well as Python and Pygments, which I can run from the cmd. When I try this code: \documentclass{article} \usepackage{minted} \begin{document} \begin{minted}{c} int main() ...
28
votes
6answers
41k views

How to install syntax highlight package minted on Windows 7?

I followed the instruction from this link: http://tug.ctan.org/tex-archive/macros/latex/contrib/minted/ Firstly, I install Python 2.7, then create a folder named Scripts in the directory: C:\...
0
votes
1answer
35 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 ...
1
vote
0answers
59 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 ...
2
votes
0answers
30 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][]...
5
votes
1answer
85 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
46 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
37 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
33 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} \...
3
votes
1answer
117 views

Line numbers inside margin but outside frame in minted

I've been trying to make the line numbers appear outside the colored frame in my output code blocks, but I also want everything (numbers included) to be inside the margins specified by the geometry ...
2
votes
1answer
687 views

Error with pygmentize when using minted package

Problem: I get multiple undefined control sequences when using the package minted and I believe it is caused by pygmentize. Background I use the software Texpad and the active LaTeX distribution is ...
0
votes
0answers
21 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 ...
2
votes
2answers
169 views

Count lines of multiple files (Using minted for formatting.)

I am using minted to show source code in my document like this: \section{Image functions} \inputminted{python}{src/imagefuncs.py} \section{Matrix operations} \inputminted{python}{src/matrices.py} \...
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
156 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
0answers
12 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
139 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 :...
0
votes
1answer
435 views

breaklines doesn't work with \mintinline

I try to get line-wrapping to work with \mintinline, like so: \documentclass[11pt]{report} \usepackage{minted} \setmintedinline{ bgcolor=lightgray, } \begin{document}...
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
26 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
56 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
55 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 ...
17
votes
4answers
4k views

Reference source code line in minted package

Does anybody know a working example, where a source code line is reference in minted? I have not found any help till now how to do this? \begin{minted}[linenos=true]{c++} bla bla bla bla ; \...
1
vote
1answer
27 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
57 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
1answer
175 views

ifplatform.sty error after installing MiKTeX on Ubuntu Mate 16.04

I can't tell if this is Windows or *nix; you appear to be neither. The error above is what I receive even when I try to compile something as simple as this: \documentclass[11pt]{article} \...
1
vote
0answers
56 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
46 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
92 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....
0
votes
1answer
64 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 ...
2
votes
1answer
26 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
48 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} \...
3
votes
0answers
110 views

In minted package the formatcom option ocure bottom marging

With the following MWE: \documentclass{article} \usepackage{xcolor} \usepackage{minted} \begin{document} \begin{minted}[bgcolor=black,formatcom=\color{white}]{bash} #! /bin/bash # script to turn ...
0
votes
0answers
52 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. ...