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

6
votes
0answers
83 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
0answers
904 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 ...
5
votes
0answers
130 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 ...
5
votes
0answers
421 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, ...
4
votes
0answers
67 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
106 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{...
4
votes
0answers
371 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 ...
4
votes
0answers
501 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
0answers
547 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
111 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 ...
3
votes
0answers
91 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
375 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
722 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
145 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}% ...
2
votes
0answers
312 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 ...
2
votes
0answers
396 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
104 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
332 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
92 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
223 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
238 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
363 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
42 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
0answers
60 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
58 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
58 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 ...
1
vote
0answers
45 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 ...
1
vote
0answers
83 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? ...
1
vote
0answers
60 views

tcolorbox listing in XeLaTex compiler

I want to write a document whose main language is Arabic with listings by using the package \usepackage{polyglossia} \documentclass[14pt]{extarticle} \usepackage[listings,minted,breakable,skins]{...
1
vote
0answers
140 views

Can the command \minted and \mintinline have rounded corners without depending on the package listings? Are tcolorbox and tikz needed?

I use XeLaTeX, but I can not use both or similar or duplicate packages, because someone said it is bad idea in XeLaTeX. I would like to use only minted. Here are two answers which offer inline code ...
1
vote
0answers
69 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 ...
1
vote
0answers
871 views

Error compiling with minted package

I'm trying to use the minted package in a document. When I compile the document I get the following error: The minted package is installed under MiKTeX, and Pygemnts is also installed (when I -m pip ...
1
vote
0answers
206 views

minted background color from left to right page side

I use minted package to get syntax coloration with background color. I know it is highly printer-unfriendly but I use it. My goal is to make the background rectangle color take the wool page width. ...
1
vote
0answers
426 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. ...
1
vote
0answers
690 views

minted is not working with Lyx but working with TeXstudio

As the title says: I have minted and pygments installed on my Macbook. When I try to use minted in TeXstudio, all things work well, but with Lyx I inserted this TeX code into my document: \begin{...
1
vote
0answers
155 views

Problem with `escapeinside` when implementing pascal code

Actually I’m working on some pascal documentation but I noticed that some features that need escapeinside option did not work well. Surprisingly, when I changed the language (to phyton or another) and ...
1
vote
0answers
906 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 ...
0
votes
0answers
12 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....
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
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 ...
0
votes
0answers
47 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 ...
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
23 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
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
0answers
36 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
0answers
26 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
277 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
60 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
56 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 ...
0
votes
0answers
54 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 ...