From b337f998a6d2f5e3c47364cda5fe3d70a8645932 Mon Sep 17 00:00:00 2001 From: Paul Wessel Date: Sun, 5 Nov 2023 17:16:46 +0100 Subject: [PATCH] Until solved, disallow subplot tags with Latex This PR implements a solution that skips any Latex tags for a panel rather than resulting in a ghostscript crash and no plot. SHould we solbe the issue later then we can work on the branch that tries to support it. --- src/gmt_plot.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gmt_plot.c b/src/gmt_plot.c index 34cc79d5a2e..c5bc18c2e11 100644 --- a/src/gmt_plot.c +++ b/src/gmt_plot.c @@ -9250,6 +9250,13 @@ struct PSL_CTRL *gmt_plotinit (struct GMT_CTRL *GMT, struct GMT_OPTION *options) /* Place the panel tag, once per panel (if requested), then update the gmt.panel file to say we have been there */ if (strcmp (P->tag, "-")) { /* Place the panel tag */ int form, refpoint, justify; + + if (gmt_text_is_latex (GMT, P->tag)) { /* LaTeX commands, i.e., "....@[LaTeX...@[ ..." or "....LaTeX... ..." not supported in tags */ + /* See branch latex-in-subplot-tags. We get gs error when I tried to implement the standard solution inside the PSL_completion function. + * More work is needed to learn what goes wrong, probably by asking on the ghostscript help/support line. */ + GMT_Report (GMT->parent, GMT_MSG_WARNING, "Latex expressions are not (yet) supported as subplot panel tags - use text instead\n"); + goto no_latex_tags; + } refpoint = gmt_just_decode (GMT, P->refpoint, PSL_NO_DEF); /* Convert XX refpoint code to PSL number */ gmtlib_refpoint_to_panel_xy (GMT, refpoint, P, &plot_x, &plot_y); /* Convert just code to panel location */ /* Undo any offsets above that was required to center the plot on the subplot panel */ @@ -9296,6 +9303,7 @@ struct PSL_CTRL *gmt_plotinit (struct GMT_CTRL *GMT, struct GMT_OPTION *options) PSL_comment (PSL, "End of panel tag for panel (%d,%d)\n", P->row, P->col); PSL_command (PSL, "U\n}!\n"); } +no_latex_tags: /* Store first = 0 since we are done with -B and the optional tag */ if (gmt_set_current_panel (GMT->parent, GMT->current.ps.figure, P->row, P->col, P->gap, P->tag, 0)) return NULL; /* Should never happen */