I want to export my Notepad++ highlighted code into LaTeX. Is it possible?
Note that my codes are PHP codes.
I want to export my Notepad++ highlighted code into LaTeX. Is it possible?
Note that my codes are PHP codes.
Consider using lstset from the listings package. Note that any option you don't want globally (or technically, global to the current group) can be set as part of the optional argument to \begin{lstlisting}.
\documentclass{article}
\usepackage{xcolor} % for more colors
\usepackage{listings}
\lstset{
basicstyle=\small\ttfamily,
stringstyle=\color{black!40!white}\ttfamily,
keywordstyle=\color{blue},
commentstyle=\color{green!50!black},
showstringspaces=false,
backgroundcolor=\color{black!5!white}
}
\usepackage{framed} % for contrast
\begin{document}
% Example source from http://php.net/manual/en/function.readdir.php
\begin{framed}
\begin{lstlisting}[language=php]
<?php
if ($handle = opendir('/path/to/files')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
/* This is the correct way to
loop over the directory. */
while (false !== ($entry = readdir($handle))) {
echo "$entry\n";
}
/* This is the WRONG way to
loop over the directory. */
while ($entry = readdir($handle)) {
echo "$entry\n";
}
closedir($handle);
}
?>
\end{lstlisting}
\end{framed}
\end{document}

.pdffor example) highlighted as you can see it in your editor? – karlkoeller Jun 21 '13 at 16:25listingsormintedpackages will be your friend here – cmhughes Jun 21 '13 at 16:31