Hot answers tagged

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 ...
cabohah's user avatar
  • 9,371
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 ...
egreg's user avatar
  • 1.1m
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 ...
Skillmon's user avatar
  • 57.8k
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 ...
fullStackChris's user avatar
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'...
Guy Weizman's user avatar
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} \...
ABV's user avatar
  • 547
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} \...
Titus Rotich's user avatar
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[...
Andy's user avatar
  • 181
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 ...
David Carlisle's user avatar
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{...
gusbrs's user avatar
  • 13.4k
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{...
egreg's user avatar
  • 1.1m
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 ...
Donald Duck's user avatar
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{...
Rubem Pacelli's user avatar
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}}}...
David Carlisle's user avatar
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 ...
Jul's user avatar
  • 51
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@...
samcarter_is_at_topanswers.xyz's user avatar
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} ...
hpekristiansen's user avatar
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}[...
Zxcvasdf's user avatar
  • 1,715
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\...
David Carlisle's user avatar
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} \...
Marijn's user avatar
  • 36k
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, ...
TheProgrammer's user avatar
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, ...
mbert's user avatar
  • 3,440
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 ...
user691586's user avatar
  • 1,958
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 ...
David Carlisle's user avatar
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&...
olirwin's user avatar
  • 293
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} \...
samcarter_is_at_topanswers.xyz's user avatar
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. \...
F. Pantigny's user avatar
  • 38.5k
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} \...
samcarter_is_at_topanswers.xyz's user avatar
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 ...
user691586's user avatar
  • 1,958
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 ...
Marijn's user avatar
  • 36k

Only top scored, non community-wiki answers of a minimum length are eligible