{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). ...
44
votes
6answers
7k 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?
20
votes
4answers
720 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 ...
15
votes
2answers
300 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 ...
15
votes
1answer
283 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
2answers
2k 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
3answers
2k 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
133 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 ...
12
votes
3answers
624 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 ...
12
votes
2answers
918 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
...
10
votes
3answers
557 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 ...
10
votes
1answer
286 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).
9
votes
2answers
100 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}
...
9
votes
4answers
1k 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 ...
8
votes
4answers
4k 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:
...
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
3answers
724 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 ; ...
8
votes
1answer
191 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
177 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
1answer
485 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. ...
7
votes
2answers
135 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 ...
7
votes
2answers
621 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
3answers
1k 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 ...
7
votes
1answer
107 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
1answer
730 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 ...
7
votes
1answer
168 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
169 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
263 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
2answers
528 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
880 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 ...
7
votes
0answers
101 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}
...
6
votes
2answers
374 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 ...
6
votes
2answers
472 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; ...
6
votes
1answer
698 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
...
6
votes
2answers
569 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}
...
6
votes
2answers
1k 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 ...
6
votes
1answer
749 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}{}
...
6
votes
1answer
411 views
Is it possible to find methods in source code using \inputminted?
My document MWE:
\documentclass[12pt,a4paper]{mwrep}
\usepackage{minted}
\begin{document}
\inputminted[gobble=4,firstnumber=3,firstline=3,lastline=9,linenos,tabsize=4]{java}{Foo.java}
\end{document}
...
6
votes
1answer
402 views
Make the vim minted style use light terminal-like highlighting instead of dark
Whenever I'm highlighting code with the minted package, I use \usemintedstyle{vim}, which looks okay aside from the fact that it looks like a dark VIM color scheme applied onto a light background and ...
5
votes
1answer
833 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 ...
5
votes
3answers
443 views
How can I produce black and white source code using the minted package?
I just started using the minted package, to produce formatted source codes.
I thought the style bw is a black and white style of pygmentize and it just uses italic and bold to format the code (I ...
5
votes
2answers
771 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 ...
5
votes
1answer
494 views
How to get caption above listing with minted?
I'm using the minted package. How can I get the caption to show before the code in the document?
\documentclass[a4paper]{scrartcl}
\usepackage{minted}
\begin{document}
\begin{listing}[H]
...
5
votes
4answers
769 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}
...
5
votes
1answer
410 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}
...
5
votes
1answer
134 views
Error caused by interaction between minted, footnotes, babel and "(double quote)
I'd like to put some inline code using minted but when I try to typesent the empty string "" I get an "undefined control sequence" error.
Sample code:
\documentclass[a4paper,10pt]{article}
...
5
votes
2answers
98 views
Error using Minted for syntax highlighting in custom document class
I am writing Master thesis in LaTeX and want to use minted package for source code syntax highlighting. I have installed it successfully and minimal example from minted documentation works just fine.
...
5
votes
1answer
107 views
linenumbers of minted are not shown in beamer if i use infolines
linenumbers of minted are not shown in beamer if i use infolines as an outertheme
example:
\documentclass{beamer}
\usepackage{minted}
\usetheme{Warsaw}
\useoutertheme{infolines}
...
5
votes
1answer
958 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 ...
5
votes
1answer
204 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, ...
5
votes
1answer
264 views
Is it possible to compile minted under Emacs?
I am trying to use minted package... Here is an example minimal.tex:
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
int main() {
printf("hello, world");
return 0;
4
}
...