How Do I Put the Greek Letter Pi on a Button?

How Do I Put the Greek Letter Pi on a Button?

am 03.02.2007 23:12:39 von kvnsmnsn

I'm trying to build a calculator in XHTML, and I've got a button that
currently reads "x <- pi", meaning load 3.141592654 into register x.
Is there some way to alter the button's label so that in the place of
"pi" I have the actual Greek letter pi? Any help on this would be
greatly appreciated.

---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_

Re: How Do I Put the Greek Letter Pi on a Button?

am 03.02.2007 23:34:10 von jkorpela

Scripsit kvnsmnsn@hotmail.com:

> I'm trying to build a calculator in XHTML, and I've got a button that
> currently reads "x <- pi", meaning load 3.141592654 into register x.
> Is there some way to alter the button's label so that in the place of
> "pi" I have the actual Greek letter pi?

Yes, and you can even have a real arrow character instead of the clumsy
"<-".



The above uses character references, with hexadecimal Unicode values. You
might find the following "mnemonic" alternative more readable as source:



Browser support tends to be fairly good these days, for relatively common
characters like the simple arrows and basic Greek letters.

Note, however, that common browser defaults may mean that the font used in
buttons is a sans-serif font where the letter small pi looks like
reduced-size capital pi, instead of the shape of small pi that people know
from math texts. Moreover, its typically in a small font size, smaller than
copy text! The following would usually help:



(You may wish to use class attribute on the element and restrict the
styling to selected elements only, using a class selector in CSS.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Re: How Do I Put the Greek Letter Pi on a Button?

am 03.02.2007 23:34:37 von Shion

kvnsmnsn@hotmail.com wrote:
> I'm trying to build a calculator in XHTML, and I've got a button that
> currently reads "x <- pi", meaning load 3.141592654 into register x.
> Is there some way to alter the button's label so that in the place of
> "pi" I have the actual Greek letter pi? Any help on this would be
> greatly appreciated.

You could always try to use π instead of your current pi

--

//Aho

Re: How Do I Put the Greek Letter Pi on a Button?

am 04.02.2007 13:49:52 von Toby A Inkster

kvnsmnsn wrote:

> Is there some way to alter the button's label so that in the place of
> "pi" I have the actual Greek letter pi?

If your page uses some form of Unicode character encoding (e.g. UTF-8),
this should be fairly easy:



--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

Re: How Do I Put the Greek Letter Pi on a Button?

am 04.02.2007 14:51:19 von Michael

>> Is there some way to alter the button's label so that in the place of
>> "pi" I have the actual Greek letter pi?

Just tried

which works on both my IE 6 and FF 1.5

Regards

Michael.

Re: How Do I Put the Greek Letter Pi on a Button?

am 06.02.2007 01:03:01 von kvnsmnsn

On Feb 3, 3:34 pm, "Jukka K. Korpela" wrote:

=The above uses character references, with hexadecimal Unicode values.
You
=might find the following "mnemonic" alternative more readable as
source:
=
=

Thanks, Jukka, this worked great.

My next question is, is there a way in XHTML to print an arrow that
points both ways? Is there a "⇄", maybe?

Also, how do you put subscripts and superscripts on buttons? I've
currently got an "x ^ y" that I would rather represent as "x" with "y"
as a superscript, and a "log_x y that I would rather represent as
"log" with "x" as a subscript.

---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_

Re: How Do I Put the Greek Letter Pi on a Button?

am 06.02.2007 08:45:42 von jkorpela

Scripsit kvnsmnsn@hotmail.com:

> My next question is, is there a way in XHTML to print an arrow that
> points both ways? Is there a "⇄", maybe?

Things don't work quite that way, by making up entities. In HTML, you can
use any Unicode character. A small minority of them has entity names defined
for them, but that's rather irrelevant. So basically you could take a look
at the Unicode block Arrows and then consider how widely the characters in
it are available in _fonts_ in common use; this is relevant, entities are
not. Incidentally, there are entities ↔ for left right arrow and ⇔
for left right double arrow, and ↔ alias ↔ is probably what you
want, since it's basically the two-way counterpart of ←

(XHTML adds nothing but confusion to HTML, as far as practical use as
delivery format of web pages at present is considered.)

> Also, how do you put subscripts and superscripts on buttons?

There are Unicode characters for some subscripts and superscripts, but most
of them (beyond superscript 1, 2, and 3) are poorly supported in fonts, and
the repertoire is rather limited - there is no superscript y for example.

The other approach is to use or markup, but for that, you need a
context where markup (tags) are allowed, and a value="..." attribute (or any
attribute for that matter) is not such a context. There's the possibility of
using the





Beware that the rendering of button texts, especially with superscripts or
subscripts, can be rather awkward, so consider using a suitable style sheet
like

button { font-family: Verdana; font-size: 100%; }

The main problem with

Re: How Do I Put the Greek Letter Pi on a Button?

am 10.05.2007 00:06:00 von Roedy Green

On 5 Feb 2007 16:03:01 -0800, kvnsmnsn@hotmail.com wrote, quoted or
indirectly quoted someone who said :

>
>My next question is, is there a way in XHTML to print an arrow that
>points both ways? Is there a "⇄", maybe?

see http://mindprod.com/jgloss/htmlcheat.html#ENTITIES
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Re: How Do I Put the Greek Letter Pi on a Button?

am 10.05.2007 16:36:58 von jkorpela

Scripsit Roedy Green:

> On 5 Feb 2007 16:03:01 -0800, kvnsmnsn@hotmail.com wrote, quoted or
> indirectly quoted someone who said :
>
>>
>> My next question is, is there a way in XHTML to print an arrow that
>> points both ways? Is there a "⇄", maybe?
>
> see http://mindprod.com/jgloss/htmlcheat.html#ENTITIES

Sometimes it might make some sense to comment on a discussion three months
after others finished discussing it (and after correct answers to questions
were given), but that's hardly one of those cases. You are referring to your
page that contains many bogosities even on a casual look. Luckily you shout
in red: "I found the easiest way to learn HTML is to look at other people's
examples, to cut and paste from them, and to experiment by fiddling the
various parameters to see what the visual effects are." So anyone who takes
advice from you probably deserves all the mess he gets.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Re: How Do I Put the Greek Letter Pi on a Button?

am 11.05.2007 00:50:09 von Mike Duffy

"Jukka K. Korpela" wrote in
news:X5G0i.161720$Zk5.22@reader1.news.saunalahti.fi:

> Scripsit Roedy Green:
>
>> I found the easiest way to learn HTML is to look at other
>> people's examples, to cut and paste from them, and to experiment

> anyone who takes advice from you probably deserves all the mess he gets.

But he said it was the *easiest* way to learn HTML, not the *best* way.