Small formatting problem: tiny square roots

Just wanted to mention that there’s a small problem with formatting the square root symbol when it appears in very small contexts, such as an exponent or fraction in an inline formula, and has an argument only slightly larger(?) than usual, such as brackets: a small gap is introduced between the bar on top and the radical out front.

image

This is in the Generic style, in an inline formula. Weirdly enough, changing the font size slightly—either up or down—closes the gap, though the bar and the tip of the radical still aren’t perfectly aligned. (This latter behavior seems to occur in more general contexts.) The gap is preserved under export to PDF, so it seems to be “real”.

(This might not be a big problem per se, but in terms of pushing TeXmacs to be a viable option for professional publishing, I think it could be an important detail!)

How could I try to fix the behavior of TeXmacs’ square root symbol in general? (I’m still not exactly sure how TeXmacs draws things—I’m hoping someone can point me in the right direction to learning about it!)

(Also, apologies, not quite sure what category this post should be put in.)

I don’t see that gap here, in texmacs-1.99.12, in linux. I tried with font sizes 8 to 20, and exporting to pdf.

Could you please share your .tm file (and if possible, the exported .pdf)? I cannot reproduce the bug on my system.

Sure; not sure the best way to share the files, so here’s a google drive link to the pdf, and here’s a link to the TeXmacs file.

Let me know if the sharing permissions didn’t take, or if something else goes wrong. (Or, weirder, if you don’t see the gap in these files!)

I’m using TeXmacs 1.99.12 on MacOS Catalina, by the way. (The gap also appears for me in the more recent version of TeXmacs.)

I confirm that I do not see the gap (even with your .tm file) on the current svn version nor with 1.99.14 TeXmacs (I’m on Mac Catilina too). Can you try to remove your ~/.TeXmacs dir and see if this goes away?

I removed that directory and still see the problem; what’s more, I downloaded 1.99.15 on my roommate’s machine (also running Catalina), which I don’t believe has had TeXmacs before, and saw the problem. Here’s what it looked like on that machine, zoomed in to around 200%.

I will mention that the gap is very small, and that you might have to zoom in to see it. However, changing the font size will in fact fix the gap.

Other than that, I’m not sure what could be different. Are there any other hidden files I might need to delete somewhere that could be polluting things?

And just to confirm, do you see the gap in the pdf?

(Though, there is a chance that my roommate’s machine has had TeXmacs before, if I needed to borrow it at some point in the past few years and have since forgotten. I forgot to check if there was an extant ~/.TeXmacs directory before installing, but deleted it and tried again just to be safe.)

I still do not see it. Actually on my machine the horizontal line seems to overextend just a bit on the left. But certainly I have no gap, even at very high zoom and with the document you provided. (on 1.99.14). PDF also looks ok. This is very strange. The only possibility I see (short of a CPU problem) is that TeXmacs is picking, for some reason, fonts files from the system instead of using the ones we provided with it. (this seems quite strange). Which TeX installation (if any) is on these systems?

If I may add to the confusion, I do see the gap in the PDF on Fedora 33, both in Evince and Okular. I don’t see the gap in Texmacs, though (tried both 1.99.12 and 1.99.15).

Additionally, if I export the provided texmacs file to pdf, I don’t get a gap either.

There is a difference in fonts in the two pdfs. My version contains the CMEX7 font, while yours contains the CMEX10 font instead.

Could you check whether you have the file “cmex7.tfm” on your system? For me it’s under /usr/share/TeXmacs/fonts/tfm/ams/cmextra/cmex7.tfm. I don’t know where it should be on OS X.

How weird!

@mgubi, when you say the PDF looks okay, do you mean a PDF created by exporting the tm doc on your machine, or the PDF provided by my link? It’d be very strange if it’s the latter—I can see the gap on the one I provided even on my phone. So, I’m guessing it’s the former, but just making sure.

I don’t believe either machines have a TeX installation—at least not one I performed intentionally. (My roommate’s certainly doesn’t.)

@jeroen, I’ve found both CMEX7 and CMEX10 in the package contents of my TeXmacs application: both under Contents/Resources/share/TeXmacs/fonts/tfm/, with CMEX7 under ams/cmextra/cmex7.tfm, and CMEX10 under public/cm/cmex10.tfm. These are the only copies of these files in the application package. (I don’t have either of these in the .TeXmacs directory, for what it’s worth.)

I suppose somehow it seems like my TeXmacs is preferring the wrong font? I’ll see if I can try to find a fresh machine running Catalina to install TeXmacs to. (I’m pretty sure my roommate’s machine was fresh, but again, there is some possibility it wasn’t.)

Let me know if there’s any more info I can provide, such as an upload of any directories for you to peruse!

Yes, I mean my PDF, I didn’t checked yours, but I would assume our Preview.app are the same. What we could try is that you remove again ./TeXmacs and you start TeXmacs from the terminal, so what we can peek at the debug output easily.
You have to launch from a shell the executable which is inside the TeXmacs.app (I think is Contents/MacOS/TeXmacs ) And maybe post here the output of the initialisation.

Okay, so here is the terminal output upon starting TeXmacs after deleting (renaming) .Texmacs. (I would’ve summarized it in-post, but the forum tells me the body is too long by about 20k characters.)

Here is the .TeXmacs directory it produced.

For what it’s worth, here is my actual TeXmacs-1.99.12.app. However, seeing as the problem also occurred on my roommate’s machine, I’m confident it’s not something particular to my copy! But maybe it’ll make clear what the difference is.

(By the way, a bit off topic, but is there some resource from which I could get a full picture about how TeXmacs works under the hood? As of now I have a little bit of experience with programming, though not on the scale of an entire app like TeXmacs. I am interested in potentially contributing to TeXmacs, but just don’t know where to start—plus, when things like this happen, I’d like to be able to try to help figure out what’s happening!)

Seems that the .TeXmacs dir is ok and also the resources inside your app. I do not have any clue what is going on. The only guess I have is that TeXmacs is picking up some strange CM font from your machine. Do you have TeX installed? From where? Additionally: can you try to open your TeXmacs, open the file and then open Activity Monitor and use it to show the list of the files which the application has opened, and copy it here? It should reveal which are the font files used. This is the result from my machine (no gap):

cwd
/
txt
/Applications/TeXmacs-1.99.12.app/Contents/MacOS/TeXmacs
txt
/Applications/TeXmacs-1.99.12.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle
txt
/Library/Preferences/Logging/.plist-cache.FvAg3vra
txt
/usr/share/icu/icudt64l.dat
txt
/private/var/db/timezone/tz/2020a.1.0/icutz/icutz44l.dat
txt
/private/var/folders/bc/hbs2qc2n2pb3bkkhz_vqb9j40000gn/0/com.apple.LaunchServices.dv/com.apple.LaunchServices-1082-v2.csstore
txt
/System/Library/Frameworks/Security.framework/Versions/A/PlugIns/csparser.bundle/Contents/MacOS/csparser
txt
/private/var/db/mds/messages/501/se_SecurityMessages
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car
txt
/usr/lib/dyld
txt
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantLightAppearance.car
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/Assets.car
txt
/System/Library/Fonts/Supplemental/NotoSansJavanese-Regular.otf
txt
/System/Library/Fonts/Supplemental/Wingdings 2.ttf
txt
/System/Library/Fonts/Supplemental/Wingdings.ttf
txt
/System/Library/Fonts/Supplemental/Webdings.ttf
txt
/System/Library/Fonts/Supplemental/Wingdings 3.ttf
txt
/System/Library/Fonts/Helvetica.ttc
txt
/usr/lib/libobjc-trampolines.dylib
txt
/System/Library/Fonts/SFNS.ttf
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecrm10.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecss10.pfb
txt
/System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/AppleKeyboardLayouts-L.dat
txt
/System/Library/Caches/com.apple.IntlDataCache.le.kbdx
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmr10.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmsy10.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmex10.pfb
txt
/private/var/folders/bc/hbs2qc2n2pb3bkkhz_vqb9j40000gn/C/org.texmacs.TeXmacs/com.apple.metal/3902/libraries.data
txt
/private/var/folders/bc/hbs2qc2n2pb3bkkhz_vqb9j40000gn/C/org.texmacs.TeXmacs/com.apple.metal/Intel(R) UHD Graphics 617/functions.data
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmmi10.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecti10.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecsi10.pfb
txt
/System/Library/Fonts/LucidaGrande.ttc
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmr9.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmsy9.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmmi9.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecrm7.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecss7.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmr8.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmsy8.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmmi8.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecrm12.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecss12.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmr12.pfb
txt
/Applications/TeXmacs-1.99.12.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmmi12.pfb
txt
/private/var/db/analyticsd/events.whitelist
0
/dev/null
1
/dev/null
2
/dev/null
3
->0x9bd8ab4a85742bd2
4
->0x989193c95adeaed9
5
->0x4b51c46c8375c4ef
6
->0x379d26df78832dea
7
/dev/urandom
8
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_stdlib.metallib
9
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_filters.metallib
10
/private/var/folders/bc/hbs2qc2n2pb3bkkhz_vqb9j40000gn/C/org.texmacs.TeXmacs/com.apple.metal/3902/libraries.maps
11
/private/var/folders/bc/hbs2qc2n2pb3bkkhz_vqb9j40000gn/C/org.texmacs.TeXmacs/com.apple.metal/3902/libraries.data
12
/private/var/folders/bc/hbs2qc2n2pb3bkkhz_vqb9j40000gn/C/org.texmacs.TeXmacs/com.apple.metal/Intel(R) UHD Graphics 617/functions.maps
13
/private/var/folders/bc/hbs2qc2n2pb3bkkhz_vqb9j40000gn/C/org.texmacs.TeXmacs/com.apple.metal/Intel(R) UHD Graphics 617/functions.data
14
/Users/mgubi/Library/Saved Application State/org.texmacs.TeXmacs.savedState/window_2.data
15
/Users/mgubi/Library/Saved Application State/org.texmacs.TeXmacs.savedState/data.data
16
/Users/mgubi/Library/Saved Application State/org.texmacs.TeXmacs.savedState/windows.plist

For the moment we do not have any good resource for an overview of the internals of TeXmacs. You are welcome to ask questions here or in texmacs-dev, also it would be good to produce something. I wanted to do it as soon as I have some time.

In Help->Manuals->Developer guide

you can produce a bit old documentation for developers, this might give you a broad outlook on the program. We need to improve it and update. Also you can access this documentation from

/Applications/TeXmacs-1.99.15.app/Contents/Resources/share/TeXmacs/doc/devel

Sorry, I’ve been pretty busy!

So, I tried this problem on a third computer, also running Catalina, one that I’m sure has never had TeXmacs before, and was still able to reproduce the bug. I’m certain this is not a quirk of my system!

I suppose some non-Mac application that happens to have been installed at some point on all three systems could be interfering, but there aren’t many: Mathematica, Anaconda, and Minecraft. (Anaconda is not currently installed on two of the machines, but might have been in the past.)

None of the three have a TeX installation.

I did what you said on the third machine with the standard TeXmacs download currently available on the website. Here’s the activity monitor output from there. I replaced the username with [------] for privacy.

Activity Monitor output
cwd
/
txt
/Applications/TeXmacs.app/Contents/MacOS/TeXmacs
txt
/Applications/TeXmacs.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle
txt
/Library/Preferences/Logging/.plist-cache.RmIk3ATa
txt
/usr/share/icu/icudt64l.dat
txt
/private/var/db/timezone/tz/2020d.1.0/icutz/icutz44l.dat
txt
/private/var/folders/yk/rftfgyk57m3853jrsxwx5wjr0000gn/0/com.apple.LaunchServices.dv/com.apple.LaunchServices-1082-v2.csstore
txt
/System/Library/Frameworks/Security.framework/Versions/A/PlugIns/csparser.bundle/Contents/MacOS/csparser
txt
/private/var/db/mds/messages/501/se_SecurityMessages
txt
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAquaAppearance.car
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/Assets.car
txt
/System/Library/Fonts/Supplemental/NotoSansJavanese-Regular.otf
txt
/System/Library/Fonts/Supplemental/Wingdings 2.ttf
txt
/System/Library/Fonts/Supplemental/Wingdings.ttf
txt
/System/Library/Fonts/Supplemental/Wingdings 3.ttf
txt
/System/Library/Fonts/Supplemental/Webdings.ttf
txt
/System/Library/Fonts/Helvetica.ttc
txt
/usr/lib/libobjc-trampolines.dylib
txt
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/VibrantLightAppearance.car
txt
/System/Library/Fonts/SFNS.ttf
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecrm10.pfb
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecss10.pfb
txt
/System/Library/Caches/com.apple.IntlDataCache.le.kbdx
txt
/System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/AppleKeyboardLayouts-L.dat
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmr10.pfb
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecss7.pfb
txt
/private/var/folders/yk/rftfgyk57m3853jrsxwx5wjr0000gn/C/org.texmacs.TeXmacs/com.apple.metal/3902/libraries.data
txt
/private/var/folders/yk/rftfgyk57m3853jrsxwx5wjr0000gn/C/org.texmacs.TeXmacs/com.apple.metal/AMD Radeon R9 M395/functions.data
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/ec/ecrm7.pfb
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmr7.pfb
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmsy7.pfb
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmex10.pfb
txt
/System/Library/Fonts/LucidaGrande.ttc
txt
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/fonts/type1/bluesky/cm/cmmi7.pfb
txt
/usr/lib/dyld
0
/dev/null
1
/dev/null
2
/dev/null
3
->0x55e97561a4202b75
4
->0xd444d666fd996ff7
5
->0xdefa7814c8d4a775
6
->0xb1b847b86d471f28
7
/Users/[------]/Library/Saved Application State/org.texmacs.TeXmacs.savedState/data.data
8
/dev/urandom
9
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_stdlib.metallib
10
/System/Library/Frameworks/CoreImage.framework/Versions/A/Resources/ci_filters.metallib
11
/private/var/folders/yk/rftfgyk57m3853jrsxwx5wjr0000gn/C/org.texmacs.TeXmacs/com.apple.metal/3902/libraries.maps
12
/private/var/folders/yk/rftfgyk57m3853jrsxwx5wjr0000gn/C/org.texmacs.TeXmacs/com.apple.metal/3902/libraries.data
13
/private/var/folders/yk/rftfgyk57m3853jrsxwx5wjr0000gn/C/org.texmacs.TeXmacs/com.apple.metal/AMD Radeon R9 M395/functions.maps
14
/private/var/folders/yk/rftfgyk57m3853jrsxwx5wjr0000gn/C/org.texmacs.TeXmacs/com.apple.metal/AMD Radeon R9 M395/functions.data
15
/Users/[------]/Library/Saved Application State/org.texmacs.TeXmacs.savedState/windows.plist
16
/Users/[------]/Library/Saved Application State/org.texmacs.TeXmacs.savedState/window_2.data

I also used the command line utility (on macs by default) opensnoop to get all files that were ever opened by the app instead of just the current ones, via sudo opensnoop -n TeXmacs > snoop.out. After starting this command, I then opened TeXmacs, typed in the offending tiny square root, exported to pdf, and then ctrl-C’d opensnoop. The contents of snoop.out, with username also replaced, are here.

I’ll note that the CMEX10 font appears in both outputs, but only from the TeXmacs locations that I found them in.

From the looks of it, it actually seems like your TeXmacs is accessing a lot more fonts than mine are! Neither outputs of mine show any access to .pfb file whose name ends in anything but 7 or 10, such as the cmmi12.pfb that appears in your list. Further, yours also accesses some fonts ending in 10 that mine doesn’t, such as cmmi7.pfb, whereas mine accesses some that yours doesn’t, such as cmmi10.pfb.

However, my copy of the TeXmacs app does include the fonts yours uses in the necessary place, as you can verify from the copy of the app I’ve uploaded. It seems they simply aren’t being accessed.

But this might be a red herring. On my (original) machine, Activity Monitor shows that I’m accessing some of the 12.pfb and 8.pfb fonts; after all, I’m actively using TeXmacs and have several documents with lots of text in them open. On the machine whose output you see, I downloaded it fresh, opened it once to create the .TeXmacs directory, then closed it again. After doing this, I started opensnoop, opened the app, and then typed in the single expression I’ve shown before in the new blank document, then exported to PDF.

It’s hard to miss the difference in graphics cards given by these outputs when referencing functions.data around where it references the fonts: Intel for yours, Radeon for mine. However, on my original machine, that output shows that I use Intel(R) UHD Graphics 630. So, unless the difference between 617 and 630 is crucial, I’d doubt that it’s the graphics card.

Anyway, I’m not sure what to make of this! I’d be curious to see your opensnoop output with a freshly-downloaded copy (opened once before, such that the help window isn’t opened during session recorded by opensnoop).

Managed to find a Windows 10 laptop from which to try this, and, indeed, could not reproduce the bug–instead, the bar seemed to over-extend a bit, as others have seen! Though I think this misalignment is also something that ought to be fixed.

I’m going to try to read the developer’s guide and related documents that @mgubi has pointed me to (thanks!), and see if I can find out what might be causing the different behavior, and what might need to be changed…

There could be some other program installed on those mac systems which interfere. What about moving away all the tree starting at /opt or some other software like those installed via brewor similar packaging.

Nope, unfortunately. On one machine, I renamed the opt, Cellar, and .TeXmacs folder, and the gap behavior still occurred.

On another machine, I completely removed all contents of the usr/local/ folder just to be safe, deleted the .TeXmacs folder, deleted the TeXmacs app, restarted the machine, then redownloaded TeXmacs, and the bug was still there.

Is it possible that somehow your machine has something interfering with it that is somehow making it, I don’t know, more “Linux-like” in some particular respect?

I’d still be interested in seeing the result of the opensnoop procedure I described above for your machine! (I’ll note that opensnoop comes with your mac OS, you don’t need to download anything.)

The mistery continues… Also, for some reason opensnoop does not work on my machine…

Here on Kubuntu 21.04 and I can reproduce the bug. I think the reason why you couldn’t reproduce the bug on windows was that you put the square root over the whole fraction instead of the denominator. For me when I do this on linux the same overextension happens. In my experience the top bar of the sqrt always seems to be misaligned no matter what, though by varying offsets depending on the size. I created this account just to report this lol