option for costume table width added + appendix changes

This commit is contained in:
stfm
2012-07-01 21:10:58 +02:00
parent 8f214465eb
commit c7b50011ff
4 changed files with 44 additions and 21 deletions

View File

@@ -62,11 +62,13 @@ public class HelpOutput {
System.err System.err
.println("-hr Prints horizontal rows in the output (to get a better? view)."); .println("-hr Prints horizontal rows in the output (to get a better? view).");
System.err System.err
.println("-include Creates output without latex initiation (writes it in initdocsinclude.tex), titlepage, contents."); .println("-include Creates output in two seperated latex documents: one for the preamble part and another for the actual java documentation content.");
System.err System.err
.println("-sectionlevel <level> Specifies the highest level of sections (either \"subsection\", \"section\" or \"chapter\")."); .println("-sectionlevel <level> Specifies the highest level of sections (either \"subsection\", \"section\" or \"chapter\").");
System.err System.err
.println("-imagespath <path> Path to the texdoclet_images dir (absolute or relative to the output document .tex file)."); .println("-imagespath <path> Path to the texdoclet_images dir (absolute or relative to the output document .tex file).");
System.err
.println("-tablescale <factor> Scale factor to specify width of tables. Default value is 0.9.");
} }

View File

@@ -17,7 +17,7 @@ import javax.swing.text.html.HTML;
* <br> * <br>
* Here is an example table. * Here is an example table.
* <p> * <p>
* <table border bgcolor="#AAAAAA"> * <table border bgcolor="#DDDDDD">
* <tr> * <tr>
* <th>Column 1 Heading * <th>Column 1 Heading
* <th>Column two heading * <th>Column two heading
@@ -31,13 +31,12 @@ import javax.swing.text.html.HTML;
* <td align=left>left * <td align=left>left
* <tr> * <tr>
* <td colspan=3> * <td colspan=3>
* <table border=5 bgcolor="#CCCCCC"> * <table border=5 bgcolor="#EEEEEE">
* <tr> * <tr>
* <th colspan=3>A nested table example * <th colspan=3>A nested table example
* <tr> * <tr>
* <th>Column 1 Heading</th> * <th>Column one Heading</th>
* <th>Coludliadfuapfd a fia fopia foipapio dupoau foapoifd pdpfiu apsd * <th>Column two heading</th>
* oipoioaofiduaopiufopiiiiiiiiiimn two heading</th>
* <th>Column three heading</th> * <th>Column three heading</th>
* <tr> * <tr>
* <td>data</td> * <td>data</td>
@@ -176,7 +175,7 @@ public class TableInfo {
* into. * into.
*/ */
public StringBuffer endTable() { public StringBuffer endTable() {
originalBuffer.append("\n% Table #" + tblno + "\n"); originalBuffer.append("\n% Table #" + tblno + "\n\\begin{center}\n");
int col = totalcolcnt; int col = totalcolcnt;
if (col == 0) { if (col == 0) {
col = 1; col = 1;
@@ -187,7 +186,7 @@ public class TableInfo {
originalBuffer.append("\\newlength{\\tbl" + tc + "c" + cc + "w}\n"); originalBuffer.append("\\newlength{\\tbl" + tc + "c" + cc + "w}\n");
// originalBuffer.append("\\setlength{\\tbl"+tc+"c"+cc+"w}{"+(1.0/col)+"\\hsize}\n"); // originalBuffer.append("\\setlength{\\tbl"+tc+"c"+cc+"w}{"+(1.0/col)+"\\hsize}\n");
originalBuffer.append("\\setlength{\\tbl" + tc + "c" + cc + "w}{" originalBuffer.append("\\setlength{\\tbl" + tc + "c" + cc + "w}{"
+ (1.0 / col) + "\\linewidth}\n"); + (TeXDoclet.tableWidthScale / col) + "\\linewidth}\n");
} }
if (red != -1.0 && green != -1.0 && blue != -1.0) { if (red != -1.0 && green != -1.0 && blue != -1.0) {
originalBuffer.append("\\colorbox[rgb]{" + Double.toString(red) originalBuffer.append("\\colorbox[rgb]{" + Double.toString(red)
@@ -216,6 +215,7 @@ public class TableInfo {
originalBuffer.append("}\n"); originalBuffer.append("}\n");
} }
originalBuffer.append("\\end{center}\n");
return originalBuffer; return originalBuffer;
} }

View File

@@ -181,6 +181,7 @@ public class TeXDoclet extends Doclet {
static String imagesPath = null; static String imagesPath = null;
static String subtitle = null; static String subtitle = null;
static String introFile = null; static String introFile = null;
static double tableWidthScale = 0.9;
public static void main(String args[]) { public static void main(String args[]) {
@@ -308,6 +309,8 @@ public class TeXDoclet extends Doclet {
return 2; return 2;
} else if (option.equals("-texintro")) { } else if (option.equals("-texintro")) {
return 2; return 2;
} else if (option.equals("-tablescale")) {
return 2;
} }
System.out.println("unknown option " + option); System.out.println("unknown option " + option);
return Doclet.optionLength(option); return Doclet.optionLength(option);
@@ -405,6 +408,8 @@ public class TeXDoclet extends Doclet {
subtitle = args[i][1]; subtitle = args[i][1];
} else if (args[i][0].equals("-texintro")) { } else if (args[i][0].equals("-texintro")) {
introFile = args[i][1]; introFile = args[i][1];
} else if (args[i][0].equals("-tablescale")) {
tableWidthScale = Double.parseDouble(args[i][1]);
} }
if (sectionLevelMax != null if (sectionLevelMax != null
@@ -676,28 +681,44 @@ public class TeXDoclet extends Doclet {
os.println("}"); os.println("}");
} }
addFile(os, finishFile, false);
if (appendencies.size() > 0) { if (appendencies.size() > 0) {
os.println("\\appendix"); // os.println("\\appendix");
// Iterator it = appendencies.keySet().iterator();
// int i = 0;
// while (it.hasNext()) {
// os.println("\\" + sectionLevels[0] + "{}{");
// os.println(" \\label{appendix" + (i + 1) + "}");
// String sfa = (String) it.next();
// // System.out.println(sfa);
// addFile(os, sfa, true);
// os.println("}");
// i++;
// }
os.println("\\begin{appendix}");
Iterator it = appendencies.keySet().iterator(); Iterator it = appendencies.keySet().iterator();
int i = 0; int i = 0;
while (it.hasNext()) { while (it.hasNext()) {
os.println("\\" + sectionLevels[0] + "{}{");
os.println(" \\label{appendix" + (i + 1) + "}");
String sfa = (String) it.next(); String sfa = (String) it.next();
// System.out.println(sfa); File f = new File(sfa);
String fname = f.getName().replace("_", "\\_");
System.out.println(fname);
os.println("\\" + sectionLevels[0] + "{File " + fname + "}{");
os.println(" \\label{appendix" + (i + 1) + "}");
addFile(os, sfa, true); addFile(os, sfa, true);
os.println("}"); os.println("}");
i++; i++;
} }
os.println("\\end{appendix}");
} }
os.println("\\markboth{}{}"); // os.println("\\markboth{}{}");
if (index) { if (index) {
os.println("\\printindex"); os.println("\\printindex");
} }
addFile(os, finishFile, false);
if (!includeTexOutputInOtherTexFile) { if (!includeTexOutputInOtherTexFile) {
os.println("\\end{document}"); os.println("\\end{document}");
} }

View File

@@ -1,2 +1,2 @@
<h2>Appendix A content</h2> <p><b>Appendix A content</b>
content of file doc-files/appendix_a.html <p>content of file doc-files/appendix_a.html