Recent

Author Topic: x squared  (Read 3063 times)

Neville

  • Jr. Member
  • **
  • Posts: 52
x squared
« on: August 02, 2025, 04:52:43 pm »
I'm struggling to get Lazarus to produce the algebraic format for x-squared, that is a non-capital "x" followed by a smaller "2" which is elevated above the normal base line.

Can anyone offer any suggestions?

 

wp

  • Hero Member
  • *****
  • Posts: 13512
Re: x squared
« Reply #1 on: August 02, 2025, 04:56:37 pm »
x² = x + [Alt-Gr 2]

LV

  • Sr. Member
  • ****
  • Posts: 427
Re: x squared
« Reply #2 on: August 02, 2025, 05:08:17 pm »
@wp beat me to it :)

Edit: You can also choose Emoji & Math Symbols: Key 🪟 + .(point)
« Last Edit: August 02, 2025, 05:32:06 pm by LV »

Kays

  • Hero Member
  • *****
  • Posts: 632
  • Whasup!?
    • KaiBurghardt.de
Re: x squared
« Reply #3 on: August 02, 2025, 11:45:04 pm »
U+00B2 SUPERSCRIPT TWO is a compatibility character. Ideally new programs do not emit any compatibility characters (unless for the sake of interfacing with legacy software ≈ compatibility).
Quote
For mathematical notation, the use of superscript or subscript styling of ASCII digits is preferred over the use of compatibility superscript or subscript digits. See Unicode Technical Report #25, “Unicode Support for Mathematics,” for more discussion of this topic.
Yours Sincerely
Kai Burghardt

Neville

  • Jr. Member
  • **
  • Posts: 52
Re: x squared
« Reply #4 on: August 03, 2025, 05:07:04 pm »
Thank you for your suggestions.  Unfortunately, I've not been clever enough to get the hang of it.

When I put the string together like

'x' + Alt-Gr 2 +

I get error:  identifier not found "Alt"

Am I being really stupid?

Thaddy

  • Hero Member
  • *****
  • Posts: 19142
  • Glad to be alive.
Re: x squared
« Reply #5 on: August 03, 2025, 05:28:09 pm »
alt-gr is the right alt, not the left.
objects are fine constructs. You can even initialize them with constructors.

Paolo

  • Hero Member
  • *****
  • Posts: 712
Re: x squared
« Reply #6 on: August 03, 2025, 06:17:07 pm »
typing alt-gr 2 doos nothing..

ASerge

  • Hero Member
  • *****
  • Posts: 2492
Re: x squared
« Reply #7 on: August 03, 2025, 08:00:04 pm »
When I put the string together like

'x' + Alt-Gr 2 +
FPC supports unicode. ² is a unicode character. You can enter it by typing 0178 on numpad with the Alt key pressed (Alt+0178), or on some keyboard layouts AltGr+2.

Khrys

  • Sr. Member
  • ****
  • Posts: 437
Re: x squared
« Reply #8 on: August 04, 2025, 07:46:13 am »
x² = x + [Alt-Gr 2]

This only works on certain keyboard layouts (e.g. German  QWERTZ - see attachment), and most keyboards sold in the US don't even have an  Alt Gr  key.
The simplest way to input rarely-used special characters is to copy-paste them from sites like this one, IMO - if you don't know the code point beforehand, you're going to have to look it up anyways, so might as well copy it right then.

Paolo

  • Hero Member
  • *****
  • Posts: 712
Re: x squared
« Reply #9 on: August 04, 2025, 10:04:58 am »
here alt-gr 2 nothing, it works Alt+253

Neville

  • Jr. Member
  • **
  • Posts: 52
Re: x squared
« Reply #10 on: August 04, 2025, 10:10:13 am »
ASerge: typing 0178 on numpad with the Alt key pressed worked instantly.  Thank you.

 

TinyPortal © 2005-2018