I'm trying to insert a \circ inside a minted block of code, to emit the following: g ∘ f:

g |\circ| f

I was trying to follow the minted documentation, and attempted to do it inside a escapeinside, but without much success, I get an error:

<inserted text>
l.2 \PYG{n+nf}{g} \PYG{esc}{\circ} \PYG{n}{f}

Am I holding it wrong? Is there a better way?

  • tested and works! marking as duplicate
    – koleygr
    Sep 4, 2017 at 14:29
  • @koleygr thanks for the answer! Unfortunately it didn't work, if I replace |\circ| with just $\circ$, I get: g \$\circ\$ f rendered. If I place it inside the ||, I get the same error (p.s. I fixed the error indentation, it was pasted wrong before) Sep 4, 2017 at 14:36
  • I just tested with: g |$\circ$| f and works fine
    – koleygr
    Sep 4, 2017 at 14:38
  • 1
    I tried both with latex and xelatex using my MWE. If you tried my last comment code inside your minted environment as you have give it to as and still doesn't work, then please provide a MWE because something else causes the problem. See here how: tex.meta.stackexchange.com/questions/228/…
    – koleygr
    Sep 4, 2017 at 14:56
  • @koleygr thank you for the answers! I'll try to come up with an MWE Sep 4, 2017 at 14:59


Browse other questions tagged or ask your own question.