{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?
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 ...
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 ...
7
votes
1answer
980 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 ...
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: ...
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 ...
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} ...
4
votes
1answer
223 views

Can the listings package be set up to highlight Prolog code like minted does?

I am interested to know how listings can be customized to mimic the Pygments's Prolog lexer (i.e. make Prolog code represented by listings look the same as it is done with minted) I previously asked ...
15
votes
1answer
830 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).
7
votes
2answers
882 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; ...
5
votes
2answers
3k views

minted not working on mac

I am using texmaker on a Mac and I tired to use the minted package with this code \documentclass[12pt,A4]{article} \usepackage{minted} \begin{document} \begin{minted}{python} def __init__(self, ...
7
votes
2answers
919 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} ...
5
votes
1answer
647 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
1answer
753 views

New environment with minted

I want to create a new environment to transform this: \begin{listing} \caption{some caption} \label{code:label} \begin{minted}[options]{language} My code here \end{minted} \end{listing} ...
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 ...
3
votes
1answer
1k views

Showing only specific lines using the listings package

I am very new to TeX. My source code is in an external file, let's call it source.java, and I use \lstinputlisting{source.java}. How could I use only the lines 3-5 for my code listing? (and not the ...
1
vote
1answer
242 views

minted Environment Inside minipage Environment

I am having to use the minted environment inside a minipage environment quite often in my document. I wanted to write a new environment for doing this, but since minted isn't designed to be included ...
1
vote
1answer
182 views

How to embed a minted environment inside a tabular environment?

I'm using packages minted and booktabs, and would like to put a minted environment within a tabular one. However, the following does not work: \documentclass[11pt]{article} \usepackage{minted} ...
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 ...
13
votes
2answers
580 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} ...
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 ...
20
votes
5answers
963 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 ...
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 ...
8
votes
1answer
355 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} ...
11
votes
2answers
262 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} ...
8
votes
1answer
800 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
2answers
103 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 ...
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 ...
3
votes
0answers
333 views

The [H] “put it here” placement option doesn't work with floatrow [closed]

I'm using the minted, floatrow, caption, and listing packages to create code blocks like these: To do this, I'm using a hack based on this answer. Here is what I have: ... \usepackage{listings} ...
3
votes
1answer
615 views

Wrapping minted in a Tikz box with a command

I'm familiar with the Defining a command for a minted environment question. In addition to defining the mint parameters I also want to wrap the minted code inside a Tikz box for its nice looks. I've ...
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 ; ...
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 ...
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 ...
5
votes
3answers
3k views

How to invoke latex with the -shell-escape flag in TeXMakerX?

This is a follow-up question on the post: Creating a table around a java script code highlighted using minted where invoking -shell-escape flag in TeXStudio is one of the two questions posted by the ...
4
votes
1answer
884 views

Defining a command for a minted environment

How can I define a newcommand macro or an environment for minted? What is causing the problem that the following does not work? \newcommand{\CppSourceCode}{ \begin{minted}[linenos=true, mathescape, ...
4
votes
2answers
724 views

pass “global” options to minted/fancyvrb

Is there a way to override default options for the minted environment, rather than having to specify them for each and every snippet of code ? In other words, is there an equivalent to listings's ...
3
votes
1answer
147 views

Error when compiling a 'minted' listings inside a 'memoir' subfloat

I'm trying to compile the following minimal example: \documentclass{memoir} % Enable subfloats within figures \newsubfloat{figure} \usepackage{minted} \begin{document} \begin{figure} \subbottom{% ...
3
votes
1answer
401 views

Belowskip on minted?

Is it possible to remove the spacing below the code of a minted environment? When I have a block of code underneath another it doesn't produce any spacing (which is what I want), but it does for text ...
2
votes
0answers
123 views

PL/pgSQL and minted [closed]

When using Minted to highlight a PL/pgSQL script, I get following error: TypeError: 'NoneType' object has no attribute '__getitem__' (File '%pythonpath%/scripts/pygments/formatters/latex.py', line ...
1
vote
1answer
722 views

Minted working from terminal but not Texpad [duplicate]

Possible Duplicate: minted not working on mac I'm using the minted package in latex on my mac (running lion). Now when I use the terminal to type pdflatex -shell-escape MintedProblem.tex ...
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 ...
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 ...
6
votes
4answers
1k 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} ...
4
votes
1answer
43 views

Minted Environment inside Tabular

I want to create a table with Tabular and put a minted environment into it, just like here: How to embed a minted environment inside a tabular environment?. However, as shown in that post, the minted ...
4
votes
2answers
112 views

How to make a minted code listing centered on a page?

So, I am writing a report with Prolog code listings in it. I have been using lstlisting to make my listings and I made my code centered on the page, such as this: \renewcommand{\figurename}{Listing} ...
4
votes
1answer
410 views

Creating a table around a java script code highlighted using minted

I would like to create a block around javascript code in latex. I use minted package for format highlighting. Here is my example code: \documentclass[]{article} \usepackage{minted} %opening ...
3
votes
1answer
309 views

Error when using minted package and -output-directory option

I am having problem when I use the -output-directory option while I am using minted. It does not move the .out.pyg and .pyg file to the output directory and it gives me an error. I there any ...
3
votes
1answer
192 views

Minted shows formatted tex code instead of intended source

I use WinShell with PDFLatex on Windows 7. I managed to install Pygmentize and compile the minimum example without errors: \documentclass{article} \usepackage{minted} \begin{document} inline: ...
2
votes
1answer
591 views

minted list of listings and TOC conflict

I am using minted for source code highlighting. I want a List of Listings, and I want the List of Listings to itself have an entry in the main Table of Contents. I thought I could do this with ...