wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
482 stars 99 forks source link

Latin and Greek symbols with circumflex #1933

Closed danielvolinski closed 2 months ago

danielvolinski commented 4 months ago

Hi All,

Is there any way to issue a Latin or a Greek symbol with a circumflex (hat) accent on top of it, in a wxMaxima notebook? Thanks!

RoyalXXX commented 4 months ago

You can just copy the character you want from wherever and then paste into a wxMaxima notebook. Or use View/Sidebars/Unicode chars

danielvolinski commented 4 months ago

Please tell me where I can copy those character from. Thanks!

gunterkoenigsmann commented 4 months ago

wxMaxima's "View" menu offers to open a unicode sidebar with all unicode characters. The right-click menu of the symbols sidebar should do that, too. If you intent to use those symbols frequently you can even add them to the symbols sidebar.

gunterkoenigsmann commented 4 months ago

In case that unicode doesn't offer the char you want you can use a "combining circumflex" together with that unicode character.

daute commented 4 months ago

Unicode contains some letters with a circumflex, see: https://en.wikipedia.org/wiki/Circumflex#Unicode (you can copy these chars from there). Your selected font must also support these chars, it might be possible, that not all fonts contain all characters.

Best regards, Wolfgang

danielvolinski commented 4 months ago

Hi RoyalXXX, Gunter and Wolfgang for your input.

When I paste a character with a theta hat from a PDF file into wxMaxima I get the hat first and then theta.

I see no Greek letters with circumflex (hat) on top in the View->Sidebars->Unicode chars.

I've been trying for years to know how exactly you combine two characters into one to no avail. Could you please provide a detailed procedure how to combine a Unicode theta character with a Unicode hat combining character to get one theta hat character?

Thank again,

Daniel Volinski

RoyalXXX commented 4 months ago

It seems to me that this character is not in the Unicode. You need to use latex.

daute commented 4 months ago

Apart from some chars with an own (unicode) code point, Unicode combines two (or more) characters, e.g. the circumflex accent and a character to one char (https://en.wikipedia.org/wiki/Combining_character). It seems, that they can not easy entered in wxMaxima, one can select the 'combining' Unicode char in the Unicode side bar (search for "combining"), but the combining characters appear as two distinct chars.

However it seems, that one can 'cut-and-paste' these characters into wxMaxima - e.g. for greek characters with 'accents' from: https://en.wikipedia.org/wiki/Greek_diacritics

The PDF where you copied the char might not be using 'real Unicode', e.g. it might be typeset with Latex, which is an excellent typesetting system, but does probably "combine" the characters by itself (especially if it was compiled using pdflatex, which does not use/support Unicode).

Best regards, Wolfgang

robert-dodier commented 3 months ago

@danielvolinski You mentioned, "When I paste a character with a theta hat from a PDF file ..." Is there a URL for the file you are working with, or can you attach the file to this ticket? I am looking at this problem and it would be very helpful to have exactly the same file as you are working with.

danielvolinski commented 3 months ago

Hi Robert, I'm attaching a PDF file with r hat and theta hat.You can find those characters in formulas (5) and (6) or even in the text before formula (5). Daniel Volinski En lunes, 26 de agosto de 2024, 09:20:33 GMT+3, Robert Dodier @.***> escribió:

@danielvolinski You mentioned, "When I paste a character with a theta hat from a PDF file ..." Is there a URL for the file you are working with, or can you attach the file to this ticket? I am looking at this problem and it would be very helpful to have exactly the same file as you are working with.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

robert-dodier commented 3 months ago

@danielvolinski I have an idea for working with symbols which have names containing diacritical marks such as circumflex, arrow, etc. See: https://github.com/maxima-project-on-github/maxima-packages/tree/master/robert-dodier/combining_diacritics

The idea is that the user calls define_input_alias(alias_symbol, original_symbol, diacritic) and then when you type in alias_symbol, a symbol constructed from original_symbol + diacritic appears instead. The README there has some examples.

Give it a try if you are interested, I'll be interested to hear what you think. This business about working with diacritics can go in different directions; if this solution doesn't work for you, I have some other ideas.

danielvolinski commented 2 months ago

Hi Robert, Thank you for your contribution and sorry for the delay in responding.I 100% agree with your idea.However, from my testing in practice I see the following: define_input_alias(yhat,y,combining_circumflex); ŷ

define_input_alias(xbar,x,combining_macron); x̄ "in wxMaxima, I see the x and then to the right the macron"

define_input_alias(zdot,z,combining_dot); ż

define_input_alias(rarrow,r,combining_arrow); r⃗

define_input_alias(thetahat,theta,combining_circumflex); thetâ

define_input_alias(θhat,θ,combining_circumflex); θ̂  "in wxMaxima, I see the θ and then to the right the circumflex"

Thank you, Daniel Volinski

En martes, 27 de agosto de 2024, 09:15:37 GMT+3, Robert Dodier ***@***.***> escribió:  

@danielvolinski I have an idea for working with symbols which have names containing diacritical marks such as circumflex, arrow, etc. See: https://github.com/maxima-project-on-github/maxima-packages/tree/master/robert-dodier/combining_diacritics

The idea is that the user calls define_input_alias(alias_symbol, original_symbol, diacritic) and then when you type in alias_symbol, a symbol constructed from original_symbol + diacritic appears instead. The README there has some examples.

Give it a try if you are interested, I'll be interested to hear what you think. This business about working with diacritics can go in different directions; if this solution doesn't work for you, I have some other ideas.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

robert-dodier commented 2 months ago

Daniel, thanks for your reply. Can you give some additional information to help with debugging the problem. Specifically can you please paste the output of build_info() here, and can you export all the settings via: Edit menu >> Configure >> Revert all to defaults (last item in list on the let -- you might need to scroll down) >> Export all settings, and then attach the output file to this bug report. I will try the same settings and see if I can figure out what's going on.

danielvolinski commented 2 months ago

Hi Robert: Here it is: (%o1) build_info(version="5.38.1",timestamp="2016-06-12 17:13:34",host="i686-pc-mingw32",lisp_name="SBCL",lisp_version="1.3.4") Sorry, but don't see any Edit menu >> Configure >> Revert all to defaults >> Export all settings. Daniel Volinski

En viernes, 6 de septiembre de 2024, 00:55:15 GMT+3, Robert Dodier ***@***.***> escribió:  

Daniel, thanks for your reply. Can you give some additional information to help with debugging the problem. Specifically can you please paste the output of build_info() here, and can you export all the settings via: Edit menu >> Configure >> Revert all to defaults (last item in list on the let -- you might need to scroll down) >> Export all settings, and then attach the output file to this bug report. I will try the same settings and see if I can figure out what's going on.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

robert-dodier commented 2 months ago

Sorry for the delay, I'm just circling back to this topic. A couple of brief updates.

(1) I found some resources for so-called precomposed Unicode characters which are a single character combining a letter and a diacritic. There are some Latin and some Greek precomposed characters, however, in both cases these are not really enough for mathematical purposes: the Latin precomposed characters apparently do not cover the whole alphabet, and the Greek precomposed characters only include vowels, and don't include circumflex. So just using Unicode precomposed characters isn't enough, from what I can tell.

For the record, these are the resources I found:

https://en.wikipedia.org/wiki/List_of_precomposed_Latin_characters_in_Unicode

https://www.unicode.org/charts/PDF/U1F00.pdf

(2) Daniel, I guess you are using an older version of the wxMaxima user interface, so the menus have changed. If you go to Help >> About, what does it say about the wxMaxima version? If there is a line which says "Built from Git version", what does is the Git version? It should be 7 hexadecimal characters.

danielvolinski commented 2 months ago

Hi Robert, Help About -> wxMaxima 16.04.2

There is no line "Built from Git version". There is:System infowxWidgets: 3.0.2Unicode Support: yesMaxima version: 5.38.1 Lisp: SBCL 1.3.4 Regards, Daniel Volinski En jueves, 26 de septiembre de 2024, 04:09:01 GMT+3, Robert Dodier @.***> escribió:

Sorry for the delay, I'm just circling back to this topic. A couple of brief updates.

(1) I found some resources for so-called precomposed Unicode characters which are a single character combining a letter and a diacritic. There are some Latin and some Greek precomposed characters, however, in both cases these are not really enough for mathematical purposes: the Latin precomposed characters apparently do not cover the whole alphabet, and the Greek precomposed characters only include vowels, and don't include circumflex. So just using Unicode precomposed characters isn't enough, from what I can tell.

For the record, these are the resources I found:

https://en.wikipedia.org/wiki/List_of_precomposed_Latin_characters_in_Unicode

https://www.unicode.org/charts/PDF/U1F00.pdf

(2) Daniel, I guess you are using an older version of the wxMaxima user interface, so the menus have changed. If you go to Help >> About, what does it say about the wxMaxima version? If there is a line which says "Built from Git version", what does is the Git version? It should be 7 hexadecimal characters.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

robert-dodier commented 2 months ago

Thanks, Daniel. I tried, but failed to compile wxMaxima 16.04.2; it is too old for me to compile. Can I ask you to try the most recent version, as obtained from https://wxmaxima-developers.github.io/wxmaxima/download.html ?

Can I ask others to try the combining diacritics package as referenced in my previous comment: https://github.com/wxMaxima-developers/wxmaxima/issues/1933#issuecomment-2311658097 and post a note about whether it works for you? The question of interest is whether combining macron and combining circumflex are displayed as part of one character, or if they are displayed separately, as described in the previous comment: https://github.com/wxMaxima-developers/wxmaxima/issues/1933#issuecomment-2326425802

robert-dodier commented 2 months ago

Daniel, I realized that I can install wxMaxima 16.04.2 + Maxima 5.38.1 using the installer which is still available on the Maxima download page (https://sourceforge.net/projects/maxima/files/Maxima-Windows/).

I can verify that, with the default font (I forgot to note what it was when I started), I get the same results as you: x + combining macron results in macron to the right of x, likewise theta + combining circumflex results in circumflex to the right of theta.

However, it appears that the results are dependent on the font. If I select a different font, the results might be more nearly correct, although I couldn't find one, among all the ones installed on my system, that works well all around. (Even the relatively-recently developed TeX Gyre fonts don't consistently work right.)

I also tried a recent version (wxMaxima 24.08.0) and the font problems are more or less the same.

At this point, I am beginning to feel like this problem cannot be solved in wxMaxima beyond what has already been done with combining diacritics. I will look into it a little further but I am not optimistic about arriving at a solution.

robert-dodier commented 2 months ago

I've investigated further with fonts and so on, and I believe that the current behavior cannot be improved consistently. I believe the best we can do is the combining_diacritics package (https://github.com/maxima-project-on-github/maxima-packages/tree/master/robert-dodier/combining_diacritics), which might or might not have the right effect, depending on the font in use. I am going to close this ticket since, I believe, there is nothing further to be done on the part of the wxMaxima developers.

My advice at this point is to try the combining_diacritics package, and experiment with different fonts. Cambria Math was the most generally successful one that I found, but it wasn't always correct either.

PS. For the record here is a summary of what I have found.

(1) There are not sufficient precomposed combining characters to be generally useful.

(1a) There are some Latin precomposed characters, but these are only a small subset of all letters and diacritics. I found this resource; perhaps these are enough to be useful sometimes: https://en.wikipedia.org/wiki/List_of_precomposed_Latin_characters_in_Unicode

(1b) There are some Greek precomposed characters, but those are using diacritics for writing Greek and not the ones (circumflex especially) for writing mathematics. I found this resource: https://www.unicode.org/charts/PDF/U1F00.pdf

(2) That leaves combining characters as the primary solution.

(2a) Many fonts handle combining diacritics correctly only for short characters such as a, m, x, etc, and characters which are taller (e.g. h, l, f, Greek theta) have the diacritic placed directly overstriking the character, or placed to one side. Some fonts seemed to handle Roman capital letters better than tall lowercase letters.

(2b) Some fonts handle italic (slanted) character incorrectly even if roman (upright) characters are handled correctly; the diacritic isn't moved within the character box to be over the slanted character.

(2c) The font which generally seemed most successful is Cambria Math. However it is still imperfect.

(3) The problem isn't specific to wxMaxima. I saw the same incorrect behavior wrt combining diacritics in another wxWidgets application, namely poedit, and the same incorrect behavior in a non-wxWidgets application, namely notepadqq (a Qt application). These observations make me think the problem is in the fonts themselves.

danielvolinski commented 2 months ago

Hi Robert, Thank you very much! Your effort is much appreciated. Daniel Volinski

En lunes, 30 de septiembre de 2024, 08:15:37 GMT+3, Robert Dodier ***@***.***> escribió:  

Closed #1933 as completed.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>