From 5d1f571d30d5a540292566a73787e42ed21eca38 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 6 Jan 2025 22:27:43 +0800 Subject: [PATCH] doc: Fix typos in text docs (#8671) * doc: Fix typos in text docs * More updates --------- Co-authored-by: Remko Scharroo --- doc/rst/source/text.rst | 28 ++++++++++++++++------------ src/pstext.c | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/doc/rst/source/text.rst b/doc/rst/source/text.rst index 16685b916a7..f1ade3ae8b8 100644 --- a/doc/rst/source/text.rst +++ b/doc/rst/source/text.rst @@ -168,9 +168,9 @@ Optional Arguments [0/0]. If *dy* is not specified then it is set equal to *dx*. Prepend an optional directive: - - **-j** - Offset the text away from the point instead (i.e., the + - **j** - Offset the text away from the point instead (i.e., the text justification will determine the direction of the shift). - - **-J** - Shorten diagonal offsets at corners by :math:`\sqrt{2}`. + - **J** - Shorten diagonal offsets at corners by :math:`\sqrt{2}`. Optionally, append the modifier: @@ -196,10 +196,12 @@ Optional Arguments at the Upper Left corner of the map. - **+f** - Set the font ([*size*][,\ *fontname*][,\ *color*]); if no font info is given then the input file must have this information in one of its columns. - - **+h** - Use the most recent segment header as the text to be plotted. - comes from the data record. Instead, use **+h** or **+l** to select the - **+j** - Set the text justification; if no justification is given then the input file must have this item as a column. + + Normally, the text is read from the data records. Alternative ways to provide text: + + - **+h** - Use the most recent segment header as the text to be plotted. - **+l** - Use the most recent segment label as the text to be plotted. - **+r** - Use the record number (counting up from *first* [0]) as the text to be plotted. - **+t** - Use the appended *text* to set a fixed text string (if *text* contains plus @@ -207,14 +209,16 @@ Optional Arguments - **+z** - Format incoming *z* values to a string using the supplied *format* [if not appended we use :term:`FORMAT_FLOAT_MAP`]. - **Notes**: (1) If |-Z| is in effect then the *z* value used for formatting is in the - 4th, not 3rd column. If you only want a specific word from the trailing text and - not the whole line, use **-it**\ *word* to indicate which word (0 is the first word) - you want. (2) Items read from the data file should be in the same order as - the modifiers are specified with the |-F| option. Example: - **-F**\ **+f**\ 12p,Helvetica-Bold,red\ **+j+a** selects a 12p red - Helvetica-Bold font and expects to read the justification and angle - from the file, in that order, after *x* *y* and before *text*. + **Notes**: |-F|\ **+h**\|\ **l**\|\ **r**\|\ **t**\| **z** can't be used with |-M|. + + **Notes**: (1) If |-Z| is in effect then the *z* value used for formatting is in the + 4th, not 3rd column. If you only want a specific word from the trailing text and + not the whole line, use **-it**\ *word* to indicate which word (0 is the first word) + you want. (2) Items read from the data file should be in the same order as + the modifiers are specified with the |-F| option. Example: + **-F**\ **+f**\ 12p,Helvetica-Bold,red\ **+j+a** selects a 12p red + Helvetica-Bold font and expects to read the justification and angle + from the file, in that order, after *x* *y* and before *text*. .. _-G: diff --git a/src/pstext.c b/src/pstext.c index ae84439cab3..e00f5eb93e2 100644 --- a/src/pstext.c +++ b/src/pstext.c @@ -713,7 +713,7 @@ static int parse (struct GMT_CTRL *GMT, struct PSTEXT_CTRL *Ctrl, struct GMT_OPT n_errors += gmt_M_check_condition (GMT, Ctrl->G.mode && Ctrl->M.active, "Option -Gc: Cannot be used with -M.\n"); n_errors += gmt_M_check_condition (GMT, Ctrl->G.mode && Ctrl->W.active, "Option -Gc: Cannot be used with -W.\n"); n_errors += gmt_M_check_condition (GMT, Ctrl->G.mode && Ctrl->D.line, "Option -Gc: Cannot be used with -D...v.\n"); - n_errors += gmt_M_check_condition (GMT, Ctrl->M.active && Ctrl->F.get_text, "Option -M: Cannot be used with -F...+l|h.\n"); + n_errors += gmt_M_check_condition (GMT, Ctrl->M.active && Ctrl->F.get_text, "Option -M: Cannot be used with -F...+l|h|r|t|z.\n"); n_errors += gmt_M_check_condition (GMT, Ctrl->S.active && !(Ctrl->G.active && Ctrl->G.mode == 0), "Option -S: Requires -G as well.\n"); n_errors += gmt_M_check_condition (GMT, strchr ("cC", Ctrl->C.mode) && !Ctrl->M.active, "Option -C: Box shape mode +tc|C is only available when -M is selected.\n");