CbmRoot
CbmLatexReportElement.cxx
Go to the documentation of this file.
1 
7 
8 #include <sstream> // for string, operator<<, basic_ostream, endl
9 #include <string> // for operator+, char_traits, operator!=
10 
11 using std::endl;
12 using std::string;
13 using std::stringstream;
14 using std::vector;
15 
17 
19 
20 string CbmLatexReportElement::TableBegin(const string& caption,
21  const vector<string>& colNames) const {
22  string st = "\\begin{table}[h] \n";
23  st += "\\centering";
24  if (caption != "") st += "\\caption{" + caption + "} \n";
25  st += "\\begin{tabular}{|";
26  for (unsigned int i = 0; i < colNames.size(); i++) {
27  st += "c|";
28  }
29  st += "} \\hline \n";
30  // names start from the second column
31  for (unsigned int i = 0; i < colNames.size(); i++) {
32  st += (i < (colNames.size() - 1)) ? (colNames[i] + " & ") : (colNames[i]);
33  }
34  st += "\\\\ \\hline \n";
35  return st;
36 }
37 
39  return "\\end{tabular} \\end{table}";
40 }
41 
43  const string& name) const {
44  stringstream ss;
45  ss << "\\multicolumn{" << nofCols << "}{|c|}{" << name << "} \\\\ \\hline"
46  << endl;
47  return ss.str();
48 }
49 
50 string CbmLatexReportElement::TableRow(const vector<string>& row) const {
51  string st;
52  for (unsigned int i = 0; i < row.size(); i++) {
53  st += (i < (row.size() - 1)) ? (row[i] + " & ") : (row[i]);
54  }
55  st += " \\\\ \\hline \n";
56  return st;
57 }
58 
59 string CbmLatexReportElement::Image(const string& title,
60  const string& file) const {
61  stringstream ss;
62 
63  ss << "\\begin{figure}[h]" << endl;
64  ss << "\\centering" << endl;
65  ss << "\\includegraphics[width=7cm]{" << file << ".eps}" << endl;
66  ss << "\\caption{" << title << "}" << endl;
67  ss << "\\end{figure}" << endl;
68  return ss.str();
69 }
70 
72  string str = "\\documentclass[a4paper,14pt]{article}";
73  str += "\\usepackage{amssymb}";
74  str += "\\setlength\\oddsidemargin{-2cm}";
75  str += "\\setlength\\evensidemargin{-2cm}";
76  str += "\\setlength\\textwidth{17cm}";
77  str += "\\setlength\\topmargin{0cm}";
78  str += "\\usepackage[dvips]{graphicx}";
79  str += "\\begin{document}";
80 
81  return str;
82 }
83 
84 string CbmLatexReportElement::DocumentEnd() const { return "\\end{document}"; }
85 
86 string CbmLatexReportElement::Title(int size, const string& title) const {
87  string st = "\\";
88  for (int i = 0; i < size; i++)
89  st += "sub";
90  st += "title{" + title + "}";
91  return st;
92 }
93 
CbmLatexReportElement::Image
virtual std::string Image(const std::string &title, const std::string &file) const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:59
CbmLatexReportElement::TableRow
virtual std::string TableRow(const std::vector< std::string > &row) const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:50
CbmLatexReportElement::DocumentEnd
virtual std::string DocumentEnd() const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:84
CbmLatexReportElement.h
Implementation of CbmReportElement for Latex output.
CbmLatexReportElement::TableEmptyRow
virtual std::string TableEmptyRow(int nofCols, const std::string &name) const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:42
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmLatexReportElement::TableBegin
virtual std::string TableBegin(const std::string &caption, const std::vector< std::string > &colNames) const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:20
CbmLatexReportElement::TableEnd
virtual std::string TableEnd() const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:38
CbmLatexReportElement::DocumentBegin
virtual std::string DocumentBegin() const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:71
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmLatexReportElement::CbmLatexReportElement
CbmLatexReportElement()
Constructor.
Definition: CbmLatexReportElement.cxx:16
CbmLatexReportElement::~CbmLatexReportElement
virtual ~CbmLatexReportElement()
Destructor.
Definition: CbmLatexReportElement.cxx:18
CbmLatexReportElement
Implementation of CbmLitReportElement for Latex output.
Definition: CbmLatexReportElement.h:23
CbmLatexReportElement::Title
virtual std::string Title(int size, const std::string &title) const
Inherited from CbmReportElement.
Definition: CbmLatexReportElement.cxx:86