# How to present source code RDF/Notation 3 in LaTeX?

I give a second try to present RDF in Notation 3 serialization in LaTeX. I tried with the listings package but its not so nice the restuls for the eye-there is much spacing between the letters, the font is not so ok,...So, can you suggest better way to present the code from your own experience presenting rdf/notation3 in LaTeX?

I spend much time solving this problem but.....

SOLVED with help of you guys. Solution:

\usepackage[T1]{fontenc}
\usepackage[scaled=0.9]{beramono}
\usepackage{microtype}
\newcommand\Small{\fontsize{8}{10}\selectfont}
\newcommand*\LSTfont{%
\Small\ttfamily\SetTracking{encoding=*}{-50}\lsstyle}

...

\lstset{ basicstyle=\LSTfont, columns=fullflexible, xleftmargin=5mm, framexleftmargin=5mm, numbers=left, stepnumber=1, breaklines=true, breakatwhitespace=false, numberstyle=\footnotesize, numbersep=5pt, tabsize=2, frame=lines, captionpos=b, caption={Your caption}}
\lstinputlisting{Code.n3}


Cheers, Milan

-

## migrated from stackoverflow.comJun 23 '11 at 10:16

This question came from our site for professional and enthusiast programmers.

try this setting:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[scaled=0.9]{beraserif}
\usepackage[scaled=0.9]{beramono}
\usepackage{microtype}
\newcommand\Small{\fontsize{9}{9.2}\selectfont}
\newcommand*\LSTfont{%
\Small\ttfamily\SetTracking{encoding=*}{-60}\lsstyle}

\usepackage{listings,lipsum}

\begin{document}
\lipsum[1]

\begin{lstlisting}[basicstyle=\LSTfont]
\usepackage[T1]{fontenc}
\usepackage[scaled=0.85]{beramono}
\usepackage{microtype}
\newcommand\Small{\fontsize{9}{9.2}\selectfont}
\newcommand*\LSTfont{%
\Small\ttfamily\SetTracking{encoding=*}{-60}\lsstyle}
\end{lstlisting}

\lipsum[1]
\end{document}


-
thanks, this is what I wanted, just this code change the style of all my writing. How can I apply this style just to the "listings" part? – Milan Jun 23 '11 at 13:52
do not load the beraserif. That was only for some demonstration. – Herbert Jun 23 '11 at 13:58
Thanks, yours suggestion, combined with egregs, did the trick. – Milan Jun 23 '11 at 14:54

Adding the option columns=fullflexible to the setup of listings avoids the spaces between characters.

-

You can change the font of listings using the basicstyle=<commands> option (used in the optional argument). Simply try a different font family and see if it looks better for you.

There is also the minted package as well as the simple verbatim environment (no syntax hightlighting).

-