Applying a Style to Individual Characters

S

stef

Hello:

i wopuld like to create a CSS style in which the alphabetic characters
are italicized, but the remaining characters, including numerical and
punctuation characters, are not. (This is typically the way mathematical
formulas are typeset.)

Is there a way to do this? (I am a relative novice here...)

Stefan
 
J

Jukka K. Korpela

stef said:
i wopuld like to create a CSS style in which the alphabetic
characters are italicized, but the remaining characters, including
numerical and punctuation characters, are not.

The only way to achieve that is to add text-level markup that contains
the characters to be italicized and only them. On the other hand,
there's really not much point in trying to be quasi-structural here, so
you might wish to use simply <i>...</i> for those strings, and you
wouldn't need any CSS for that purpose.

Note that there's no way to switch off italics, so for an expression
with italics and non-italics (upright style), use <i>...</i> for the
fragments in italics and no markup for the rest, even if the bulk of
characters should be in italics. (Technically, in CSS you can switch
off italics, but I wouldn't recommend relying on CSS here.)
(This is typically
the way mathematical formulas are typeset.)

Is it? What am I missing? So do you mean that e.g. in
f(x) < 0
just "f" and "x" should appear in italics? My impression is that
normally the same font style is used for all characters. In physics,
it's partly different; in physics, italics vs. upright style may have
semantic significance (so it wouldn't really be a CSS matter to make
the distinction - even "physical" markup like <i> is better than
leaving the distinction to CSS only).
 
A

Andreas Prilop

Jukka K. Korpela said:
Is it? What am I missing? So do you mean that e.g. in
f(x) < 0
just "f" and "x" should appear in italics? My impression is that
normally the same font style is used for all characters.

Certainly not the "< 0" part. Whether or not the parentheses in f(x)
should be in italics, is subject to debate. Since both "f" and "x"
are in italics, italic parentheses would look better. But how about
"f(x+1)" ? The plus sign and the digit 1 are upright, not italic.
 
S

stef

Andreas Prilop said:
Certainly not the "< 0" part. Whether or not the parentheses in f(x)
should be in italics, is subject to debate. Since both "f" and "x"
are in italics, italic parentheses would look better. But how about
"f(x+1)" ? The plus sign and the digit 1 are upright, not italic.

I am basing my request on the standard math formatting that is created,
say, by TEX: parentheses and all other mathematical symbols are not
italics; only the variables are (but not the alpha characters that
appear in special operators like, say, sin x). For instance, sin(x+1)
would be typeset as sin(<i>x</i>+1), whereas f(x+1) would be typeset as
<i>f</i>(<i>x</i>+1), so perhaps you will understand my desire to create
CSS rules to free myself from the tedium of having to italizise
individual letters.
 
J

Jukka K. Korpela

[ quoting Andreas ]
I am basing my request on the standard math formatting that is
created, say, by TEX: parentheses and all other mathematical
symbols are not italics; only the variables are (but not the alpha
characters that appear in special operators like, say, sin x).

I stand corrected. I must have been aleep when I wrote that in math the
same font style is applied to all characters. My excuse is that I was
thinking about the practical difficulties of expressions like f(x) when
the letters are in italics and the parentheses are not - browsers often
display that rather poorly. On IE, you can see the "f" touching the
parenthesis in a way that is rather disturbing.
For instance, sin(x+1) would be typeset as sin(<i>x</i>+1), whereas
f(x+1) would be typeset as <i>f</i>(<i>x</i>+1), so perhaps you
will understand my desire to create CSS rules to free myself from
the tedium of having to italizise individual letters.

Right. But there's really no way. Using a font that has slanted letters
(and everything else upright) would be a feasible solution even if such
fonts existed and were widely available - provided that you add extra
markup and some CSS to make strings like "sin" appear in a different
font - but the conditions aren't met.
 
S

stef

Jukka K. Korpela said:
[ quoting Andreas ]
I am basing my request on the standard math formatting that is
created, say, by TEX: parentheses and all other mathematical
symbols are not italics; only the variables are (but not the alpha
characters that appear in special operators like, say, sin x).

I stand corrected. I must have been aleep when I wrote that in math the
same font style is applied to all characters. My excuse is that I was
thinking about the practical difficulties of expressions like f(x) when
the letters are in italics and the parentheses are not - browsers often
display that rather poorly. On IE, you can see the "f" touching the
parenthesis in a way that is rather disturbing.
For instance, sin(x+1) would be typeset as sin(<i>x</i>+1), whereas
f(x+1) would be typeset as <i>f</i>(<i>x</i>+1), so perhaps you
will understand my desire to create CSS rules to free myself from
the tedium of having to italizise individual letters.

Right. But there's really no way. Using a font that has slanted letters
(and everything else upright) would be a feasible solution even if such
fonts existed and were widely available - provided that you add extra
markup and some CSS to make strings like "sin" appear in a different
font - but the conditions aren't met.

Ok thanks for the comments. I guess I will just work around that for
now and continue to wait for MathML (or some other incarnation of the
long-awaited <math> tags) to be implemented in the popular browsers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top