Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Welcome to TeX.sx! –  texenthusiast Mar 15 '13 at 8:09
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. –  Claudio Fiandrino Mar 15 '13 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 '13 at 8:26
    
@Starlays minted is based on fancyvrb, fancyvrb options are controlled by \fvset{..} and minted options via Defining shortcuts using \newminted{..}{..}. –  texenthusiast Mar 15 '13 at 8:54

1 Answer 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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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