1

I really love the "callout" functionality that can be added to source code listings in AsciiDoc http://asciidoc.org/chunked/ch20.html. I was wondering if there is a LaTeX package that can do the same. I currently am using the 'minted' package for source code listings, and would like for it to be compatible with that package if possible.

Thanks

  • 1
    minited simply passes everything as-is to Pygmentize, so won't I think help here. Is using listings an option? It has the concept of leaving some char available for 'escape' so can allow some active code in otherwise verbatim material. – Joseph Wright Apr 21 '17 at 8:30
3

Found out a way to it is to use the pifont and color packages in the following way:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{minted}
\usepackage{pifont}
\usepackage{color}

\begin{document}

\begin{minted}[escapeinside=||]{python}
import numpy as np

def incmatrix(genl1,genl2):
    m = len(genl1)
    n = len(genl2)
    M = None #to become the incidence matrix | \textcolor{black}{ \ding{182} } |
    VT = np.zeros((n*m,1), int)  #dummy variable

    #compute the bitwise xor matrix
    M1 = bitxormatrix(genl1)
    M2 = np.triu(bitxormatrix(genl2),1) 

    for i in range(m-1):
        for j in range(i+1, m):
            [r,c] = np.where(M2 == M1[i,j])
            for k in range(len(r)):
                VT[(i)*n + r[k]] = 1;
                VT[(i)*n + c[k]] = 1;
                VT[(j)*n + r[k]] = 1;
                VT[(j)*n + c[k]] = 1;

                if M is None:
                    M = np.copy(VT)
                else:
                    M = np.concatenate((M, VT), 1)

                VT = np.zeros((n*m,1), int)

    return M
\end{minted}

\ding{182} Here is have a comment

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.