{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 python-pygments (e.g sudo apt-get install python-pygments). ...

learn more… | top users | synonyms

49
votes
6answers
11k views

Syntax Coloring in LaTeX

Is there any way to include Python code in a LaTeX file and automatically color its syntax? Is it possible to do syntax coloring with any other language? If yes what packages can I use to do that?
37
votes
4answers
2k views

Has the time come for a LaTeX3 successor to 'listings'?

I'm currently looking for a nice and challenging open-source project to work/collaborate on after my thesis. I don't have a Comp. Sci. background, but I'd like to learn more about compiler ...
32
votes
2answers
2k views

minted vs. texments vs. verbments

Regarding the typesetting of syntax-colored source code, I know that listings is inferior because it doesn't utilize a full lexer. Instead the Python-based solution is recommended. It seems there are ...
20
votes
5answers
965 views

Speeding up minted compilation

I've been looking into speeding up my pdflatex compilation time and it's lighting fast now. Only one thing's still very slow: compiling source code using the minted package. I was wondering if ...
19
votes
2answers
3k 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} ...
15
votes
1answer
469 views

Can I print only some functions with minted?

I often have to print Source Code, but quite often only some parts of a project. Now I got a task to improve two functions and I have to print out what I change. I use minted for printing source code. ...
15
votes
1answer
836 views

In the minted package, how do I enforce straight single quotes?

Basically I want \mint{python}|'banana'| to produce straight single quotes, rather than the curly ones it normally produces (in pdflatex).
15
votes
3answers
1k views

How to add custom C++ keywords to be recognized by Minted?

I have defined several structures and types in a C++ project. I have to write some documentation for this code, and I use the minted package to typeset my code. I would like to be able to add some ...
15
votes
3answers
3k views

Preferred method for inline code samples

I tend to use the minted package for including code samples within my documents, which produces very nice output. However, because Pygments always produces a verbatim environment there's no way to ...
14
votes
2answers
2k views

Box around minted environment

I'm using the minted package to produce nice looking java-code but I would like to make a box around the code so it is easier to separate the code from the rest of the document. What is the easiest ...
14
votes
1answer
220 views

How does minted work from a point of LaTeX-User?

The package minted is one of the most famous package for highlighting source code. But how does it work?
14
votes
2answers
191 views

Repeating environment contents twice

I'm writing a document where I have many code blocks like so: \begin{align} d = \sqrt{ (x'-x)^2 } \end{align} \begin{minted}{latex} d = \sqrt{ (x'-x)^2 } \end{minted} So the first line renders ...
13
votes
5answers
8k 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: ...
13
votes
2answers
583 views

Combine minted and tcolorbox

I have the idea to combine minted with tcolorbox. At first, I have created my own minted environments: \newminted[mycsharp]{csharp}{tabsize=2,fontsize=\footnotesize} ...
12
votes
4answers
2k views

Using package minted with non-english characters

I would like to use LaTeX package minted to colorize my c and Cuda code. I need to write comments in the code in czech. I use package inputenc with utf-8 and czech characters (ěščřžýáíé) work good in ...
12
votes
2answers
1k views

Background colour with minted package: code misplaced

With the following example \listfiles \documentclass{article} \usepackage{minted} \definecolor{bg}{rgb}{0.95,0.95,0.95} \begin{document} Some text \begin{minted}{latex} A test \end{minted} Some text ...
11
votes
1answer
2k views

How do I import a source file using minted

Currently, I have something like this: \begin{minted}{csharp} public static void Main (string[] args) { Console.WriteLine ("Hello World!"); } \end{minted} Where the source code is copy/pasted ...
11
votes
3answers
795 views

Can I enter code directly from a source file?

In a project I'm working, all the files are in the same folder (source codes, papers, images, etc). In the documentation, I'm including some code with minted which is really great, but I want to do ...
11
votes
2answers
263 views

How can I define a new minted environment with optional arguments?

I have the following mwe: % arara: pdflatex: { shell: true } % arara: pdflatex: { shell: true } \documentclass{article} \usepackage{minted} \usepackage{listings} \usepackage{caption} ...
10
votes
2answers
1k views

How to use minted under MikTeX and Windows 7?

According to minted documentation: Windows support is sketchy / untested at the moment. There are two complications: installation and usage....... This question seeks a step by step ...
10
votes
2answers
1k views

Inline code and short verb with minted

I it possible to use minted for inline code and to add a short verb sing for minted? Like \lstMakeShortInline| in listings.sty? \documentclass{article} \usepackage{minted} \newminted{tex}{} ...
10
votes
3answers
1k 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 ; ...
10
votes
2answers
2k views

Breaking long lines using latex with minted and pygments

Since Acrobat obviously isn't able to convert XML to PDF from command line, I'm trying to achieve it using LaTeX. I found the minted package doing a quite good (and simple) job since it uses pygments ...
10
votes
1answer
6k views

How to enable shell-escape in TeXworks?

I require use of the minted package of similar one which support Prolog syntax-highlighting. Given that I use the TeXworks "IDE", how do I enable shell-escape? Though I attempted—see above—I still ...
10
votes
1answer
237 views

Remove blank lines in minted

Is it possible to remove blank (empty) lines in minted, and gobble multiple blank lines to a specified amount, like the emptylines option in listings? \documentclass{article} \usepackage[T1]{fontenc} ...
9
votes
3answers
151 views

Fancy code environment

I'm writing a small tutorial about LaTeX. So I'd like to insert some code and obtain the result on the right. I'm almost there. I got the desired output but I'd like something more clear, that is, ...
9
votes
1answer
2k views

How to customize the default xelatex command in TexShop for OSX

I am trying to make use of the minted package for source code highlighting, and am running into an error telling me I need to install pygmentize combined with an message regarding the --shell-escape ...
9
votes
1answer
501 views

Reference Code snippet in latex using minted

I'm not really sure how to reference a code snippet in my text. I need also a caption for the code. The only working way I found is wrapping the minted in a figure. The problem is that I want to ...
8
votes
2answers
104 views

Emphasise a particular keyword in minted

In minted, how do I highlight a particular set of keywords by making them bold. Say for example consider the MWE, \documentclass[a4paper , 12pt]{article} \usepackage{minted} \usemintedstyle{manni} ...
8
votes
3answers
5k views

How to put C++ source code into beamer slides [duplicate]

Possible Duplicate: How display LaTeX code in LaTeX document? How do I fit java style source code in one frame in beamer? How do I add C++ formatted and coloured source code to my beamer ...
8
votes
1answer
1k views

Package to indent and syntax highlight C++ code

I am looking for a package to have an environment for C++ source code, with options for syntax highlighting, automatic indentation, proper multipage behavior, etc. I read something about the listings ...
8
votes
1answer
163 views

Problem in adding a background color in a minted environment

I want to add a background color to the minted environment in my LaTeX document. However, when I add the the background color the environment does not start in a new line. Could someone help me fix ...
8
votes
1answer
357 views

How can I make source code included with minted copyable?

Is it possible to make source code with minted copyable? Here is a minimal example how I include source code (completely, with minimal java code, on GitHub): \documentclass{beamer} ...
8
votes
1answer
803 views

Using minted and tabs

I just started using the minted package. When I insert tabs as indentation, it gives me a bunch of characters instead: However, when I copy the example from the documentation it seems to work fine. ...
8
votes
1answer
1k views

Set global options for \inputminted

I am using the minted package to highlight source code. How can I set the options parameter globally for \inputminted? I want to do this because I have a lot of php code files that I will include in ...
8
votes
1answer
127 views

Formatting code fragments extracted from file with minted

I would like to use the catchfilebetweentags package to grab code snippets from a source file and use minted to highlight them. Imagine I have the following in program.scala: //<a def ...
7
votes
2answers
887 views

minted truncates the code if it doesn't fit into one page

minted works well when the code snippet is short, or fit into one page. The problem occurs when I pasted a code snippet with several hundred lines. Sometimes it processed but the output was truncated; ...
7
votes
1answer
608 views

Use autoref with minted and its listing environment

I would like to use autoref from the hyperref package to create a reference to a floating listing as provided by minted. This code \documentclass[a4paper]{book} \usepackage{minted} ...
7
votes
2answers
1k views

How to place two code snippets next to each other with minted?

The minted package for code highlighting comes with a float environment called listing. Now I would like to place two of this code listings next to each other, but I have no idea how to do this. I ...
7
votes
1answer
175 views

Double #s when defining a new command that uses \mint instead of using \mint directly

Why does \dollarcom give a different result than \mint{bash}|$#|? \documentclass{article} \usepackage{minted} \newcommand{\dollarcom}{\mint{bash}/$#/} \begin{document} \dollarcom \mint{bash}|$#| ...
7
votes
2answers
1k views

minted's listing environment with hyperref and caption package together

I use the minted package for code highlight. I use its listing environment. I also use the hyperref package to provide links all through my document: figures, tables, listings, etc. If I import the ...
7
votes
1answer
984 views

Using minted to define a new environment

Can I define a newenvironment that has inside it a minted environment? eg and environment that would be a quickhand for the following code: \begin{figure}[htp] \centering ...
7
votes
2answers
920 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} ...
7
votes
1answer
290 views

Insert Text between “List of XXX” Heading and Actual Listing

I would like to insert a small paragraph of text between the "List of Figures" heading and the actual list of figures, and also between "List of Listings" and the actual list of listings. I am using ...
7
votes
3answers
240 views

Expanding a minted command inside a macro

I am currently trying to speed up the compile time of a document that uses minted. I would like to be able to have certain language features (and style) appear the same in both a minted environment ...
7
votes
1answer
340 views

polyglossia and minted - The current roman font does not contain the Hebrew script!

Trying to use minted with Hebrew as the default language with polyglossia: \documentclass{article} \usepackage{minted} \usepackage{polyglossia} \setdefaultlanguage[calendar=hebrew, ...
7
votes
1answer
411 views

Clean black & white style for minted

I'm using minted to format code in a book. Except for the bw theme, I only see colored styles, which is nice for producing a PDF, but not ideal for printing in black & white. Is there a clean ...
7
votes
1answer
603 views

References to specific lines in program source code

How do I make references to specific lines in program source code (e.g. Python)? For example, I want to say: In lines 22-30, the algorithm is implemented... If I changed the Python source code, ...
7
votes
1answer
700 views

Using Vim Latex-live-preview with minted package

I was wondering if anyone had succeeded to make vim-live-preview with the package minted. When I tried to edit the pdflatex command winthin the script.vim by adding the -escape-shell switch, but ...
7
votes
1answer
1k views

LaTeX minted package: numbering lines does not work [closed]

I'm having a problem with the minted package. When I try to add line numbering to the minted command, I get the following error: ! Package keyval Error: stepnumber undefined. See the keyval package ...