pivot-table: Implement hiding footnotes.
[pspp] / src / output / tex.c
index 2d29c2aa85629affce079eb58cf146e347af703b..c5591011f8e81ea99b57d78897c0cf5f63fa8648 100644 (file)
@@ -389,16 +389,21 @@ tex_put_footnote_markers (struct tex_driver *tex,
                           const size_t *footnote_indexes,
                           size_t n_footnotes)
 {
-  if (n_footnotes > 0)
-    shipout (&tex->token_list, "$^{");
+  size_t n_visible = 0;
   for (size_t i = 0; i < n_footnotes; i++)
     {
       const struct pivot_footnote *f = pt->footnotes[footnote_indexes[i]];
-      char *marker = pivot_value_to_string (f->marker, pt);
-      tex_escape_string (tex, marker, true);
-      free (marker);
+      if (f->show)
+        {
+          if (!n_visible++)
+            shipout (&tex->token_list, "$^{");
+
+          char *marker = pivot_footnote_marker_string (f, pt);
+          tex_escape_string (tex, marker, true);
+          free (marker);
+        }
     }
-  if (n_footnotes > 0)
+  if (n_visible)
     shipout (&tex->token_list, "}$");
 }
 
@@ -562,7 +567,7 @@ tex_output_table_layer (struct tex_driver *tex, const struct pivot_table *pt,
 
   for (int i = 0; i < n_footnotes; ++i)
     {
-      char *marker = pivot_value_to_string (footnotes[i]->marker, pt);
+      char *marker = pivot_footnote_marker_string (footnotes[i], pt);
       char *content = pivot_value_to_string (footnotes[i]->content, pt);
 
       shipout (&tex->token_list, "$^{");