| 2601 | |
| 2602 | |
| 2603 | static void |
| 2604 | print_latex_vertical(const printTableContent *cont, FILE *fout) |
| 2605 | { |
| 2606 | bool opt_tuples_only = cont->opt->tuples_only; |
| 2607 | unsigned short opt_border = cont->opt->border; |
| 2608 | unsigned long record = cont->opt->prior_records + 1; |
| 2609 | unsigned int i; |
| 2610 | const char *const *ptr; |
| 2611 | |
| 2612 | if (cancel_pressed) |
| 2613 | return; |
| 2614 | |
| 2615 | if (opt_border > 2) |
| 2616 | opt_border = 2; |
| 2617 | |
| 2618 | if (cont->opt->start_table) |
| 2619 | { |
| 2620 | /* print title */ |
| 2621 | if (!opt_tuples_only && cont->title) |
| 2622 | { |
| 2623 | fputs("\\begin{center}\n", fout); |
| 2624 | latex_escaped_print(cont->title, fout); |
| 2625 | fputs("\n\\end{center}\n\n", fout); |
| 2626 | } |
| 2627 | |
| 2628 | /* begin environment and set alignments and borders */ |
| 2629 | fputs("\\begin{tabular}{", fout); |
| 2630 | if (opt_border == 0) |
| 2631 | fputs("cl", fout); |
| 2632 | else if (opt_border == 1) |
| 2633 | fputs("c|l", fout); |
| 2634 | else if (opt_border == 2) |
| 2635 | fputs("|c|l|", fout); |
| 2636 | fputs("}\n", fout); |
| 2637 | } |
| 2638 | |
| 2639 | /* print records */ |
| 2640 | for (i = 0, ptr = cont->cells; *ptr; i++, ptr++) |
| 2641 | { |
| 2642 | /* new record */ |
| 2643 | if (i % cont->ncolumns == 0) |
| 2644 | { |
| 2645 | if (cancel_pressed) |
| 2646 | break; |
| 2647 | if (!opt_tuples_only) |
| 2648 | { |
| 2649 | if (opt_border == 2) |
| 2650 | { |
| 2651 | fputs("\\hline\n", fout); |
| 2652 | fprintf(fout, "\\multicolumn{2}{|c|}{\\textit{Record %lu}} \\\\\n", record++); |
| 2653 | } |
| 2654 | else |
| 2655 | fprintf(fout, "\\multicolumn{2}{c}{\\textit{Record %lu}} \\\\\n", record++); |
| 2656 | } |
| 2657 | if (opt_border >= 1) |
| 2658 | fputs("\\hline\n", fout); |
| 2659 | } |
| 2660 |
no test coverage detected