Apostrophes in system fonts

Hi all, I sent this at first to the mailing list but now I am realizing that this forum is probably the preferred place to ask for help.

I am experimenting with using TeXmacs to prepare some lecture notes and it’s really cool so far! I have one little problem that I hope you can help me with. When I am using a font other than the default (such as Linux Libertine), I notice that the rendering of apostrophes is as tick marks [’] rather than a proper apostrophe [’]. For example, here is an example of a piece of text I cannot get to look write when I type it in:

In the spirit of Halmos’ book,

If I enter that into TeXmacs using the apostrophe key, it is rendered as a straight tick mark. I am on the macOS platform, and so I also tried using the system-wide keyboard shortcut to insert an actual curly apostrophe (alt-shift-]) and this had the same effect.

Can you provide some advice for how I should enter apostrophes into TeXmacs when using fonts other than “TeXmacs Computer Modern” and the other built-in TeXmacs fonts?

1 Like

Hello @jonsterling and welcome to the TeXmacs community!

The forum has definitely been more active than the users mailing list lately :slight_smile:

Could you try and see if ' Tab (apostrophe followed by Tab) is what you need?

1 Like

Hi @jeroen, thank you so much! That worked perfectly. I really appreciate your help!

2 Likes

Although JvdH responds much more on the mailing list than on the forum (in the few years in which I have been following the mailing list, sometimes he does not appear on the mailing list for a few months, then he is back and responds with regularity).

1 Like

I noticed another problem related to this, now involving BibTeX. Have a look at the following screenshot:

In the above, the apostrophe in the [Grothendieck, 1957] entry is rendered incorrectly. I think this is probably not noticeable to most TeXmacs users because the builtin TeXmacs fonts render even a straight apostrophe as a curly apostrophe. But other fonts, such as Libertine (which is used by the acmart styles), do not have this rendering behavior.

Because BibTeX databases usually come from LaTeX projects, where the behavior is to automatically fix apostrophes, it seems that a more desirable behavior for TeXmacs would be to copy that behavior — but I of course don’t know the implications.

Does anyone have any thoughts, or suggestions for how I might move forward? I can’t change the .bib file, because I have to share that with LaTeX projects.

This is odd, as it works correctly in the builtin bibliography database. If I try a linked bibtex file, both U+0027 (plain, straight apostrophe) and U+2019 (right single quotation mark, curly) get rendered straight. Somewhere there along the way there seems to be a conversion happening.

If you want to try it with my database just in case, here is the file: https://github.com/jonsterling/bibtex-references/blob/master/refs-bibtex.bib

According to https://www.johndcook.com/unicode_latex.html the LaTeX command \rq should give the curly apostrophe, but this also gives a straight apostrophe in TeXmacs. This seems to happen in line 763 of src/Data/Convert/Tex/fromtex.cpp. I don’t know if this will fix the other conversion.

Are you using bibtex or the internal bibliography compiler? (this is determined by whether the bibliography style starts with “tm-” or not)

@mgubi Thanks for your question, it appears that I am using bibtex from the code depicted below:

You could also find out by putting your cursor in the bibliography, but before the first bibitem, and look into the focus bar, it will show you the arguments to bibliography. What happens if you instead replace “plainnat” with “tm-plainnat”? (I do not remember if it exists or not, however).

I think tm-plainnat doesn’t exist; I tried it and received the following result:

Indeed, I checked and it is not there. Creating your own style file with scheme is not difficult. See e.g. $TEXMACS_PATH/progs/bibtex/plain.scm. Here: About bibliography in TeXmacs you find an example of a custom bibliography style. You can install them in your $TEXMACS_HOME_PATH.

Anyway the problem with the apostrophe is real, so we need to understand how to properly address it. Suggestions? @jeroen?

1 Like

I’ve been doing some debugging and this is what I’ve got so far. The actual conversion happens in src/Data/Convert/BibTeX/parsebib.cpp. There the function western_to_cork is called on the input bibtex string. This function is defined in src/Data/String/wencoding.cpp, where the apostrophe changes in the function convert (s, "UTF-8", "Cork"). This uses utf8_to_cork.

2 Likes

I guess the conversion tables are those defined in $TEXMACS_PATH/langs/encoding/. In particular there is

("#2019"	"'")		; right single quotation mark

2 Likes

Yes, I just came to the same conclusion :slight_smile:
Removing that line gives the right apostrophe.

I think it would be useful to submit a bug report. I would like to check with Joris the reason of that conversion.

Yes, definitely, this is a frequently used function, so this would need to be thoroughly checked.

1 Like

For reference:
https://savannah.gnu.org/bugs/index.php?62396

2 Likes