How to choose stix two in TeXmacs?

STIX 2 (https://github.com/stipub/stixfonts) has been around for quite some time. However, I haven’t been able to make it work with TeXmacs. I have installed the font in my machine (Windows), but it does not show up in the format -> font dialogue.

Can I use STIX 2 in TeXmacs?

Have you run the font detection tool? It’s under “Tools → Fonts → Look for more fonts”.

If you can run TeXmacs from the terminal it should tell you which font files it is picking up while doing the font detection. I have STIX 2 installed and it is being picked up by TeXmacs.

If it’s not being picked up, it may not be installed in a directory TeXmacs is looking in. For Windows these should be $TEXMACS_HOME_PATH/fonts/truetype, $TEXMACS_PATH/fonts/truetype and $windir/Fonts.

I don’t have a Windows installation at my disposal, so I can’t say what these path are exactly. You can find out the value of environment variables by inserting a Scheme session into a TeXmacs document and evaluating one of these:

(getenv "TEXMACS_HOME_PATH")
(getenv "TEXMACS_PATH")
(getenv "windir")

Thank you. I used import function in the Font dialogue and now I can choose STIX 2 in TeXmacs.

However, I was expecting STIX 2 showing up here. Maybe there’s no easy way to do this.

That list is coded in TeXmacs/progs/generic/document-menu.scm.

You can add menu items to it by running code like this in a Scheme session:

(menu-bind document-short-font-menu
(former)
---
("Stix2" (init-font "Stix Two Text" "Stix Two Math")))

However, this doesn’t seem to work for me for Stix Two. It does work for other fonts, though. (EDIT: this code doesn’t work in my-ini-texmacs.scm as the menu has not yet been created at that point.)

Something is preventing Stix Two to be selected in general. Even if I select “Stix Two Text” from the more elaborate font selection window, the document gets typeset in Stix1. I can only get text to appear in Stix Two font by selecting text and doing Format → Font for that piece of text.

As for Stix Two not being selected, it seems there are (at least) two ways to set the document font, either through (init-font "Stix Two Text") or through (init-env "font" "Stix Two Text").

init-font contains some code that selects the v1 STIX fonts whenever the font name start with “Stix”. The second command with init-env does change the document fonts to STIX v2.

This probably should be reported as a bug IMO (easiest by you if possible as you have a grasp of the details).

2 Likes

Agreed :slightly_smiling_face:

1 Like

I think it would be ok to file a bug request to update STIX to version 2 as default.

I would rather let @jeroen do it, as I have still no insight on how fonts work :slight_smile:

I think the original stix should still be available, since stix two is not strictly better than stix one.

@mistguy can you be more specific? I think is important to have a clear picture of what is the current situation. If I look here https://www.stixfonts.org/#about I see that they propose only Stix2 as (main) download. So I would think the message is that v1 is superseded by v2. What is the history? Why v1 is better than v2?

Any fixes only seem to be released in the v2 font, so it does seem like v2 is intended to replace v1.

That being said, the v1 and v2 fonts have different font names (“Stix” and “Stix Two” resp.) so even if v2 were to become the default for TeXmacs, you can still install v1 and select it.

An easy fix could be to rename the font files Stix2 or any other name, so that TeXmacs does not detect it as “Stix”, this should solve the problem. And file a bug report saying that the current behaviour prevents to install the font. I had similar problems with “Fira Sans” which was shortened in “Fira”…

I submitted a feature request:
https://savannah.gnu.org/bugs/?60272

Looking at the code, it may take a bit of effort. There a suprising amount of Stix specific code.

A workaround for this is to delay the creation of the new menu like this:

(delayed (:idle 1000) (menu-bind document-short-font-menu
  (former)
  ---
  ("Stix2" (init-env "font" "Stix Two Text") (init-env "math-font" "Stix Two Math")))
)

This gives you an option for Stix2 in the font selection from the toolbar.
I’ve tried it and it seems to work for both text and math.

One problem that I have already noticed is the ugly integral sign that TeXmacs picks up:

That’s probably one of those adjustments that need to be done by hand in the code.

Stix is indeed superseded by Stix v2. I was only offering a personal opinion: v2 is designed from scratch and probably they should be regarded as different fonts.

Personally, I sometime favor v1 since it’s more compact, but I would also be happy if v2 completely replaces v1 in TeXmacs.

I think we are going to support both, they seems indeed to be quite different and we have already some specific tuning for Stix1 which we do not want to remove. I’m working on a general solution for unicode fonts, including Stix2 and some other, but this requires still some work.