1

Is there a way that I can set minted options inside a class? I want to set my own defaults format for minted inside a custom class that I have.

Starlays
  • 353
  • 1
  • 2
  • 8

1 Answers1

1

I solved the problem by using shortcuts.

I have done like so in my .cls file:

...
%php syntax highlight
\RequirePackage[chapter]{minted}
\definecolor{mintedbackground}{rgb}{0.95,0.95,0.95}
\newmint{php}{
bgcolor=mintedbackground,
fontfamily=tt,
linenos=true,
numberblanklines=true,
numbersep=12pt,
numbersep=5pt,
gobble=0,
frame=leftline,
framerule=0.4pt,
framesep=2mm,
funcnamehighlighting=true,
tabsize=4,
obeytabs=false,
mathescape=false
samepage=false, %with this setting you can force the list to appear on the same page
showspaces=false,
showtabs =false,
texcl=false,
}
...

And in my .tex document i have done like this:

....  
 \begin{document}
     \begin{listing}[H]
         \begin{phplisting}
 <?php
 $foo = 'bar';

 class foobar
 {
     //some var that can be accesed from outside
     protected $bar = 'foo';

     public function getvarvalue() {
         return $bar;
     }
  }
        \end{phplisting}
     \caption{Example of a listing.}
    %\label{lst:example}
    \end{listing}
\end{document}
Starlays
  • 353
  • 1
  • 2
  • 8