listings format problem

2005-06-12 Thread funny guy
Dear Herbert,

I tried your following codes in LyX:

I am using report as the document template:

\usepackage[breaklines]{listings}
\renewcommand\lstlistingname{Algorithmus}

\renewcommand\lstlistlistingname{Algorithmenverzeichnis}
\renewcommand\thelstlisting{\thesection.\arabic{lstlisting}}

\newcommand{\lst}[2]{
 \noindent\rule[-1ex]{\columnwidth}{0.3mm}
 \vspace{-1ex}
\lstinputlisting[caption={#2},label={#1},stringspaces=false,frame={tb},lineskip=-1pt,extendedchars=true,
basicstyle=\tt\footnotesize,labelstep=1,labelstyle=\tiny,indent=2em,language=Java,breaklines]{#1}
\vspace{1ex}
}

It works fine in the normal document. However, if I
import the source code with in a Enumrated
environment. It will have some error for the top and
button rule of the frame, Pleaes try:

1. point 1
   \lst{mycode.file}{first code}
2. point 2

Where mycode.file is only:

#include 
void main(void)
{
print("hello\n");
}

Could you please help me to fix this problem?

Thank you very much in advance! ^_^

Peter Chan





__ 
Discover Yahoo! 
Have fun online with music videos, cool games, IM and more. Check it out! 
http://discover.yahoo.com/online.html


listings format

2005-06-06 Thread funny guy
Dear all,

I am trying to use the package listings.sty in LyX. 

1. In the example document listings.dvi, the format of
a floating listing is very nice (page 6 in
listings-1.3.pdf). It has two lines that encapsulates
the codes that are inserted. However, I cannot get
these two lines. Can anyone tell me how to do that in
LyX ?


2. Moreover, how to put another line above the
caption?
like this:


  Listing 1: My codes

line 1 of codes
line 2 of codes
...


3. How to change the fonts of the inserted codes?

Thanks for your help in advance! ^_^

Peter Chan






__ 
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 



How to use listings.sty?

2005-06-03 Thread funny guy
Dear all,

I am trying to use listings.sty in LyX since I would
like to include some files. However, I can only insert
one file. Can anyone tell me how to use it?

in preamble, I inserted:
\usepackage{listings}

in the document, I wrote:
\1stlistoflisting{
 [include first verbatim file]
}

\1stlistoflisting{
 [include second verbatim file]
}

\1stlistoflisting{
 [include third verbatim file]
}

then I have lots of errors

Can anyone help?

Peter Chan

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


How to import source codes

2005-06-03 Thread funny guy
Dear all,

I am a newbie in LyX. I have some questions of using
LyX. Could you please give me some help?

1. When I use Lyx-code, the line goes over the page
width. Is there any possible way to configure lyx-code
that auto address the paragraph into the document page
width with full justify, since formatting line by line
of these codes is very annoying and they are not fully
justtified due to the difference lengths of the words.
Some people suggested to use listings.sty. However I
do not know how to use it in LyX.

2. I am currently writing a document that needs to
include large amount of some source codes and these
source codes are changed very often. Is there any
possible way to import the source codes DYNAMICALLY in
a similar way to the figures. 

what I mean is that I create a directory called "src"
then put all source code files there. In Lyx, I only
need to refer to the file name of the source code,
then LyX import it for me. When the source code is
changed, I only need to replace the corresponding file
under "src" rather than searching the *.lyx file for
modifications.

I know "insert ASCII file as line" is able to import a
file but it is not dynamically. "Include file with
verbatim" seems able to import file dynamically, but
it does not format the codes so that the over page
width problem still exists for a long line of code.

Moreover, using "algorithm float" seems has a better
font, but it has a problem that when my code is longer
than 1page, it does not break to multiple pages. 

3. If there is a way for the above question. How to
format the imported source codes as it is well known
that some editors use TAB for indent but some use
space. Will LyX auto format this for me? I mean for
example using different font for source codes.

4. (Optional) Is there any way to import partial of
the codes from the source file? for instance, from
line xx to line yy? If yes, these will be very nice.

5. From the standard importing options, I can only
import figure, table and algorithm. Obviously, source
codes do not fall into any of these categorise. Is
there any way to create a new type of citations for
quoting the source codes?

Moreover, how to formate the is new type? I mean the
format of Algorithm is good, it has two lines above
and below the citation and has a line at the end of
the code.

I think I asked too many questions and I am very sorry
for the trouble. You help is very appreciated.

Best Regards,

Peter Chan

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com