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.

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

share|improve this question

migrated from stackoverflow.com Jun 23 '11 at 10:16

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

3 Answers 3

up vote 4 down vote accepted

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}

enter image description here

share|improve this answer
    
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.

share|improve this answer

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).

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.