codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How can I show complex math formulas?  StefanL at 10:49 on Monday, March 01, 2004
 

Hi. Does anyone know what I should use to show complex math formulas? I was thinking RichTextBox but I haven't been able to figure it out yet...

Example :
http://home.student.uu.se/s/stli3909/untitled.bmp

which in VB would be equal to (1+2+3)/Sqr((1+2)/3)
I tried formatting the individual fonts and found the
square root sign but unfortunately it only consisted of the initial "checkmark" and not the horizontal line above what it's supposed to cover.

I would be extremely grateful for any help, because it would make the app I'm working on so much more attractive.

  Re: How can I show complex math formulas?  Troy Wolf at 18:23 on Monday, March 01, 2004
 

A rich textbox is not going to help you. The square root sign uses space to the left and above the elements under it -- that just isn't how HTML text and images flow naturally. BUT, here are 2 ideas.

One, create an image that is just the square root sign with a white background (or whatever background color you want - you could also try a transparent background). Then you'd have to get clever and use CSS positioning to force your symbol to appear where you want it, and to appear behind the numbers so you can still see them. Check out the positioning attributes on this Microsoft CSS Attributes reference page:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/css/reference/attributes.asp?frame=true

Another idea -- again, not a simple solution -- is to actually draw the symbol dynamically using DHTML/JavaScript graphic rendering functions like the amazing code from walterzorn.com:
http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm
Basically, you would display your numbers and underlines like you would normally, then you'd draw the symbol and tell the functions exactly WHERE to display the resulting line art.

The real trick in both of these solutions is the positioning--which is why I think I'd try the first solution first. Please let us know how it goes.

Message to all forum posters: PLEASE remember to take the time to come back to the thread and post your final solution and/or comments. It's that followup and feedback that keeps the forums alive and keeps the "experts" providing answers.
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: How can I show complex math formulas?  StefanL at 12:02 on Tuesday, March 02, 2004
 

Sorry, I forgot that I also need to copy the final answer with same layout so that the suer can paste it into Word for example. Would the above still work?

  Re: How can I show complex math formulas?  Troy Wolf at 12:46 on Tuesday, March 02, 2004
 

I'm not sure if a standard copy & paste of HTML that includes absolute positioned elements would retain 100% of it's positioning and formatting when pasted into Word. Try it -- that's what I'd have to do to find out, so you might as well do it since it's your project.

Of course an actual screen-shot would always work. (Alt-Printscreen will take a screenshot of only the active window. You can then CTRL-V to paste the screenshot into Word, email, Paint, etc.)
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: How can I show complex math formulas?  Troy Wolf at 20:23 on Wednesday, March 17, 2004
 

StefanL, don't forget to follow up to let us know how things worked out for your project. That's the purpose of the forums -- to find answers, and allow others to learn from our journey.

Thanks for using the codetoad.com forums!
Troy Wolf: site expert
SnippetEdit Website Editor









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007