latex_longtable.tpl 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. \begin{longtable}
  2. {%- set position = parse_table(table_styles, 'position') %}
  3. {%- if position is not none %}
  4. [{{position}}]
  5. {%- endif %}
  6. {%- set column_format = parse_table(table_styles, 'column_format') %}
  7. {% raw %}{{% endraw %}{{column_format}}{% raw %}}{% endraw %}
  8. {% for style in table_styles %}
  9. {% if style['selector'] not in ['position', 'position_float', 'caption', 'toprule', 'midrule', 'bottomrule', 'column_format', 'label'] %}
  10. \{{style['selector']}}{{parse_table(table_styles, style['selector'])}}
  11. {% endif %}
  12. {% endfor %}
  13. {% if caption and caption is string %}
  14. \caption{% raw %}{{% endraw %}{{caption}}{% raw %}}{% endraw %}
  15. {%- set label = parse_table(table_styles, 'label') %}
  16. {%- if label is not none %}
  17. \label{{label}}
  18. {%- endif %} \\
  19. {% elif caption and caption is sequence %}
  20. \caption[{{caption[1]}}]{% raw %}{{% endraw %}{{caption[0]}}{% raw %}}{% endraw %}
  21. {%- set label = parse_table(table_styles, 'label') %}
  22. {%- if label is not none %}
  23. \label{{label}}
  24. {%- endif %} \\
  25. {% else %}
  26. {%- set label = parse_table(table_styles, 'label') %}
  27. {%- if label is not none %}
  28. \label{{label}} \\
  29. {% endif %}
  30. {% endif %}
  31. {% set toprule = parse_table(table_styles, 'toprule') %}
  32. {% if toprule is not none %}
  33. \{{toprule}}
  34. {% endif %}
  35. {% for row in head %}
  36. {% for c in row %}{%- if not loop.first %} & {% endif %}{{parse_header(c, multirow_align, multicol_align, siunitx)}}{% endfor %} \\
  37. {% endfor %}
  38. {% set midrule = parse_table(table_styles, 'midrule') %}
  39. {% if midrule is not none %}
  40. \{{midrule}}
  41. {% endif %}
  42. \endfirsthead
  43. {% if caption and caption is string %}
  44. \caption[]{% raw %}{{% endraw %}{{caption}}{% raw %}}{% endraw %} \\
  45. {% elif caption and caption is sequence %}
  46. \caption[]{% raw %}{{% endraw %}{{caption[0]}}{% raw %}}{% endraw %} \\
  47. {% endif %}
  48. {% if toprule is not none %}
  49. \{{toprule}}
  50. {% endif %}
  51. {% for row in head %}
  52. {% for c in row %}{%- if not loop.first %} & {% endif %}{{parse_header(c, multirow_align, multicol_align, siunitx)}}{% endfor %} \\
  53. {% endfor %}
  54. {% if midrule is not none %}
  55. \{{midrule}}
  56. {% endif %}
  57. \endhead
  58. {% if midrule is not none %}
  59. \{{midrule}}
  60. {% endif %}
  61. \multicolumn{% raw %}{{% endraw %}{{body[0]|length}}{% raw %}}{% endraw %}{r}{Continued on next page} \\
  62. {% if midrule is not none %}
  63. \{{midrule}}
  64. {% endif %}
  65. \endfoot
  66. {% set bottomrule = parse_table(table_styles, 'bottomrule') %}
  67. {% if bottomrule is not none %}
  68. \{{bottomrule}}
  69. {% endif %}
  70. \endlastfoot
  71. {% for row in body %}
  72. {% for c in row %}{% if not loop.first %} & {% endif %}
  73. {%- if c.type == 'th' %}{{parse_header(c, multirow_align, multicol_align)}}{% else %}{{parse_cell(c.cellstyle, c.display_value, convert_css)}}{% endif %}
  74. {%- endfor %} \\
  75. {% if clines and clines[loop.index] | length > 0 %}
  76. {%- for cline in clines[loop.index] %}{% if not loop.first %} {% endif %}{{ cline }}{% endfor %}
  77. {% endif %}
  78. {% endfor %}
  79. \end{longtable}
  80. {% raw %}{% endraw %}