Gerald Gutierrez wrote:
>
> Hello!
>
> I'm currently writing my thesis and need to have some code snippets as part of
> it. Unfortunately, because I'll be using double spacing, simply putting the
> code in and changing it to a typewriter font, or using Lyx-Code causes the code
> to be double spaced as well, making it really hard to read (and fairly ugly).
Hello
When I need to insert some code in LyX I use the latex Listings package.
There're about 38 recognized languages (C, C++, java, Lisp, csh, etc.)
and you can define your own language if you need it.
You can :
- use line numbering in different styles
- use color package
- insert a source file code or just insert a part of a source file
- and more.
I think it's more simple than lgring (that I don't known well) because
you don't
need to do a preprocessing. You have to insert some ERT lines. For
example :
In the preambule :
\usepackage{listings}
In LyX :
% Select the language and set basic style
\lset{language=lisp,tabsize=2,basicstyle=\texttt{\tiny}}
% Set line numbering style
\lset{labelstyle=\tiny,labelstep=5,labelsep=5pt}
% Insert a whole file
\lstinputlisting{namefile.lsp}
% Insert inline code
\begin{lstlistings}{}
(defun foo ()
"A good lisp example"
(print "Hello world !"))
\end{lstlisting}
% Insert 5-10 lines from a file
\lstinputlisting[first=5,last=10]{namefile.lsp}
Go to your CTAN archive site, download it, and install it somewhere.
I use it under the TEXINPUTS path.
Best regards
Thy
-------------------------------------------------------------------------
Thierry LEMEUNIER
Equipe Langue et Dialogue
-------------------------------------------------------------------------
Laboratoire d'Informatique de L'Universite du Maine
Institut d'Informatique Claude Chappe
rue Laennec
F72085 LE MANS CEDEX 9
-------------------------------------------------------------------------
Tel : 33/0 2 4383 3865 Fax : 33/0 2 4383 3868
mailto : [EMAIL PROTECTED]
webpage : http://www-ic2.univ-lemans.fr/~lemeunie/
-------------------------------------------------------------------------