[Interest] Preventing ^2 from being converted to a superscript 2

Thiago Macieira thiago.macieira at intel.com
Sun Jul 26 17:50:24 CEST 2026


On Friday, 24 July 2026 23:05:43 Pacific Daylight Time Ben Haller via Interest 
wrote:
> I ought to have mentioned that this came up in France.  I was teaching a
> workshop to 30 French students, and out of those thirty, maybe 4 or 5 of
> them had this same problem.  They didn't understand what was happening,
> and they came to me asking for help -- "how do I type x^2, it keeps
> giving me a superscripted 2!" -- and I was mystified.  None of them had
> any idea why it was happening, and none of them had chosen this keyboard
> functionality intentionally. Eventually, by trial and error, we
> discovered together that (in your notation) <dead_circumflex> followed
> by a space, or I think also pressing <dead_circumflex> again, would
> provide <asciicircum>.  They wanted to turn this keyboard layout feature
> off, so that they could type code normally, and I didn't know how they
> could do that (and I still don't).

You can do that.

Open the Compose file for the language in question (if it exists, it'll be 
/usr/share/X11/locale/fr_FR.UTF-8/Compose, but usually it falls back to 
/usr/share/X11/locale/en_US.UTF-8/Compose), find the line:

<dead_circumflex> <2>                   : "²"   twosuperior # SUPERSCRIPT TWO

Delete or comment it out. Do the same for the other lines starting with 
<dead_circumflex> that you don't want. My file has 170 lines, though most of 
them your French speakers *will* want, for things like â, ê, î, ô and û that 
are needed for French.

$ grep -c '^<dead_circumflex>' /usr/share/X11/locale/en_US.UTF-8/Compose
170

This will affect newly-started Qt applications. I think Gtk-based applications 
hardcode the Compose file and don't take in system defaults. You get to take 
this complaint to GNOME developers and they'll probably ignore your request.

> So, Thiago, you asked "Why do you want to interfere with other users'
> ability to type "O(n²)" in a comment?".  I have no desire to interfere
> with their ability to do that.  But the problem is that, unlike the
> "<Compose> <asciicircum>" method, the users here did not _intend_ to get
> a <dead_circumflex> instead of an <asciicircum>; it was happening to
> them against their will, and neither they nor I knew how to fix it (and
> even once we discovered a fix, it was annoying and inconvenient for them).
>
> But weighing
> between "interfere with other users' ability to type "O(n²)" in a
> comment" and "make it so clueless users can type "x^2" in their code
> without getting lost in a rabbit hole they don't understand", the latter
> seems clearly preferable; I would happily flip that switch if I could.
> The user who is well-informed enough to understand all this and actually
> want to type O(n²) in a comment will presumably know to do <Compose>
> <asciicircum> to get what they want.

The problem is the system can't read user minds. The perennial feature request 
in KDE for "focus follows thought" is not yet implemented...

Someone at some point in the last 25 years thought it was useful to have 
dead_circumflex produce superscripts. So someone wanted that. It was probably 
thought -- and I agree -- that users of deadkeys will be used to the space 
trick when they don't want the combination. Imagine you were talking about 
raising to the power of e, instead of 2. Your French-speaking users would no 
doubt know about <dead_circumflex> <e> producing ê, so they would use the space 
trick to write x^e (as I've just done). Therefore, it was probably thought it 
would be discoverable without further instruction that you'd need to do the 
same for digits. 

If you want to customise, you can. See instructions above.

> But I guess it sounds like there's nothing I can (reasonably) do about
> this anyway, so the discussion is somewhat moot.  :-<  I guess I just
> don't like the fundamental concept of "dead keys", because it seems like
> it just confuses novice users by doing magical things that they don't
> know how to turn off.  Oh well.

See above. 

But dead keys are a normal feature of a lot of languages. You simply can't 
type French, Portuguese, or Spanish (among many others) without them. The 
French keyboard layout has a dedicated key for é, because it's so common and 
it's the only letter with the acute accent in French. But not so for the 
grave, diaeresis ("tréma"), or circumflex accents, because they can apply to 
any of the 5 vowels, and dedicating 12-15 extra keys in the keyboard would be 
impossible (French doesn't have ä or ö and I can't recall a word with ü, but 
might as well provide it so they can type German).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCG - Platform & Sys. Eng.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5176 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20260726/0e860f4d/attachment.bin>


More information about the Interest mailing list