I'm making a set of notes with Tufte-latex in screen
mode with a giant 8cm margin. There is plenty of room over there for code blocks, but minted doesn't work. There is an answer here but it doesn't actually put the code block in the margin...
\documentclass{tufte-book}
\usepackage{minted}
\usepackage{lipsum}
\geometry{screen,textheight=135mm,textwidth=10cm,marginparsep=1cm,marginparwidth=8cm}
\begin{document}
\section{Here's some code}
\begin{minted}{python}
import numpy as np
def incmatrix(genl1,genl2):
m = len(genl1)
n = len(genl2)
M = None #to become the incidence matrix
VT = np.zeros((n*m,1), int) #dummy variable
#compute the bitwise xor matrix
M1 = bitxormatrix(genl1)
M2 = np.triu(bitxormatrix(genl2),1)
\end{minted}
\marginnote{I want the code over here. But it doesn't work!}
\end{document}