> I don't think you've given all your requirements yet. Why not just
> write it out in CSV?
> I'm doing something similar, I guess. I save the results in my own made
> up XML format, which I can convert to several output formats using XSLT.
>> I don't think you've given all your requirements yet. Why not just
>> write it out in CSV?
[quoted text clipped - 17 lines]
> How much time were you implementing it?
> Something about your format - if it is possible of course?
I've found one trick for producing pretty documents automatically, from
Java program output. Do you know LaTeX? It's an old-fashioned,
non-WYSIWYG formatting system used mainly for preparing academic papers
in subjects with a lot of mathematics and the like, including computer
science. The source for the document is in ASCII, but there are ways of
specifying accented characters and formatting such as tables.
One of the nice things about it is pdflatex, a program that generates an
Adobe Acrobat document.
I've written a converter that takes table output one of my programs
leaves in an XML file and converts it to the LaTeX source for a
formatted table. In my makefile, that gets run through pdflatex,
producing a formatted document. Of course, I could have made the main
program output LaTeX directly, but I find the XML-and-converter approach
more flexible.
Patricia
Moiristo - 25 Jun 2006 14:29 GMT
> I've written a converter that takes table output one of my programs
> leaves in an XML file and converts it to the LaTeX source for a
> formatted table. In my makefile, that gets run through pdflatex,
> producing a formatted document. Of course, I could have made the main
> program output LaTeX directly, but I find the XML-and-converter approach
> more flexible.
Nice! Is it an XSL sheet? I'm very interested in seeing it, could save
me a lot of time finding out how to work with pdflatex. Is it big or can
you post it in a message?
Patricia Shanahan - 25 Jun 2006 15:55 GMT
>> I've written a converter that takes table output one of my programs
>> leaves in an XML file and converts it to the LaTeX source for a
[quoted text clipped - 6 lines]
> me a lot of time finding out how to work with pdflatex. Is it big or can
> you post it in a message?
I use a combination of Java programs and shell scripts. I don't know
whether that is the best way of doing it, I just needed a way that
worked. I'm afraid it isn't generalized at all.
Here's a sample of some Java code, generating the preamble for a LaTeX
"tabular", a table format. "titles" is a List of column headings, and my
objective was a table with equal column widths totaling "totalWidth"
inches. I don't think it will help much unless you understand LaTeX:
private void putHeader(PrintStream out) {
out.print("\\begin{tabular}{|");
int cols = titles.size() + 1;
double colWidth = totalWidth / cols;
colWidth = Math.rint(colWidth * 100) / 100;
for (int i = 0; i < cols; i++) {
out.print("p{" + colWidth + " in}|");
}
out.println("} \\hline");
out.print("Cut Off\t\t");
for (Iterator it = titles.iterator(); it.hasNext();) {
out.print(" & " + it.next() + "\t\t");
}
out.println("\\\\ \\hline");
}
This is a shell script, makedoc, for taking some LaTeX fragments and
packing them with a header and trailer to produce a complete document:
#!/bin/ksh
echo '\\documentclass{article}'
echo '\\begin{document}'
cat $@
echo '\\end{document}'
These are a couple of makefile rules for producing .pdf from pieces of
LaTeX source, using makedoc.
%.pdf: %.sect.tex
./makedoc $*.sect.tex >$*.tex
pdflatex $*.tex
summary.pdf: ${SHORT_SECTIONS}
./makedoc $^ >summary.tex
pdflatex summary.tex
Hope some of this helps.
Patricia
Jeffrey Schwab - 26 Jun 2006 04:28 GMT
> I've found one trick for producing pretty documents automatically, from
> Java program output. Do you know LaTeX? It's an old-fashioned,
> non-WYSIWYG formatting system used mainly for preparing academic papers
> in subjects with a lot of mathematics and the like, including computer
> science.
Holy crap have we come a long way. Once upon a time, TeX (pronounced
"tech") was /the/ way to produce fancy text, and LaTeX seemed like alien
technology.