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
0answers
16 views

Getting a proper reference number with \ref while using custom counter and environment

I am trying to make a reference-able environment with its own counter, that I later refer to in text. I want the counter of my environment to have the style Chapter.Number . I have been able to make ...
3
votes
0answers
32 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 ...
1
vote
1answer
37 views

Decorate minted listing inside a tcolorobox [Merly done…]

I would like to decorate some listings just for pedagogical reasons. Here is a starting code where I can draw a line but I still fail to produce a frame. How can I do that ? \documentclass[12pt,...
1
vote
1answer
27 views

Latex keeps showing minted environment as Figures instead of Listening

I am trying to use "Figure" as name of listings in listoflistings with minted and newfloat fix, but it does not work. Latex keeps showing minted environment as Figures instead of Listening: ...
0
votes
0answers
28 views

Minted custom code highligt of FIXME

I would like to highlight everything after the keyword "FIXME:" similar to the way Jet-brains does it in their IDEs, where the text "FIXME:" and the following rest of the line is another color At ...
0
votes
0answers
38 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
27 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
1answer
47 views

Write Farsi in minted environment Latex

I'm using overleaf to write my document and I need to list some python code in minted environment that contains Farsi words as follows: \begin{minted}[bgcolor=bg]{python} >>> ...
0
votes
0answers
52 views

Minted; make text non selectable on output pdf?

Context: I want to build a coding exercice for some people. I use minted to render code. I don't want people to copy/paste the code but to write it down instead. Question: How could I say to minted ...
0
votes
0answers
23 views

Using minted within a subfile to list a code in a subdirectory

I am using Windows as OS and TeXstudio as editor. My project has the following structure: -project -main.tex -chapter1 -chapter1.tex -bibgraf.bib -figures -...
0
votes
0answers
20 views

Incompatibility between import and minted?

minted doesn't seem to work with import using \subimport*. Is there a way to fix that because I'm becoming addicted to the package import? Main file \documentclass[12pt,a4paper]{article} \...
0
votes
1answer
27 views

Mint code inline reading from file

Is there a way to mint a line of code inline, where the code is read from a file? \mintinline can only typeset code that is passed directly to the command, in between two delimiters (e.g. \mintinline{...
0
votes
0answers
24 views

Listing inside table

I've tried to make table with minted listing inside using minipage, but my listing takes up more than one page and it turns out that part of the text is cut off, is it possible to make minipage for ...
0
votes
1answer
39 views

Using minted to highlight single word

for example, if I want to write: \usepackage{minted} My parents gave me some money. I walked in the shop and found some sweets that I liked. I decided to buy them. In the above text how do I used ...
0
votes
1answer
33 views

Using mdframed with inputminted

I was reading the documentation of minted and found out I could use mdframed to create a frame around my code listings using: \surroundwithmdframed{minted} However, I now need to create listings ...
0
votes
1answer
38 views

minted: Unicode characters in listing

MWE: \documentclass{article} \usepackage[a4paper]{geometry} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{xcolor} \usepackage{minted} \begin{document} \begin{minted}[breaklines]{...
0
votes
0answers
27 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 ...
6
votes
1answer
94 views

Which colors are these? (minted package)

I am using code Highlighting for Python 3.7 with the minted package. I am using the tango color scheme (you can see all the color schemes minted uses in this page). I want to know the hex/rgb/cymk ...
4
votes
1answer
73 views

Modify space before and after minted text

I have to write an article with many blocks embedding equations and the output from R. I've decided to use the package minted for everything as the best option to avoid complex formating. I've also ...
2
votes
0answers
203 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 ...
0
votes
0answers
23 views

Specify first and last line by matching text with \inputminted (minted package)

I use the minted package which is similar to the listing package but provides richer highlighting. Both have a command to include some lines from an external source code file. With the listing ...
1
vote
1answer
53 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
42 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{...
2
votes
1answer
66 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
20 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
57 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
60 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
78 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
39 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
58 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
45 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 ...
1
vote
0answers
27 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
33 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
104 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
77 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
25 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
122 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
32 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
51 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 ...
1
vote
1answer
49 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
33 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
73 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
141 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} \...
1
vote
0answers
64 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
48 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
50 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
31 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
41 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
21 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
36 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} \...