X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Ftex.c;h=722549097b0a68d7bef4c89e7c592f23b739d522;hb=6fa20f2f419eac61340d9b93d5cdde01c281c9ec;hp=4191e6938179b30fa420540830f4b59b9fca8a82;hpb=4ab3ada839067eaee164be95efc0df37df6bce62;p=pspp diff --git a/src/output/tex.c b/src/output/tex.c index 4191e69381..722549097b 100644 --- a/src/output/tex.c +++ b/src/output/tex.c @@ -36,7 +36,7 @@ #include "libpspp/message.h" #include "libpspp/temp-file.h" #include "libpspp/version.h" -#include "output/cairo.h" +#include "output/cairo-chart.h" #include "output/chart-item.h" #include "output/driver-provider.h" #include "output/message-item.h" @@ -66,6 +66,7 @@ struct tex_driver struct output_driver driver; /* A hash table containing any Tex macros which need to be emitted. */ struct hmap macros; + bool require_graphics; #ifdef HAVE_CAIRO struct cell_color fg; struct cell_color bg; @@ -132,8 +133,8 @@ tex_create (struct file_handle *fh, enum settings_output_devices device_type, fh_get_file_name (fh))); tex->chart_cnt = 1; #ifdef HAVE_CAIRO - parse_color (d, o, "background-color", "#FFFFFFFFFFFF", &tex->bg); - parse_color (d, o, "foreground-color", "#000000000000", &tex->fg); + tex->bg = parse_color (opt (d, o, "background-color", "#FFFFFFFFFFFF")); + tex->fg = parse_color (opt (d, o, "foreground-color", "#000000000000")); #endif tex->file = fn_open (tex->handle, "w"); @@ -215,8 +216,6 @@ tex_destroy (struct output_driver *driver) shipout (&tex->preamble_list, "%%%% Define the horizontal space between table columns\n"); shipout (&tex->preamble_list, "\\def\\psppcolumnspace{1mm}\n\n"); - shipout (&tex->preamble_list, "\\input graphicx\n\n"); - char *ln = get_language (); if (ln) shipout (&tex->preamble_list, "%%%% Language is \"%s\"\n", ln); @@ -260,6 +259,9 @@ tex_destroy (struct output_driver *driver) } hmap_destroy (&tex->macros); + if (tex->require_graphics) + shipout (&tex->preamble_list, "\\input graphicx\n\n"); + post_process_tokens (tex->file, &tex->preamble_list); shipout (&tex->token_list, "\n\\bye\n"); @@ -327,6 +329,7 @@ tex_submit (struct output_driver *driver, // printf ("The chart title is %s\n", title); shipout (&tex->token_list, "\\includegraphics{%s}\n", file_name); + tex->require_graphics = true; free (file_name); } } @@ -350,10 +353,6 @@ tex_submit (struct output_driver *driver, shipout (&tex->token_list, "}\\par\n\n"); break; - case TEXT_ITEM_EJECT_PAGE: - /* Nothing to do. */ - break; - case TEXT_ITEM_SYNTAX: /* So far as I'm aware, this can never happen. */ default: