Hi,
This question is for my Java brethren on the list. In a few days, I have to submit a thesis for an MSc in OR. I need to include the source code for a computational economics model I've put together for research. Does anyone out there know of a way to take a java text file, and get a nicely formatted file, such as .rtf, where the formatting is similar to what you see in an IDE? For example, one that would have comments color coded and, perhaps, method names in italics, etc? I've tried printing from Eclipse 3.1 to a .pdf file, and then dragging that into word. There seems to be two problems. I can't get the highlighted line, where the cursor is, to un-highlight, and it only shows the first page. I guess I could just print the code to .pdf one page at the time, but that's a little too much like actual work. Does anyone know of an IDE out there which has a "save as" feature which allows one to save their .java file as an .rtf formatted for presentation or something like that? Is there something simple I'm overlooking? Thanks, Rich -------------- next part -------------- An HTML attachment was scrubbed... URL: /pipermail/friam_redfish.com/attachments/20050328/8bd0a013/attachment.htm |
When I need something like this, I use the UNIX "enscript" command. If
you give it --pretty-print-cpp, it'll use C++ rules, which are pretty similar to Java. It might even have a Java option, I don't know. - Martin Richard Harris wrote: > Hi, > > > > This question is for my Java brethren on the list. In a few days, I have > to submit a thesis for an MSc in OR. I need to include the source code > for a computational economics model I?ve put together for research. > > > > Does anyone out there know of a way to take a java text file, and get a > nicely formatted file, such as .rtf, where the formatting is similar to > what you see in an IDE? For example, one that would have comments color > coded and, perhaps, method names in italics, etc? > > > > I?ve tried printing from Eclipse 3.1 to a .pdf file, and then dragging > that into word. There seems to be two problems. I can?t get the > highlighted line, where the cursor is, to un-highlight, and it only > shows the first page. I guess I could just print the code to .pdf one > page at the time, but that?s a little too much like actual work. > > > > Does anyone know of an IDE out there which has a ?save as? feature which > allows one to save their .java file as an .rtf formatted for > presentation or something like that? Is there something simple I?m > overlooking? > > > > Thanks, > > > > Rich > > > ------------------------------------------------------------------------ > > ============================================================ > FRIAM Applied Complexity Group listserv > Meets Fridays 9:30a-11:30 at ad hoc locations > Lecture schedule, archives, unsubscribe, etc.: > http://www.friam.org |
In reply to this post by Richard Harris-2
My solution would require a bit of LaTexing. Here is how I would do it:
I would use the following template ========= \documentclass[a4paper,12pt]{article} \usepackage{listings} \begin{document} \begin{lstlisting}[caption=YourCode.java, label=list:listing1, numbers=left, tabsize=2,showspaces=false, showstringspaces=false, basicstyle=\tiny, language=Java] % cut and past your code in here \end{lstlisting} \end{document} ================== This would also show line numbers, which could be useful for referencing in your thesis. This is should be pretty easy to do. If don't have a Latex compiler on your machine, all you have to do is get MikTex from http://www.miktex.org/ and TeXnic Center as the LaTex IDE from http://www.toolscenter.org/. Cheers, Mohammed ----- Original Message ----- From: Richard Harris To: 'The Friday Morning Applied Complexity Coffee Group' Sent: Monday, March 28, 2005 7:08 PM Subject: [FRIAM] Question on java source code formatted for presentation. Hi, This question is for my Java brethren on the list. In a few days, I have to submit a thesis for an MSc in OR. I need to include the source code for a computational economics model I've put together for research. Does anyone out there know of a way to take a java text file, and get a nicely formatted file, such as .rtf, where the formatting is similar to what you see in an IDE? For example, one that would have comments color coded and, perhaps, method names in italics, etc? I've tried printing from Eclipse 3.1 to a .pdf file, and then dragging that into word. There seems to be two problems. I can't get the highlighted line, where the cursor is, to un-highlight, and it only shows the first page. I guess I could just print the code to .pdf one page at the time, but that's a little too much like actual work. Does anyone know of an IDE out there which has a "save as" feature which allows one to save their .java file as an .rtf formatted for presentation or something like that? Is there something simple I'm overlooking? Thanks, Rich ------------------------------------------------------------------------------ ============================================================ FRIAM Applied Complexity Group listserv Meets Fridays 9:30a-11:30 at ad hoc locations Lecture schedule, archives, unsubscribe, etc.: http://www.friam.org -------------- next part -------------- An HTML attachment was scrubbed... URL: /pipermail/friam_redfish.com/attachments/20050328/34605868/attachment.htm |
In reply to this post by Richard Harris-2
You might also look at Jalopy - http://jalopy.sourceforge.net/
I haven't tried this, but would be interested in your experiences with it. There's an Ant plugin for it mentioned at http://ant.apache.org/external.html carl Richard Harris wrote: > > > Hi, > > > > This question is for my Java brethren on the list. In a few days, I have > to submit a thesis for an MSc in OR. I need to include the source code > for a computational economics model I?ve put together for research. > > > > Does anyone out there know of a way to take a java text file, and get a > nicely formatted file, such as .rtf, where the formatting is similar to > what you see in an IDE? For example, one that would have comments color > coded and, perhaps, method names in italics, etc? > > > > I?ve tried printing from Eclipse 3.1 to a .pdf file, and then dragging > that into word. There seems to be two problems. I can?t get the > highlighted line, where the cursor is, to un-highlight, and it only > shows the first page. I guess I could just print the code to .pdf one > page at the time, but that?s a little too much like actual work. > > > > Does anyone know of an IDE out there which has a ?save as? feature which > allows one to save their .java file as an .rtf formatted for > presentation or something like that? Is there something simple I?m > overlooking? > > > > Thanks, > > > > Rich > > > ------------------------------------------------------------------------ > > ============================================================ > FRIAM Applied Complexity Group listserv > Meets Fridays 9:30a-11:30 at ad hoc locations > Lecture schedule, archives, unsubscribe, etc.: > http://www.friam.org |
In reply to this post by Richard Harris-2
IntelliJ does this nicely. You can get line numbers and syntax coloring
if you want. Richard Harris wrote: > > > Hi, > > > > This question is for my Java brethren on the list. In a few days, I have > to submit a thesis for an MSc in OR. I need to include the source code > for a computational economics model I?ve put together for research. > > > > Does anyone out there know of a way to take a java text file, and get a > nicely formatted file, such as .rtf, where the formatting is similar to > what you see in an IDE? For example, one that would have comments color > coded and, perhaps, method names in italics, etc? > > > > I?ve tried printing from Eclipse 3.1 to a .pdf file, and then dragging > that into word. There seems to be two problems. I can?t get the > highlighted line, where the cursor is, to un-highlight, and it only > shows the first page. I guess I could just print the code to .pdf one > page at the time, but that?s a little too much like actual work. > > > > Does anyone know of an IDE out there which has a ?save as? feature which > allows one to save their .java file as an .rtf formatted for > presentation or something like that? Is there something simple I?m > overlooking? > > > > Thanks, > > > > Rich > > > ------------------------------------------------------------------------ > > ============================================================ > FRIAM Applied Complexity Group listserv > Meets Fridays 9:30a-11:30 at ad hoc locations > Lecture schedule, archives, unsubscribe, etc.: > http://www.friam.org |
Free forum by Nabble | Edit this page |