Skip to content

Commit a6fa8fb

Browse files
authored
Until solved, disallow subplot tags with Latex (#8018)
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.
1 parent e37ead6 commit a6fa8fb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/gmt_plot.c

+8
Original file line numberDiff line numberDiff line change
@@ -9250,6 +9250,13 @@ struct PSL_CTRL *gmt_plotinit (struct GMT_CTRL *GMT, struct GMT_OPTION *options)
92509250
/* Place the panel tag, once per panel (if requested), then update the gmt.panel file to say we have been there */
92519251
if (strcmp (P->tag, "-")) { /* Place the panel tag */
92529252
int form, refpoint, justify;
9253+
9254+
if (gmt_text_is_latex (GMT, P->tag)) { /* LaTeX commands, i.e., "....@[LaTeX...@[ ..." or "....<math>LaTeX...</math> ..." not supported in tags */
9255+
/* See branch latex-in-subplot-tags. We get gs error when I tried to implement the standard solution inside the PSL_completion function.
9256+
* More work is needed to learn what goes wrong, probably by asking on the ghostscript help/support line. */
9257+
GMT_Report (GMT->parent, GMT_MSG_WARNING, "Latex expressions are not (yet) supported as subplot panel tags - use text instead\n");
9258+
goto no_latex_tags;
9259+
}
92539260
refpoint = gmt_just_decode (GMT, P->refpoint, PSL_NO_DEF); /* Convert XX refpoint code to PSL number */
92549261
gmtlib_refpoint_to_panel_xy (GMT, refpoint, P, &plot_x, &plot_y); /* Convert just code to panel location */
92559262
/* 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)
92969303
PSL_comment (PSL, "End of panel tag for panel (%d,%d)\n", P->row, P->col);
92979304
PSL_command (PSL, "U\n}!\n");
92989305
}
9306+
no_latex_tags:
92999307
/* Store first = 0 since we are done with -B and the optional tag */
93009308
if (gmt_set_current_panel (GMT->parent, GMT->current.ps.figure, P->row, P->col, P->gap, P->tag, 0))
93019309
return NULL; /* Should never happen */

0 commit comments

Comments
 (0)