Printing letter C with caron

I need to annotate some maps that have the letter “c” with a caron (upside-down hat). This letter is commonly used in Czech, Slovak, Serbo-Croation, etc. languages.

I do not see an octal code for this character. How can it be printed within GMT?

Do you have Latex installed ?

I have TeXShop installed. Will that do?

Check it:

gmt begin GMT_latex
	gmt set GMT_THEME cookbook
	gmt basemap -R-200/200/0/2 -JX15c -Bxaf+l"@[\nabla^4 \psi - \Delta \sigma_{xx}^2@[ (MPa)" -BS
gmt end show

I get a nice scale bar with some text below. So I guess I have it! Never used LaTeX before!

Now you can try "@[\v{c}@["

I tried taking your expression and including the c-caron:

gmt begin GMT_latex
	gmt set GMT_THEME cookbook
	gmt basemap -R-200/200/0/2 -JX15c -Bxaf+l"@[ \v{c} \nabla^4 \psi - \Delta \sigma_{xx}^2@[ (MPa)" -BS
gmt end show

But nothing appears like a “č”, in the output PDF.

I just read chapter 13 in the GMT technical reference and saw the recommended TeX iinstallation. I’ve installed the texlive apps through MacPorts. That didn’t help. The @[\v{c}@[ still isn’t showing up in the output PDF.

Do you have an error message or something?
Does the first command ressembles this :


Yes, looks just like that, on the first try. But still looks like that when I used the \v{c} in my second try. No error messages.

try \capitalcaron{c} ?

Nice try, but not getting it yet. I tried this:

gmt begin GMT_latex
	gmt set GMT_THEME cookbook
	gmt basemap -R-200/200/0/2 -JX15c -Bxaf+l"@[\capitalcaron{c}@[ (MPa)" -BS
gmt end show

and got this:

Try \check{c}

Yes, that works, but the “c” is italic.

Additionally, the situation I’m working involves a list of items that I pass through pstext, inside of a non-LaTeX, classic GMT mode, script (in x y text format).

Although you’ve taught me how to create a c with a caron, I’m not sure how to adapt my script to read this list of items and translate the č characters that appear in the list to something GMT can print on a map/graphic.

Have you tried to just update the 3rd column ?

I think all text in latex is italic. Maybe some \normal{\check{c}} could modify the style?

Yes, Gus, that is what I’m trying to do. I was successful with the \check{c}, but it came out as italic, which didn’t look good in the middle or end of a person’s name.

I even went as far as trying to use the over-strike escape sequence (@!) but was only able to get the caron next to the letter c.

Using this entry (from my list):

   168.8    77.2 Milankovi@[\normal{\check{c}}@[

yielded this output:

Screenshot 2024-05-06 at 11.41.48 AM

ugly but seems working; nobody will probably like it.
the character code comes from ISO/IEC 8859-2 - Wikipedia

gmt basemap -R-200/200/0/2 -JX5c/0c -Bxaf+l"Milankovi\350" -png char --PS_CHAR_ENCODING=ISO-8859-2


Thanks, mkono, I think that is the answer. Just need to get the s and r with the carons. I’ll study the character codes.

That \check{c} is in math-mode, so I guess that @[ ... @[ syntax is for TeX math mode (and that explains the italic). In that case \text{\Milankovi\v{c}} might work but would be in the TeX font, probably not what you want – using the ISO8850-2 code codes does sound a better bet …

Hm. I just looked how this can be accomplished in PyGMT and at least for me, @! works to combine any letter with a v on top (\237):

import pygmt

size = 5

fig = pygmt.Figure()
    region=[-size, size, -size, size],
    frame="x+l@!s\\237  @!r\\237  @!c\\237",  # two \ needed in PyGMT / Python
fig.text(position="MC", text="@!s\\237  @!r\\237  @!c\\237")
fig.colorbar(cmap="batlow", position="jTC", frame="x+l@!s\\237  @!r\\237  @!c\\237")

somewhat nicer solution, using iconv to convert text labels into ISO-8859-2:

cat <<EOF | iconv -f utf8 -t iso8859-2 | gmt text -JX5c -R0/3/0/3 -F+jMC -png chars -Bxa -Bya -BWSen --PS_CHAR_ENCODING=ISO-8859-2
1    1 Milošević
2    2 Milankovič

I can imagine running iconv on the whole gmt shell script so all the utf text strings get converted into ISO-8859-2, including axis labels, titles that could not be specified in a separate text file. Could not quickly imagine a practical way of doing the same to a pygmt script.

Quite an annoying thing.