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.

9
  • 2
  • Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. Mar 15, 2013 at 8:23
  • @texenthusiast- How can i set all the options that are in minted documentation using fancyvrb? I want to set minted parameters like: gobble, funcnamehighlighting, label, labelposition etc. Can i set this options trought fancyvrb inside a custom made class?
    – Starlays
    Mar 15, 2013 at 8:26
  • @Starlays minted is based on fancyvrb, fancyvrb options are controlled by \fvset{..} and minted options via Defining shortcuts using \newminted{..}{..}. Mar 15, 2013 at 8:54
  • @texenthusiast it is ok if i define shortcuts in my class file? As i said, i want to define the default formats for minted so i will not make the same settings for each code listing... i am a beginner and i want to learn, i need to understand how things are working so if you can give me some commands so i can document it will help me a lot.
    – Starlays
    Mar 15, 2013 at 13:40

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .