def print_latex_tables(out, keys):
    r"""Prints the tables for inclusion in our LaTeX documents."""
    cols = ['total', 'code', 'comment', 'blank', 'tests', 'docs']

    text = []
    text += make_preamble('Count Lines of Code Breakdown', 'tab:cloc',
                          'lcccccc')
    text.append(
        r'        \textbf{Module} & \textbf{Total} & \textbf{Code} & \textbf{Comments} & \textbf{Blank} & \textbf{Tests} & \textbf{Documentation} \\ \midrule'
    )
    for key in keys:
        lines = out[key]['lines']
        if '+' in key:
            name = 'total'
            midrule = ''
        else:
            name = key
            midrule = r' \midrule'
        values = ' & '.join('{}'.format(lines[x]) for x in cols)
        text.append(r'        \multirow{2}[3]{*}{\textbf{\texttt{' + name +
                    r'}}} & ' + values + r' \\')
        #(100\%) & (36.0\%) & (28.6\%) & (22.4\%) & (9.3\%) & (3.7\%)
        values = ' & '.join('({:.1f}\\%)'.format(100 * lines[x] /
                                                 lines['total']) for x in cols)
        text.append(r'        & ' + values + r' \\' + midrule)
    text += make_conclusion()

    text = '\n'.join(text)
    print(text)

    return text
Exemple #2
0
 def test_short_cap(self):
     out = dcs.make_preamble(self.caption, self.label, self.cols, short_cap='Short cap')
     self.assertIn('    \caption[Short cap]{This caption}%', out)
     self.assertNotIn('    \caption{This caption}%', out)
Exemple #3
0
 def test_minipage(self):
     out = dcs.make_preamble(self.caption, self.label, self.cols, use_mini=True)
     self.assertIn('    \\begin{minipage}{\\linewidth}', out)
     self.assertIn('        \\begin{tabular}{lcc}', out)
Exemple #4
0
 def test_size(self):
     out = dcs.make_preamble(self.caption, self.label, self.cols, size='\\footnotesize')
     self.assertIn('    \\footnotesize', out)
     self.assertNotIn('    \\small', out)
Exemple #5
0
 def test_nominal(self):
     out = dcs.make_preamble(self.caption, self.label, self.cols)
     self.assertIn('    \\caption{This caption}%', out)
     self.assertIn('    \\label{tab:this_label}', out)
     self.assertIn('    \\begin{tabular}{lcc}', out)
     self.assertIn('    \\small', out)