Stack Exchange Network

Stack Exchange network consists of 174 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

2
votes
0answers
13 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
1answer
21 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
33 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
1answer
24 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.
4
votes
1answer
63 views

How to type — or >> in minted?

If I try to type -- or >> (resp. <<), LaTeX puts them together and makes one big -, respectively guillemets. How can I change that behavior? I have to use LuaLaTeX to compile my source. \...
7
votes
0answers
51 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 ...
0
votes
2answers
66 views

Color inline code

I'm able to compile the following in Overleaf for the desired inline code-coloring effect: \documentclass{article} \usepackage{minted} \usepackage{xcolor} \definecolor{codeblue}{rgb}{0,0.3,0.6} \...
2
votes
1answer
33 views

Minted Linenos not working after using RecustomVerbatimEnvironment

Currently I am trying to work with the minted package. My aim is to have a code snippet with the numbering for each line, which is centered in a figure. My top level configuration looks like ...
1
vote
0answers
41 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
1answer
36 views

In memoir and XeLaTeX, I attempted to control the environment of minted to break across pages, but the codes did not work

I use the class memoir and the packages minted and compile in XeLaTeX. Based on the questions How to let minted break across pages but keep the caption together with the end of listing? and Breaking ...
-1
votes
0answers
21 views

Using escapeinside in minted with a single character that is used for escaping

(sorry for the confusing title) I am trying to use minted to import a single Haskell code snippet that contains: data Bool = True | False By using \inputminted[escapeinside=||]{haskell}{snippet.hs}...
1
vote
1answer
37 views

Custom line-breaks in minted environment

I'm using the minted package for my code listings. I'd like to customize the line-breaks instead of using the breaklines option that does the line-breaking automatically. Unfortunately I haven't found ...
1
vote
0answers
75 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
1answer
28 views

Can backticks be written in minted?

I have a piece of code I would like to write inside a minted syntax highlighting block. The following code works: \begin{minted}[linenos]{go} ... PasswordHash string ... \end{minted} But once I ...
4
votes
0answers
36 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
41 views

How to put source code alongside its number inside table

I have to put the source code with this kind of format inside my report. I've read other questions. Most of them are just putting listing or minted inside tabular environment. But not the source code ...
1
vote
0answers
30 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 ...
0
votes
0answers
28 views

How to setup multiple listing environment names

It works with one environment name. But failed with two names and above. MWE: \documentclass{report} \usepackage[top=3cm,bottom=3cm,left=4cm,right=3cm]{geometry} \usepackage{caption} % add ability ...
3
votes
1answer
31 views

iftoggle with minted

I have a problem with the minted package in combination with etoolbox's iftoggle. It should be related (or basically be the same error) to this beamer question: minted environment in frame causes ...
0
votes
1answer
61 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 ...
1
vote
1answer
169 views

How can i write my python code in LaTeX document?

Hope you are fine! in this opportunity I'd like to ask you how can I put in my LaTeX document a python code, I was using, lsting, and anothers but I have an error, I appreciate your helping. My error ...
1
vote
1answer
39 views

Adjust top and bottom margins using minted

I've been using the listings package with the following setup to produce a compact layout of code samples: \lstset{ basicstyle=\footnotesize\ttfamily,breaklines=true, framextopmargin=50pt,...
-1
votes
0answers
21 views

Minted frozencache option throwing error without shell escape

I am using the minted package for code highlighting in my document. However, when I run it to compile my code using shell -escape my citations and hyperlinks don't compile. I need to run my tex file ...
0
votes
1answer
26 views

How to load custom minted lexer from file with czech babel

I would like to distribute my own lexer with latex sources. I use: \begin{minted}{myLexer.py:MyLexerClassName -x} setMinAndMax \end{minted} which works fine. But when I use czech babel, compilation ...
12
votes
1answer
296 views

Unwanted space in inline code with minted in beamer

Why is there a space between \documentclass and {article} in my inline code? There are no errors in the log. % arara: pdflatex: { shell : yes } \documentclass{beamer} \usepackage{minted} \newminted{...
0
votes
1answer
27 views

Conflict between \captionof and mdframed

I'm using the minted package to generate highlighted code snippets. Because I want all minted environments to be wrapped with mdframed, I added the following to the preamble. \usepackage{mdframed} \...
2
votes
1answer
113 views

Automatic line breaking in minted

I'm using the minted package to generate syntax-highlighted code snippets. The listing I want to show has some lines that overflow, though. Minted can automatically handle line breaks with the ...
3
votes
1answer
186 views

How do I set a background color and font for inline verb text?

I wish to customize the verb command such that I can customize the font and color, as well as set a rounded colored rectangle as background. I found this in the Tcolorbox manual: \DeclareTotalTCBox{\...
0
votes
0answers
38 views

match line spacing in different minted code snippents

I want to compare pseudo-code snippets from 2 made up languages side by side. I matched them in number of lines but the line spacing is different, so the lines are not aligned 1:1 even though they ...
4
votes
1answer
234 views

Advanced customization of Minted code?

I'm a newbie to LaTeX, especially the minted package. I would like to customize it such that the code has a similar style to the attached screenshot. Specifically, I wish to be able to customize: The ...
0
votes
1answer
27 views

Errors after upgrading OS and Lyx

I use Lyx everyday. Yesterday I decided to format my computer and install Xubuntu 18.04 (I had Xubuntu 16.04). After installing Lyx I am getting this errors: Although the errors, the PDF is properly ...
3
votes
1answer
56 views

workaround for minted environments in in Beamer notes

A work around for adding code to beamer notes is described here: LaTeX beamer: Code listings in notes. Here is how I've adapted it for use with Minted: \documentclass{beamer} \setbeameroption{show ...
1
vote
0answers
131 views

Trying to use minted package and getting error “Package minted Error: You must invoke LaTeX with the -shell-escape flag.” [duplicate]

I am using Windows 8.1, MiKTeX 2.9, TeXstudio. Everything including packages are fully updated. I am trying to compile this: \documentclass{article} \usepackage{minted} \begin{document} \end{...
0
votes
2answers
40 views

How to let \listoflistings of minted use subsection's subheading and appear in TOC?

I want the \listoflistings of minted to appear as a subsection heading. (My \documentclass is scrartcl.) Things like \printbibliography have a "heading" option, which you can use to define, which ...
1
vote
1answer
47 views

How to remove minted indentation level with correct latex indentation?

When writing with minted code snippets I dislike to remove indentation in latex source, so correct results are generated. Is there a way to substract latex indentation-level from minted indentation? I ...
0
votes
1answer
19 views

How can I make such an environment with '"minted'?

How can I make such an environment: \documentclass[a4paper,12pt]{report} \usepackage{minted,fancyvrb} \newenvironment{mycode}[1]{ \begin{listing} \begin{minted}{bash}}{ \end{minted} \...
2
votes
1answer
53 views

Forcing mintinline background to have the height of the line

I'm having trouble with \mintinline, because I am using a black background for it, and the characters render in a way that I find unpleasing. Namely, when doing something like: \documentclass{article}...
3
votes
1answer
42 views

Why is the # character duplicated in footnotes?

I've run into a weird issue related to footnotes. When I compile the document I pasted below, the "regular" #import statement is shown exactly as it appears in the source code. However, when I use ...
0
votes
0answers
35 views

How can I prevent the minted environment to highlight the code? [duplicate]

I'm writing a LaTeX document and I'm using the minted package to highlight the code. This is what I've written: \documentclass{report} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[...
4
votes
0answers
70 views

One tcbcolorbox with alternative color in different lines

\documentclass{article} \usepackage{geometry} \geometry{left=2.5cm,right=2cm,top=2.5cm,bottom=2.5cm} \usepackage{fontawesome} \usepackage{varwidth} % tcolorbox \usepackage[dvipsnames, svgnames]{xcolor}...
2
votes
0answers
56 views

A weird box in the code styled with minted [closed]

I use minted to style my codes in a document. But in some cases, there is a weird box in the code in which most of the time a quotation mark is encircled. The following MWE shows my problematic ...
3
votes
1answer
57 views

pass parameter #1 to minted's \mintinline, when #1 begins with `#`

I noticed the following unexpected (by me!) behaviour, illustrated by this MWE and its output in the figure below: % arara: xelatex: { shell : yes } \documentclass[11pt]{article} \usepackage{...
0
votes
1answer
111 views

A single column Listing with Minted into a two column layout document?

I have a two column document: \documentclass[twocolumn]{elsarticle} \usepackage{minted} \usepackage{caption} \captionsetup[listing]{position=top} \usepackage{listings} \begin{document} \begin{...
2
votes
1answer
85 views

Minted variables alone vs in expressions being colorized differently

We are using minted for a paper. Variable/function names are being colorized when they stand alone in inline expressions, but not when they are part of arithmetic expressions. For example, the n and ...
0
votes
1answer
48 views

minted - how to highlight html also, when language “twig” is selected

I use minted and I try to format twig-Code. But when I select twig as the code-language, it does highlight the twig code but it doesn't highlight html-code! This looks like this: Is there any way to ...
2
votes
1answer
63 views

tikz with beamer inside minted

I'm trying to define a tikz node inside a minted frame. I have the following MWE: \documentclass[tikz, xcolor={svgnames}, aspectratio=43]{beamer} \usepackage{minted} \usepackage{tikz} \...
2
votes
1answer
979 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() {...
2
votes
0answers
49 views

Read out text file until first empty line is found [closed]

Im currently writing a manual for a package and wanted to include parts of a Matlab file. I was able to display the whole file with the listings package but my goal is to only display the first part ...
1
vote
1answer
121 views

Top alignment of listings in a tabu/tabularx-environment - lstlisting/minted in a table

I want to insert code snippets into a tabular environment. For the Code snippets I'm using the package listing and to insert it into a tabular environment I put the code into a box. To get linebreaks ...
0
votes
1answer
153 views

texify.exe in TeXworks in MSWindows 10: MiKTex encountered internal error when compile with --shell-escape

I try to compile a tex text using the minted package using TeXworks and choosing the option XeLaTex+MakeIndes+BibTeX. When i try to build as is I get the error: ! Package minted Error: You must ...