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.
Asked
Active
Viewed 1,791 times
1
1 Answers
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
fancyvrboptions are controlled by\fvset{..}andmintedoptions via Defining shortcuts using\newminted{..}{..}. – texenthusiast Mar 15 '13 at 08:54\newmintedshortcuts(environment) in separatecustom.styfile andusepackage{custom}. Alternatively(simple) place all macros and\newminted{}{}inpreambleso you/all can explicitly see what your style for eg: Defining a command for a minted environment. PS: I am also a newbie trying to help you. – texenthusiast Mar 15 '13 at 16:51