void set_tex_caption (const std::string &key,
const std::string &tex_caption);
+ /**
+ * Sets the tex caption of the entire
+ * <tt>table</tt> for tex output.
+ */
+ void set_tex_table_caption (const std::string &table_caption);
+
+ /**
+ * Sets the label of this
+ * <tt>table</tt> for tex output.
+ */
+ void set_tex_table_label (const std::string &table_label);
+
/**
* Sets the caption the the
* supercolumn <tt>superkey</tt> for
void write_text (std::ostream &out) const;
/**
- * Write table as a tex file.
+ * Write table as a tex file. If
+ * with_header is set to false
+ * (it is true by default), then
+ * no \documentclass{...},
+ * \begin{document} and
+ * \end{document} are used. In
+ * this way the file can be
+ * included into an existing tex
+ * file using a command like
+ * "\input{table_file}".
*/
- void write_tex (std::ofstream &file) const;
+ void write_tex (std::ofstream &file, const bool with_header=true) const;
/** @addtogroup Exceptions
* @{ */
* <tt>set_tex_supercaptions(...)</tt>.
*/
std::map<std::string, std::string> tex_supercaptions;
+
+ /**
+ * The caption of the table itself.
+ */
+ std::string tex_table_caption;
+ /**
+ * The label of the table.
+ */
+ std::string tex_table_label;
+
};
columns[key].tex_caption=tex_caption;
}
+void TableHandler::set_tex_table_caption (const std::string &table_caption)
+{
+ tex_table_caption=table_caption;
+}
+
+void TableHandler::set_tex_table_label (const std::string &table_label)
+{
+ tex_table_label=table_label;
+}
void TableHandler::set_tex_supercaption (const std::string &superkey,
const std::string &tex_supercaption)
}
-void TableHandler::write_tex (std::ofstream &out) const
+void TableHandler::write_tex (std::ofstream &out, const bool with_header) const
{
AssertThrow (out, ExcIO());
+ if (with_header)
+ out << "\\documentclass[10pt]{report}" << std::endl
+ << "\\usepackage{float}" << std::endl << std::endl << std::endl
+ << "\\begin{document}" << std::endl;
- out << "\\documentclass[10pt]{report}" << std::endl
- << "\\usepackage{float}" << std::endl << std::endl << std::endl
- << "\\begin{document}" << std::endl
- << "\\begin{table}[H]" << std::endl
+ out << "\\begin{table}[H]" << std::endl
<< "\\begin{center}" << std::endl
<< "\\begin{tabular}{|";
out << "\\\\ \\hline" << std::endl;
}
- std::string caption="table";
-
- out << "\\end{tabular}" << std::endl
- << "\\end{center}" << std::endl
-// << "\\caption{" << caption << "}" << std::endl
- << "\\end{table}" << std::endl
- << "\\end{document}" << std::endl;
+ out << "\\end{tabular}" << std::endl
+ << "\\end{center}" << std::endl;
+ if(tex_table_caption!="")
+ out << "\\caption{" << tex_table_caption << "}" << std::endl;
+ if(tex_table_label!="")
+ out << "\\label{" << tex_table_label << "}" << std::endl;
+ out << "\\end{table}" << std::endl;
+ if (with_header)
+ out << "\\end{document}" << std::endl;
}