You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Think you can use @%font%...@%% to change the font to your liking. I don't think we want a fixed system unless we assume there is at most one \n and it truly is a title/subtitle 1-2 system. But I do think your suggestion makes it simpler to implement (again, assuming anything after the first \n is a subtitle set at a smaller size, say 0.8*FONT_TITLE or a new FONT_SUBTITLE defaulting to 0.8...
Perhaps @joa-quim and @seisman have opinion on the font-setting issue for multiple lines? I am bored and eager to code this up before afternoon coffee.
Sometimes people just want to split a long title into two lines. The second line doesn't have to be a subtitle. I believe it will surprise people that the second line has different font size.
Yes, I like that, or perhaps \r for continuation of title (same font) and \n for smaller subtitle. None of those characters are actually used when we typeset the PS so we could just assign those two functions and be done with it (a second \n just means the subtitle continues on more than one line with no further font changes.
Can we make it \r => \continue and \n => \subtitle? (or #continue if \c causes troubles) \r & \n are very natural to our C-ish thinking but we want to go for longoptions
We could do both - easy to check for unique things like \continue, \subtitle. But we also want \r, \n. OK, only leftover item to discuss is FONT_SUBTITLE versus a fixed 0.8 (or some factor) of FONT_TITLE. Preferences? I an already see a feature request coming to make smaller subtitles than whatever factor we pick, hence FONT_SUBTITLE is OK with me.
Yes for an optional FONT_SUBTITLE. The other feature request I would foresee is "Make my subtitles Italic".
But can we also have both here? I.e default to 0.8 * FONT_TILE but allow other FONTs.
Hm, I think all we can do is default to 0.8 with same font and you can change, just like the other FONT_*. Making a new scheme just for this font is not great. And anyway, you can always use @%font% as well.
Let's not over-engineer this yet 😅 The scaling idea is nice but I think having FONT_SUBTITLE as something like 18p,Helvetica,black will do for now (a scaled down version of FONT_TITLE). If someone wants to change the TITLE and SUBTITLE font, they can always gmt set both. And with italics, they could do FONT_SUBTITLE=18p,Helvetica-Oblique,black or similar.
Testing this in branch sub-titles. Since it is hard to get actual \r and \n characters into the string I cheated (at least for now) and use ^ and ~ instead, respectively. With that, these things work:
Breaking up a long title:
gmt basemap -R0/10/0/10 -Baf -B+t"My extremely long title and awkward title^must go over two lines^or perhaps three even" -png three
Title with subtitle(s):
gmt basemap -R0/10/0/10/0/10 -JZ3i -Baf -B+t"My extremely long title and awkward title:~Must go over two lines~or perhaps three even" -png sub
Some technical comments:
I chose a line-spacing of 1.1 times the font size here
The new FONT_SUBTITLE is set to 20p while title is 24p. Seems perhaps it should be 18?
Using \r and \n means users have to do either "\\r and \\n" or '\r and \n' due to quoting rules. Even then, inside GMT these are \ two-char sequences which makes splitting words harder than if we had 1-char symbols. Same if we did #break and #subtitle. No need if ^ and ~ were acceptable. I know I am being a bit lazy here - what you think?
To avoid complications I do not allow both ^ and ~ in the same title.
We already have the +fontsize option to scale all fonts proprtionally. I do not want SUBTITLE to be any different from the other 4-5 font options we have.
We can worry about adding longer keys later - note these are not program options, just escape sequences. If we can agree on what those should be (e.g., #break; #sub; ?) then I can do that coding, but for now the shorthands ^ and ~ seems OK to me too.
Well, given the syntax for title is -B+ttitle we cannot replace GMT modifiers (+t) with a different syntax (+\title) since the vast majority of GMT modifiers have nothing to do with Latex or text. So it has to remain -B+tstring, but what is inside the string is (still) up for debate. FYI, when GMT will offer longer keyword/value from the command line then +t will become +title=title. Which begs the question, perhaps the subtitle part could be solved by adding +ssubtitle (and eventually +subtitle=text). That would eliminate the need for an escape sequence for subtitles, just need one for breaking long lines.
Using backslashes in text given on the commandline is not straightforward and may require careful quoting or escaping, hence that route is not great for that reason. For most mortals not versed in Latex, I think #linefeed; and #subtitle; are pretty good but perhaps there are even better ones if we brainstorm more. I think the are both a bit on the long side, which is why I suggested #break; and #sub; but the latter is not obvious.
Hm, looks to me adding +ssubtitle to -B for the frame would simplify this whole thing, just requiring multi-line support for both title and the optional subtitle. Agree with that, @GenericMappingTools/core ?
This would allow us to use the shorthand ^ for multiline breaks in title and subtitle, and perhaps #break; would be acceptable to you as the single long-form command needed?
That works for me, unless there's a reason to have mutually exclusive modifiers for frame and axes parameters in -B. Currently it seems like there's no overlap, so +s would be the first with subtitle and upper/right axis label for frame and axes respectively.
Yes, there will not be a parsing conflict because frame and axes are processed separately. Furthermore, +s requires you to also set +t since you cannot have a subtitle without a title.
Well you would do y = a@+X@+ + b, no?
Paul Wessel, Professor and Chair
Dept. of Earth Sciences (formerly Geology & Geophysics)
SOEST, U of Hawaii at Manoa
Yes, I can do @^ or #break;, and perhaps we don't actually need #break; unless anyone feels @^ can appear in useful text. I have already implemented the hard part so now know what to do. I will switch from ^ to @^ first and people can tell me if #break; is still needed.
Activity
PaulWessel commentedon Dec 8, 2020
Think you can use @%font%...@%% to change the font to your liking. I don't think we want a fixed system unless we assume there is at most one \n and it truly is a title/subtitle 1-2 system. But I do think your suggestion makes it simpler to implement (again, assuming anything after the first \n is a subtitle set at a smaller size, say 0.8*FONT_TITLE or a new FONT_SUBTITLE defaulting to 0.8...
PaulWessel commentedon Dec 8, 2020
Perhaps @joa-quim and @seisman have opinion on the font-setting issue for multiple lines? I am bored and eager to code this up before afternoon coffee.
seisman commentedon Dec 8, 2020
Sometimes people just want to split a long title into two lines. The second line doesn't have to be a subtitle. I believe it will surprise people that the second line has different font size.
joa-quim commentedon Dec 8, 2020
I agree with Dongdong, but easy to have both. Use a double
\n(\n\n) to have a subtitle.PaulWessel commentedon Dec 8, 2020
Yes, I like that, or perhaps \r for continuation of title (same font) and \n for smaller subtitle. None of those characters are actually used when we typeset the PS so we could just assign those two functions and be done with it (a second \n just means the subtitle continues on more than one line with no further font changes.
joa-quim commentedon Dec 9, 2020
Can we make it
\r=>\continueand\n=>\subtitle? (or#continueif\ccauses troubles)\r&\nare very natural to our C-ish thinking but we want to go for longoptionsPaulWessel commentedon Dec 9, 2020
We could do both - easy to check for unique things like \continue, \subtitle. But we also want \r, \n. OK, only leftover item to discuss is FONT_SUBTITLE versus a fixed 0.8 (or some factor) of FONT_TITLE. Preferences? I an already see a feature request coming to make smaller subtitles than whatever factor we pick, hence FONT_SUBTITLE is OK with me.
joa-quim commentedon Dec 9, 2020
Yes for an optional FONT_SUBTITLE. The other feature request I would foresee is "Make my subtitles Italic".
But can we also have both here? I.e default to 0.8 * FONT_TILE but allow other FONTs.
PaulWessel commentedon Dec 9, 2020
Hm, I think all we can do is default to 0.8 with same font and you can change, just like the other FONT_*. Making a new scheme just for this font is not great. And anyway, you can always use @%font% as well.
weiji14 commentedon Dec 9, 2020
Let's not over-engineer this yet 😅 The scaling idea is nice but I think having
FONT_SUBTITLEas something like18p,Helvetica,blackwill do for now (a scaled down version ofFONT_TITLE). If someone wants to change the TITLE and SUBTITLE font, they can alwaysgmt setboth. And with italics, they could doFONT_SUBTITLE=18p,Helvetica-Oblique,blackor similar.PaulWessel commentedon Dec 9, 2020
Testing this in branch sub-titles. Since it is hard to get actual \r and \n characters into the string I cheated (at least for now) and use ^ and ~ instead, respectively. With that, these things work:
Breaking up a long title:
gmt basemap -R0/10/0/10 -Baf -B+t"My extremely long title and awkward title^must go over two lines^or perhaps three even" -png threeTitle with subtitle(s):
gmt basemap -R0/10/0/10/0/10 -JZ3i -Baf -B+t"My extremely long title and awkward title:~Must go over two lines~or perhaps three even" -png subSome technical comments:
#breakand#subtitle. No need if ^ and ~ were acceptable. I know I am being a bit lazy here - what you think?joa-quim commentedon Dec 9, 2020
^and~to\n&\rwhich are very programmer specific lingo. But longoptions will require > 1 char keys.PaulWessel commentedon Dec 9, 2020
We can worry about adding longer keys later - note these are not program options, just escape sequences. If we can agree on what those should be (e.g., #break; #sub; ?) then I can do that coding, but for now the shorthands ^ and ~ seems OK to me too.
PaulWessel commentedon Dec 9, 2020
OK, once I have wrapped out the outline for the NASA proposal I can implement stuff like
#break;and#sub;if that is OK with you fine folks.7 remaining items
joa-quim commentedon Dec 9, 2020
Yes, you are in serious risk that the sky falls over your head. 😄
PaulWessel commentedon Dec 9, 2020
Well, given the syntax for title is -B+ttitle we cannot replace GMT modifiers (+t) with a different syntax (+\title) since the vast majority of GMT modifiers have nothing to do with Latex or text. So it has to remain -B+tstring, but what is inside the string is (still) up for debate. FYI, when GMT will offer longer keyword/value from the command line then +t will become +title=title. Which begs the question, perhaps the subtitle part could be solved by adding +ssubtitle (and eventually +subtitle=text). That would eliminate the need for an escape sequence for subtitles, just need one for breaking long lines.
Using backslashes in text given on the commandline is not straightforward and may require careful quoting or escaping, hence that route is not great for that reason. For most mortals not versed in Latex, I think
#linefeed;and#subtitle;are pretty good but perhaps there are even better ones if we brainstorm more. I think the are both a bit on the long side, which is why I suggested#break;and#sub;but the latter is not obvious.PaulWessel commentedon Dec 9, 2020
Hm, looks to me adding +ssubtitle to -B for the frame would simplify this whole thing, just requiring multi-line support for both title and the optional subtitle. Agree with that, @GenericMappingTools/core ?
PaulWessel commentedon Dec 9, 2020
This would allow us to use the shorthand
^for multiline breaks in title and subtitle, and perhaps#break;would be acceptable to you as the single long-form command needed?maxrjones commentedon Dec 9, 2020
That works for me, unless there's a reason to have mutually exclusive modifiers for frame and axes parameters in -B. Currently it seems like there's no overlap, so +s would be the first with subtitle and upper/right axis label for frame and axes respectively.
PaulWessel commentedon Dec 9, 2020
Yes, there will not be a parsing conflict because frame and axes are processed separately. Furthermore, +s requires you to also set +t since you cannot have a subtitle without a title.
joa-quim commentedon Dec 9, 2020
👍 +subtitle
seisman commentedon Dec 10, 2020
+1 for +subtitle
What if users want to have the character
^in the title? How do they escape it?PaulWessel commentedon Dec 10, 2020
seisman commentedon Dec 10, 2020
I mean, if I give a title
This is a title (Y=a^X+b). Will GMT split it into two lines?Edit: why the

)is missing?PaulWessel commentedon Dec 10, 2020
PaulWessel commentedon Dec 10, 2020
weiji14 commentedon Dec 10, 2020
Would it be easier if we had a character escape sequence for newline? E.g.
@^or something else indicates a line break.PaulWessel commentedon Dec 10, 2020
Yes, I can do
@^or#break;, and perhaps we don't actually need #break; unless anyone feels @^ can appear in useful text. I have already implemented the hard part so now know what to do. I will switch from ^ to @^ first and people can tell me if#break;is still needed.