8
votes
Accepted
Package minted and tcolorbox produces LaTeX Error: Command \gather already defined
This is because of package lineno. The current version patches environment gather even, if it has not been defined before. So amsmath cannot be loaded after lineno any longer. So, because tcolorbox ...
6
votes
Accepted
'Too deeply nested' error in `\renewcommand`
This is a well-known problem with \let.
When you ask for \show\inputminted you'll be told that
> \inputminted=macro:
->\@protected@testopt \inputminted \\inputminted {}.
The macro doing the ...
5
votes
Accepted
Package keyval Error: breakaftergroup undefined
The issue is that minted sets up breakaftergroup to be an option forwarded to fvextra. But fvextra doesn't have a breakaftergroup option since version 1.5 (released on 2022-11-30) anymore.
You can ...
4
votes
Emojis with lualatex
As Ulrike and David guided, it was indeed due to not having a font that supported emojis. Since for now the emojis are only found in my code snippets in my document, I only needed to change my ...
4
votes
Accepted
wrong directionality in minted environment
As Udi suggested in the comments
Try adding \begin{LTR} before \begin{minted}, and \end{LTR} after \end{minted}. Usually, LyX does it by default if you use the minted environment from the GUI and don'...
3
votes
Accepted
Setting colorbox highlight and node area for musix environment using Beamer with Musixtex
According feedback, It has been solved using the following code:
\documentclass[aspectratio=169]{beamer}
\usepackage{musixtex}
\usepackage{minted}
\usemintedstyle{borland}
\usepackage[T1]{fontenc}
\...
3
votes
Package minted and tcolorbox produces LaTeX Error: Command \gather already defined
Because of package dependencies, it might not be obvious which package loads what. Using \RequirePackage might be a safer option as it ensures amsmath is always loaded first.
\RequirePackage{amsmath}
\...
3
votes
Use minted code for moodle questions
Thanks Rmano for the hint to the repo. I checked it out and amazingly, minted support is in version 1.0 included. Thus, all I had to do was update my packages and now this code works:
\documentclass[...
3
votes
Accepted
Which font should I use to get Julia's code with bold letter using minted in xelatex/lualatex?
You need a font with the Unicode math alphabets. I use Stix Two Math here. Simplest is to use it directly, as here, and give up monospace. You could in principle make a Lua virtual font that enforced ...
3
votes
How to teach \cref to refer to lines inside "minted" environments?
I don't know if that's a possibility for you, but zref-clever can handle the case:
\documentclass{article}
\usepackage{minted}
\usepackage{zref-clever}
\AddToHook{env/minted/begin}{\zcsetup{...
3
votes
Accepted
Hack 'minted' definition with NewTCBListing und RenewDocumentEnvironment
Update
After seeing your edit, the comment is “D'oh!”.
\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage[minted]{tcolorbox}
\usepackage{minted}
\usepackage{hyperref}
\setminted{...
2
votes
Package minted Error: Missing Pygments output
For me this was due to two seperate problems: I didn't have enough privileges to run pygmentize, and I specified an -aux-directory argument to pdflatex without telling minted to look for the output ...
2
votes
Which font should I use to get Julia's code with bold letter using minted in xelatex/lualatex?
Just a additional info: You can also use this site to help you to see fonts with math glyphs. For instance, I will put here the code by using JuliaMono font
\documentclass{article}
\usepackage{...
2
votes
Unicode characters and subscripts in minted python
You forgot math mode for pi (there is no problem with the subscripts)
\documentclass{article}
\usepackage{newunicodechar}
\newunicodechar{π}{\ensuremath{\pi}}
\newunicodechar{₀}{\ensuremath{{}_{0}}}...
2
votes
Accepted
Minted: Using command for used language with inputminted
@PolDellaiera thanks for digging into this! As pointed out by some nice guy named muzimuzhi in your issue, this is seems to be a bug introduced with minted v2.7. In this issue a workaround is proposed ...
2
votes
Concise way of stepping through code in beamer
You could use the lstlinebgrd package (with a patch from https://tex.stackexchange.com/a/451538/36296)
\documentclass{beamer}
\usepackage{listings}
\makeatletter
\let\old@lstKV@SwitchCases\lstKV@...
2
votes
Accepted
Putting minted code inside TikZ node causes missing \item error
You can wrap it in a minipage like this
\documentclass[tikz, border=1cm]{standalone}
\usepackage{minted}
\begin{document}
\begin{tikzpicture}
\node {
\begin{minipage}{\textwidth}
\begin{minted}{perl6}
...
2
votes
Accepted
How do I use a section counter inside a tcblisting?
Simply use auto counter, number within=section.
\documentclass{article}
\usepackage{etoolbox}
\usepackage[minted,skins]{tcolorbox}
\newtcblisting[auto counter, number within=section]{MySchemeListing}[...
2
votes
Using python 3 or specifying python executable path to use minted package?
Pygments works with python3 (unless you have an ancient copy)
If you choose not to install pygmentize in your system path you can redefine \MintedPygmentize to be the full path eg
\renewcommand\...
2
votes
Syntax highlighting doesn't work after percent symbol %
You could also preprocess the code with Knitr, see How to build Knitr document from the command line for example. Code:
yourfile.Rnw
\documentclass{article}
\usepackage{xcolor}
\begin{document}
\...
2
votes
Accepted
How can I modify my tcblisting to show input code and the expected output side-by-side?
I decided to use a tcolorbox and cut my losses via a lstlisting.
\documentclass{article}
\usepackage{listings}
\usepackage{etoolbox}
\usepackage[minted,skins]{tcolorbox}
\tcbuselibrary{listings, ...
2
votes
JetBrains arrow `->`, `<-` code ligatures do not apply consistently in different environments
The characters for which ligatures are disabled in verbatim environments is controlled by \verbatim@nolig@list; its default definition is \do\‘\do\<\do\>\do\,\do\’\do\-. To allow all ligatures, ...
2
votes
'Too deeply nested' error in `\renewcommand`
do-it-yourself-way (may be broken if LaTeX kernel change)
\documentclass{article}
\usepackage{minted}
\usepackage{mdframed}
\makeatletter
\expandafter\let\expandafter\inputmintedorig@internal
...
2
votes
Accepted
Is there a way to confine the effect of \XeTeXinterwordspaceshaping=2 to a paragraph within a page?
Elsewhere in the email thread that you link to, the behaviour of setting 2 is described as:
These cases are addressed with \XeTeXinterwordspaceshaping=2. With this value, not only are inter-word ...
2
votes
Minted Not Working Package error shell escape
The minted package calls a Python program to parse and highlight the source code you give it.
In order to allow the LaTeX compilator to call this program, you have to allow for "shell escapes&...
2
votes
Accepted
How to make minted work inside custom environments?
Use a custom environment and not a macro:
% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}
\documentclass{beamer}
\usepackage{minted}
\...
2
votes
Weird coloring with @ symbol (LaTeX Minted for Python)
For information, the package piton (which is able to format Python listings) detects @ as an operator of Python.
The package piton does not use any external program but requires LuaLaTeX.
\...
2
votes
Accepted
Interaction between minted and beamerswitch
The beamerswitch documentation has an example on page 6 on how to enable shell-escape for spawned processes:
\newcommand*{\SpawnedCompiler}{latexmk -silent -shell-escape -interaction=nonstopmode}
\...
1
vote
Accepted
Minted: colorize variable in inline mode
I don't think this is possible. To start with your mark-up must convey to Pygments the info that myClass is a class object name. Perhaps while registering a dedicated lexer with Pygments which will ...
1
vote
Accepted
Minted Highlight code with multiple colors
Within a minted environment you can escape to LaTeX using the escapeinside option to change the highlight color. This requires that you set the color globally using \xglobal and that you don't use the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
minted × 1000listings × 148
code × 78
tcolorbox × 75
pygments × 64
beamer × 57
python × 42
environments × 40
highlighting × 39
verbatim × 37
xetex × 36
captions × 35
pdftex × 27
tikz-pgf × 26
errors × 26
sourcecode × 26
syntax-highlighting × 26
color × 25
luatex × 22
floats × 21
macros × 20
fonts × 18
unicode × 18
fancyvrb × 18
page-breaking × 17