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
.println("-hr Prints horizontal rows in the output (to get a better? view).");
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
.println("-sectionlevel <level> Specifies the highest level of sections (either \"subsection\", \"section\" or \"chapter\").");
System.err
.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>
* Here is an example table.
* <p>
* <table border bgcolor="#AAAAAA">
* <table border bgcolor="#DDDDDD">
* <tr>
* <th>Column 1 Heading
* <th>Column two heading
@@ -31,13 +31,12 @@ import javax.swing.text.html.HTML;
* <td align=left>left
* <tr>
* <td colspan=3>
* <table border=5 bgcolor="#CCCCCC">
* <table border=5 bgcolor="#EEEEEE">
* <tr>
* <th colspan=3>A nested table example
* <tr>
* <th>Column 1 Heading</th>
* <th>Coludliadfuapfd a fia fopia foipapio dupoau foapoifd pdpfiu apsd
* oipoioaofiduaopiufopiiiiiiiiiimn two heading</th>
* <th>Column one Heading</th>
* <th>Column two heading</th>
* <th>Column three heading</th>
* <tr>
* <td>data</td>
@@ -176,7 +175,7 @@ public class TableInfo {
* into.
*/
public StringBuffer endTable() {
originalBuffer.append("\n% Table #" + tblno + "\n");
originalBuffer.append("\n% Table #" + tblno + "\n\\begin{center}\n");
int col = totalcolcnt;
if (col == 0) {
col = 1;
@@ -187,7 +186,7 @@ public class TableInfo {
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) + "\\linewidth}\n");
+ (TeXDoclet.tableWidthScale / col) + "\\linewidth}\n");
}
if (red != -1.0 && green != -1.0 && blue != -1.0) {
originalBuffer.append("\\colorbox[rgb]{" + Double.toString(red)
@@ -216,6 +215,7 @@ public class TableInfo {
originalBuffer.append("}\n");
}
originalBuffer.append("\\end{center}\n");
return originalBuffer;
}

View File

@@ -181,6 +181,7 @@ public class TeXDoclet extends Doclet {
static String imagesPath = null;
static String subtitle = null;
static String introFile = null;
static double tableWidthScale = 0.9;
public static void main(String args[]) {
@@ -308,6 +309,8 @@ public class TeXDoclet extends Doclet {
return 2;
} else if (option.equals("-texintro")) {
return 2;
} else if (option.equals("-tablescale")) {
return 2;
}
System.out.println("unknown option " + option);
return Doclet.optionLength(option);
@@ -405,6 +408,8 @@ public class TeXDoclet extends Doclet {
subtitle = args[i][1];
} else if (args[i][0].equals("-texintro")) {
introFile = args[i][1];
} else if (args[i][0].equals("-tablescale")) {
tableWidthScale = Double.parseDouble(args[i][1]);
}
if (sectionLevelMax != null
@@ -676,28 +681,44 @@ public class TeXDoclet extends Doclet {
os.println("}");
}
addFile(os, finishFile, false);
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();
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);
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);
os.println("}");
i++;
}
os.println("\\end{appendix}");
}
os.println("\\markboth{}{}");
// os.println("\\markboth{}{}");
if (index) {
os.println("\\printindex");
}
addFile(os, finishFile, false);
if (!includeTexOutputInOtherTexFile) {
os.println("\\end{document}");
}

View File

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