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
31 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} \...
0
votes
1answer
53 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
7 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
38 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....
2
votes
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
360 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
28 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, ...
2
votes
1answer
20 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
49 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
46 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 ; \...
0
votes
1answer
21 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 ...
1
vote
0answers
24 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
52 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
157 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
38 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 ...
3
votes
1answer
40 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
39 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
39 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
25 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
39 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} \...
4
votes
0answers
107 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
49 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
31 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
10 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
45 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 ...
5
votes
3answers
144 views

Reduce distance between listings and their captions

I'm using the KOMA scrbook class to write my thesis. I have source code blocks that I wish to display with minted. An MWE can be seen here: % Intended LaTeX compiler: pdflatex \documentclass{scrbook} ...
1
vote
0answers
30 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 ...
5
votes
0answers
92 views

One tcbcolorbox 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{...
40
votes
3answers
10k views

Code spanning over two pages with minted, inside listing with caption

I am trying using minted to display some code in my document, but the code is long and spans over two pages, this works fine, however when I place my code inside \begin{listing} \inputminted{java}{...
0
votes
2answers
42 views

How to make Greek-containing tokens in minted, without XeTeX or LuaTeX?

I would like to use mixed Latin/Greek tokens (variable names) like helloδ in minted. To stay compatible with arXiv I cannot use XeTeX or LuaTeX. Outside of minted, working with textgreek is my ...
9
votes
1answer
4k views

Minted Error “Undefined control sequence. \PYG” with TeXmaker

I have a Windows 10 computer and try to use the minted package to insert vhdl code into my LaTeX file. I did install Python and Pygments and added Python/scripts to the path. I also change the command ...
1
vote
0answers
35 views

minted + escapeinside: how to feed the result of the escape into the lexer?

The result of an escapeinside in minted is typeset as-is, and not fed into the lexer. This is by design, as I understand. How can I change minted's behavior so that the result of the escapeinside is ...
5
votes
0answers
48 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 ...
2
votes
1answer
59 views

How to run minted listing inside newcommand

I try to capsule my listings to bound into a bigger project. If I run as stand alone, everything is fine: %LISTINGS \documentclass[a4paper, 12pt]{scrartcl} %USINGS \usepackage{xcolor} \usepackage{...
0
votes
0answers
22 views

\PYGdefault undefined error in TeXstudio - how to remove the __minted_* folder?

I installed TeXstudio and texlive with sudo apt install texlive-full afterwards I installed the pygments with sudo apt-get install python-pygments and I used the command % !TeX TXS-program:compile = ...
0
votes
0answers
157 views

Just started using Visual Studio Code, how do I use Minted and (optional) Asymptote?

I had been using TeXnicCenter for Windows with MikTeX for a while now and I decided to use a different IDE to check out better IDEs for LaTeX. I decided to download Visual Studio Code along with the ...
0
votes
0answers
44 views

Minted tango theme indentation

The following mwe shows the problem I am facing: \documentclass{article} \usepackage{minted} \begin{document} \usemintedstyle{tango} \begin{minted}{matlab} function test() i = 1; j = 1; end \...
0
votes
0answers
45 views

tcolorbox tcblinputlisting unexpected behavior when filenames have spaces and/or underscores

I'm not a Latex expert, so I reached the limit of my knowledge in the tracking down of this problem. If someone can shed some light into this problem I think it would be very useful. The Problem ...
1
vote
0answers
49 views

How can I get consistent line spacing with highlighted, minted material in a paragraph?

I'm using a lot of inline minted material. To distinguish between code elements and text elements in my document, I'm giving everything a light background color. (The color used below is exaggerated ...
8
votes
6answers
3k views

Beamer vs. Minted: overlays

How to use beamer overlay inside minted code? The obvious solution does not work: \documentclass{beamer} \usepackage{minted} \begin{document} \begin{frame}[fragile] \frametitle{Foo} \begin{minted}...
17
votes
6answers
5k views

Red box drawn around question-mark operator in minted Erlang code

I'm trying to include some Erlang code samples in a document using the minted package which include the ? operator to denote a message being received from a process. The code \documentclass{minimal} \...
0
votes
1answer
82 views

Encoding problem?

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

How to configure tcblisting with minted to allow copy/paste from listing with whitespace characters?

This answer from a similar question gets very close to a final copy/paste solution, but does not work for me as it does not select whitespace. I am asking a new question as the linked one is several ...
3
votes
0answers
51 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 ...
3
votes
2answers
2k views

Add keyword to language in minted

I use minted to highlight some javascript code. I use \documentclass{article} \usepackage{minted} \begin{document} \begin{minted}{js} const mySchema = new Schema({ name: String, is_true: ...
3
votes
1answer
30 views

renewing the \mintinline command to disable italics (or any other alternative)

For the minted environment, you can disable italic comments / preprocessor includes etc by using etoolbox and then doing \AtBeginEnvironment{minted}{\let\itshape\relax}. Using \let\itshape\relax ...
1
vote
0answers
69 views

mintinline inside environ

\mintinline inside of an environment created by \NewEnviron of environ package seems to be strange. There are some unintended blank spaces, after the macros followed by \. What should I do to fix it? ...
2
votes
2answers
165 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} \...
1
vote
1answer
33 views

Is there something similar to \graphicspath{ {myPath} } for minted?

Basically what the title says. I would like to know if there is a way to specify a particular folder as a base folder for when you import source code files in minted.