Showing posts with label highlight. Show all posts
Showing posts with label highlight. Show all posts

Tuesday, February 9, 2010

Debian/Ubuntu: highlight and publish source codes

The tool is called - "highlight"

apt-get install highlight
man highlight
Perfect for publishing, integrating source-codes in tex and on websites. I like the following for my codes:

highlight --pretty-symbols --inline-css -I -l _FILE_NAME_ --style $ide -V > tmp; firefox tmp &
In firefox, one can do "View Page Source" and copy&paste.

Wednesday, August 27, 2008

Syntax highlighted source code in latex


\usepackage{color}
\usepackage{listings}

\definecolor{Brown}{cmyk}{0,0.81,1,0.60}
\definecolor{OliveGreen}{cmyk}{0.64,0,0.95,0.40}
\definecolor{CadetBlue}{cmyk}{0.62,0.57,0.23,0}


\lstset{
language=R,
frame=ltrb,
framesep=5pt,
basicstyle=\normalsize,
keywordstyle=\ttfamily\color{OliveGreen},
identifierstyle=\ttfamily\color{CadetBlue}\bfseries,
commentstyle=\color{Brown},
stringstyle=\ttfamily,
showstringspaces=false,
breaklines=true
}

\beging{lstlisting}

[SOURCE CODES GOES HERE]

\end{lstlisting}


The environment has support for the following languages :: Fortran, C, C++, csh, HTML, Java, Matlab, Mathematica, Pascal, Perl, SQL, XML, Delphi, PHP, VBScript, SAS and even Latex itself - and many more.