Citizendium Forums
November 24, 2009, 10:00:41 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: POSTING RULES FOR MAIN CZ BOARDS: (1) The CZ Forums are Citizens-only (a "Citizen" is a Citizendium member). Non-Citizens may use only the "Non-member discussion" and "General help" boards, but still must register before posting (it's easy!). Non-Citizen posts elsewhere will be summarily deleted. (2) All must now use their own real names. To edit your displayed name, click on Profile > Account Related Settings. (3) Citizens must now link to their CZ user pages. To edit your signature, click on Profile > Forum Profile Information.
Click here to return to the wiki
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: inline math formulas  (Read 11172 times)
a.a.s.
Forum Communicator
***
Posts: 152


« on: April 26, 2007, 05:58:01 AM »

The following discussion took place on [[Complex number]] talk page. I think it is of general interest so I copy it here. Below I put a suggestion and ask for more comments.

Quote
::I added some math html tags near the beginning of the article.  I also added "scriptstyle" — I'm not sure if that's a good idea or not.  On my browser, with "scriptstyle" or "textstyle" the math symbols come out too big, but without them they come out too small.  Anyway, I think it's good to put the math tags because they're meaningful -- better software might display the same text better if it's marked as being math.  --[[User:Catherine Woodgold|Catherine Woodgold]] 19:05, 24 April 2007 (CDT)

:::This is a difficult matter because it depends a lot on the browser. However, scriptstyle should go before the formula. The main possibilities that I see are
1  no math tags, e.g., <tt>of the form a+bi obtained by</tt> which renders as
      ...see the talk page
2  emulate maths formatting in HTML, e.g., <tt><nowiki>of the form ''a'' + ''bi'' obtained by</nowiki></tt> which renders as
        ...see the talk page
3  use math tags, e.g., <tt>of the form &lt;math>a+bi&lt;/math> obtained by</tt> which renders as
      ...see the talk page
4  use math tags and textstyle, e.g., <tt>of the form &lt;math>\textstyle a+bi&lt;/math> obtained by</tt> which renders as
       ...see the talk page
5  use math tags and scriptstyle, e.g., <tt>of the form &lt;math>\scriptstyle a+bi&lt;/math> obtained by</tt> which renders as
       ...see the talk page

Options 1 and 2 are not always possible. For instance, <math>x_1^2</math> cannot be displayed in HTML; the best you can do is ''x''<sub>1</sub><sup>2</sup>. Option 3 roughly amounts to choosing option 2 if the formula can be displayed in HTML and option 4 otherwise, but the software behind it needs some fine-tuning. Option 5 is similar to option 4 except that the symbols come out smaller. -- [[User:Jitse Niesen|Jitse Niesen]] 21:08, 24 April 2007 (CDT)

In my firefox on windows option 5 looks far better than others, the symbols are of natural height, while with 'bare' math tags formulas are awkwardly big (I mean in-line formulas)
Bering in mind that it may depend on the browser, could we try to determine some guidelines in this regard?
For a starter, I'd suggest we use option 5 for in-line formulas (i.e. normally written with $dollars$ in TeX)
and
:<math> </math> 
that is  indented or centered 'bare' math tags for displayed formulas (simulating {equation} environment in TeX)

Any thoughts?
Logged

Fredrik Johansson
Forum Participant
**
Posts: 41


« Reply #1 on: April 26, 2007, 06:14:30 AM »

Sounds good to me. It'd be even better if the developers could add a short syntax for inline math so we  don't have to type "<math>\scriptstyle </math>" all the time. Meanwhile¸ maybe we could create a template like {{m|x^2+y^2}} ("m" for math).
Logged

Zachary Pruckowski
Technical Liasion/Executive Committee
Administrator
Forum Regular
****
Posts: 933


« Reply #2 on: April 26, 2007, 06:42:33 AM »

Meanwhile¸ maybe we could create a template like {{m|x^2+y^2}} ("m" for math).

This definitely sounds like the quickest option, and one not likely to cause problems.
Logged

Fredrik Johansson
Forum Participant
**
Posts: 41


« Reply #3 on: April 26, 2007, 07:05:06 AM »

I've created http://en.citizendium.org/wiki/Template:M but it doesn't seem to be working as I had expected
Logged

Zachary Pruckowski
Technical Liasion/Executive Committee
Administrator
Forum Regular
****
Posts: 933


« Reply #4 on: April 26, 2007, 10:31:26 AM »

I've created http://en.citizendium.org/wiki/Template:M but it doesn't seem to be working as I had expected

Possibly an issue with parser order of operations.  Yuck...
Logged

Jitse Niesen
Forum Participant
**
Posts: 100



« Reply #5 on: April 26, 2007, 10:35:35 PM »

I've created http://en.citizendium.org/wiki/Template:M but it doesn't seem to be working as I had expected

As http://meta.wikimedia.org/wiki/Help:Template says, "Parameters do not get expanded when they are inside tags (HTML, wiki, or extension), or between <html></html> tags". Even though math tags are not explicitly mentioned, parameters inside them are also not expanded.
Logged

Jason "Electrawn" Potkanski
Technical Lead/System Administrator
Administrator
Forum Communicator
****
Posts: 158


I eat vandals like treats.


« Reply #6 on: April 27, 2007, 08:56:55 AM »

Simply...if you want <math> , yah gotta use <math>.

-jtp
Logged
Zachary Pruckowski
Technical Liasion/Executive Committee
Administrator
Forum Regular
****
Posts: 933


« Reply #7 on: April 27, 2007, 10:06:50 AM »

I've created http://en.citizendium.org/wiki/Template:M but it doesn't seem to be working as I had expected

As http://meta.wikimedia.org/wiki/Help:Template says, "Parameters do not get expanded when they are inside tags (HTML, wiki, or extension), or between <html></html> tags". Even though math tags are not explicitly mentioned, parameters inside them are also not expanded.

Probably because of the order of parser operations.  You could theoretically fix that by doing some sort of "second pass" I think, but that's a very risky and time consuming change.
Logged

gerg
New Arrival
*
Posts: 13



« Reply #8 on: April 30, 2007, 12:51:20 PM »

I actually disagree that we should be using \scriptstyle. My reasons, which I've already mentioned on a few articles' discussion pages:

(1) It doesn't look that much better, really. The font size is more in line with what browser users typically display (but note that the user has control over this, so that \scriptstyle might result in a too-small font for some users), and the baseline is still too low.

(2) I've had problems on my browser with scriptsytled formulas not appearing properly inline at all, but rather floating nearby, overlaid on top of other parts of the text.

(3) The ideal is that all of the low-level formatting should be done by the software, not manually. We can hope (and request loudly) that <math> eventually comes to recognize when it's inline and when it's not (or that it splits into two tags, one for displayed math and one for inline math) and that it eventually comes to match its font size with the font size the browser is using. But if we manually format everything now, it means that those future improvements won't take hold without another round of manual un-formatting.

I almost forgot to say: for the same reasons, I think we should always be using <math> tags even when it's just a single variable, like <math>x</math> instead of ''x''.
« Last Edit: April 30, 2007, 01:05:10 PM by gerg » Logged

- Greg Martin
a.a.s.
Forum Communicator
***
Posts: 152


« Reply #9 on: May 04, 2007, 03:52:54 AM »

I see all your points. I agree that
(1) \scripstyle does not make formulas look like Tex-produced.
(2) some browsers may have problems with that. Actually my post was a kind of a call for comments on  "how does it look in your browser".
(3) no low level formatting is the ideal solution (and I'm trying to remember to put <math> around single variables).

That said, I'm still in favor of _trying_ with \scriptstyle. Here is why.
(1) we should not compare the \scriptstyle result to the desired or ideal solution but to what we have now without it. For me the difference is evidently worth typing \scriptstyle.

(2) Actually, what is your browser/operating system?  Maybe the problem you have can be easily fixed in the Mediawiki software that runs the project. I'd request this, since I'm still in hope that bad behavior would be rather a tiny exception. Further, I'm motivated by the fact that on WP there is a relatively strong team that regards math formulas issues for a while. Still, standard presentation of <math> environment is quite poor. Just awkward, if I recall my first experience (now I got accustomed to). So is there a hope that it can be fixed in a not-too-distant future?
Let me be a bit pessimistic at this point.
So if \scriptstyle solves the problem, why not use it?

(3) \scriptstyle is indeed undesirable low-level formatting. But this gives acceptable results just right now (modulo browser's question). And we do not need worry too much  about the future, since de-\scriptstyling seems to be quite easy, automatic work for a script (on WP 'robots' like this hypothetical one work without break). The day \scriptstyle becomes an obstacle, we get rid of it. Since this moment seems quite distant to me, I'd still try to put \scriptstyle (unless we decide otherwise).
Logged

Greg Woodhouse
Forum Communicator
***
Posts: 167


Cygnus Loop SNR


WWW
« Reply #10 on: May 04, 2007, 04:16:35 PM »

(3) \scriptstyle is indeed undesirable low-level formatting. But this gives acceptable results just right now (modulo browser's question). And we do not need worry too much  about the future, since de-\scriptstyling seems to be quite easy, automatic work for a script (on WP 'robots' like this hypothetical one work without break). The day \scriptstyle becomes an obstacle, we get rid of it. Since this moment seems quite distant to me, I'd still try to put \scriptstyle (unless we decide otherwise).


But what if someone uses \scriptstyle for its intended purpose? Those uses would go away, too.
Logged

User page: http://en.citizendium.org/wiki/User:Greg_Woodhouse

A writer is a person for whom writing is more difficult than it is for other people.

--Thomas Mann
German writer (1875 - 1955)
Jitse Niesen
Forum Participant
**
Posts: 100



« Reply #11 on: May 04, 2007, 07:45:24 PM »

I actually thought quite a bit about this technical issue in the past. The current setup runs the formulas through latex and converts it to a bitmap picture. This picture is then included in the web page. There are two problems with it: the size of the pictures and the vertical alignment (the pictures are often too high or too low).

I'm quite sure that the size is easy to change in the MediaWiki code. That may be a better solution than using \scriptstyle. On the other hand, this change would affect all formulas, both the inline and the displayed ones ($...$ and $$...$$ in TeX, respectively). The vertical alignment is more difficult, because it depends on the formula, but it can be done at the cost of a lot of programming.

However, there is a big problem: what size should we choose? This depends on the reader's configuration (browser, font size, installed fonts, etc.). I don't see a possibility to change the size depending on the configuration, so we must take a one-size-fits-all approach. In other words, we have to find a good compromise; it's probably possible to find a better compromise than the current one, but it's still a compromise and it's won't look good for everybody.

This problem was already recognized way back and a new technology called MathML was developed (see http://www.w3.org/Math/). This allows for seamlessly integrations of maths in web pages. However, support in browsers is still very patchy and it does not seem to be improving. You can look at the test page to see whether it works.

I spent some time one or two years ago coaxing MediaWiki (the software that Citizendium and Wikipedia runs on) to use MathML. You can see the results at http://wiki.blahtex.org/. The project stalled because it's quite an invasive change, the developers at that time were reluctant, so David Harvey (who did most of the work) and I lost interest.
Logged

a.a.s.
Forum Communicator
***
Posts: 152


« Reply #12 on: May 07, 2007, 06:28:16 AM »

But what if someone uses \scriptstyle for its intended purpose? Those uses would go away, too.

Possibly a good point, but \scriptstyle does not appear to be widely used  (in Wikipedia, say). I wrote quite a few mathematical texts in TeX and I do not recall using (an equivalent of) \scriptstyle either. Could you indicate any actual use or need for this tag for our purposes?

A insightful remark of Jitse seems to have an aside effect of supporting my claim that the software might change but it is not likely to happen very soon... So if we could just fine-tune it so that (almost) every browser would display \scriptstyle 'correctly', it could be worth doing. In my browser -- and I hope in many others, as I tried Opera and IE too -- scriptstyle looks quite natural and just acceptable. While this is not ideal, the difference between this and what we have now with 'bare' math tags is worth considering.

While some simple formulas, as e.g. <math>u^3<math> are rendered directly in html (and it looks acceptable),  once you use a "non-html" math symbol, as \cdot , \times, \sqrt{...}, \int etc., the software produces large images that are awkwardly aligned. At least for these cases I'd reserve \scriptstyle.
Logged

Greg Woodhouse
Forum Communicator
***
Posts: 167


Cygnus Loop SNR


WWW
« Reply #13 on: May 07, 2007, 02:49:38 PM »

At least some people have advocated using \scriptstyle for inline formulas. This came up during review of Complex number and Prime number (and possibly elsewhere). The rationale was simply reducing the size of inline formulas. Personally, I don't think it's a good idea for a number of reasons, not the least of which is that this isn't its intended purpose (\scriptstyle means that the formula should be rendered in a font suitable for a subscript or superscript).

More generally, there are problems with rendering mathematical formulas now, but if we start using ad hoc methods to try and make things look better now, without regard to the intended meaning of the markup, we may find ourselves generating many articles that will end up being rendered poorly (or not at all!) by future software. In addition to the fact that I think TeX looks better, it has the advantage of being relatively technology independent, and most important of all, it remains faithful to the underlying mathematical notation. This has the advantage of "future-proofing" the corpus of material we develop for Citizendium.
Logged

User page: http://en.citizendium.org/wiki/User:Greg_Woodhouse

A writer is a person for whom writing is more difficult than it is for other people.

--Thomas Mann
German writer (1875 - 1955)
a.a.s.
Forum Communicator
***
Posts: 152


« Reply #14 on: May 08, 2007, 03:58:49 AM »

Personally, I don't think it's a good idea for a number of reasons, not the least of which is that this isn't its intended purpose (\scriptstyle means that the formula should be rendered in a font suitable for a subscript or superscript).

Well, let me repeat my question. Do we know any actual need for \scriptstyle in its 'proper' use as described above? I don't. And even if there were some examples, I'd venture to say that such low level formatting should be generally avoided/discouraged and TeX, by definition, uses the "right" font size. Manual formatting is provided for very special purposes that we are not likely to need. But feel free to prove that I'm wrong at this point.

More generally, there are problems with rendering mathematical formulas now, but if we start using ad hoc methods to try and make things look better now, without regard to the intended meaning of the markup, we may find ourselves generating many articles that will end up being rendered poorly (or not at all!) by future software.

My only concern is that the future software is not very likely to be written and we will have to live with what we have now for quite a long time... Wikipedia experience proves it quite clearly. Now, some (many?) editors feel uncomfortable with the disproportionate size of standard PNG rendering. Certainly, I'd prefer a systematic solution in the software. But  there is no hope for this and any other approach would be 'ad hoc'. Shall we do nothing? I'd just suggest a solution that is quite simple and efficient, the \scriptstyle.

On workgroup's talk page I posted some actual examples, see here.
Logged

Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!