| | |
Math output
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
The difficulty is you do not understand the solutions so its hard to provide you with code since it does what you want, you're just unable to implement it.
•
•
Join Date: Jul 2009
Posts: 123
Reputation:
Solved Threads: 10
Mr.Sknake ,I was able to understand your code and also implemented it.
I found the output of your code in bracket form and not the fraction that we see in books.
The code which I am using is :
Since I have made for all mathematical symbols and the mathematical equation can be the combination of any symbol.So when we click on any of the math symbol ,it is appended in the textbox.
So the code which you gave me for fraction dispalys bracket and not the fraction format.
And I have made differently for divide sign and for fraction.
For fraction I want the way as seen in the thumbnail attached
and for division I am using simply divide sign i.e."÷" .
I found the output of your code in bracket form and not the fraction that we see in books.
The code which I am using is :
C# Syntax (Toggle Plain Text)
C# Syntax (Toggle Plain Text) textBoxEquation.AppendText("()/()"); this.textBoxEquation.Focus(); const string matchNumerator = @"\((?<Numerator>[\d,]*(\.\d*))\)"; const string matchDenominator = @"\((?<Denominator>[\d,]*(\.\d*))\)"; const string matchBoth = matchNumerator + @"\/" + matchDenominator; //const string txtBoxInput = @"()/()"; string txtBoxInput = textBoxEquation.Text; System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(txtBoxInput, matchBoth); if (m.Success) { decimal dNumerator, dDenominator; if (decimal.TryParse(m.Groups["Numerator"].Value, out dNumerator) && decimal.TryParse(m.Groups["Denominator"].Value, out dDenominator)) { //and this right here is your string in latex format string latex = @"\frac {" + dNumerator.ToString() + "}{" + dDenominator.ToString() + "}"; decimal valueOut = dNumerator / dDenominator; System.Diagnostics.Debugger.Break(); } }
So the code which you gave me for fraction dispalys bracket and not the fraction format.
And I have made differently for divide sign and for fraction.
For fraction I want the way as seen in the thumbnail attached
and for division I am using simply divide sign i.e."÷" .
Last edited by vinnijain; Oct 4th, 2009 at 11:51 am.
Did the effort reading through this thread. Do not understand it very well.
I think that Sknake and Ryshad did their best to tell you how to translate text to LaTeX format. (At least for division that is, if you want to do this full blown you need a text to LaTeX compiler, wish you all the luck with that
)
But if I understand it well, what you want, is feed a textbox some latex text and expect it shows math formulas you see in textbooks.
Did you not try it for yourself to notice that this won't work?
Why not try this or try to incorporate Microsoft Equation Editor 3.0 into your application?
I think that Sknake and Ryshad did their best to tell you how to translate text to LaTeX format. (At least for division that is, if you want to do this full blown you need a text to LaTeX compiler, wish you all the luck with that
)But if I understand it well, what you want, is feed a textbox some latex text and expect it shows math formulas you see in textbooks.
Did you not try it for yourself to notice that this won't work?
Why not try this or try to incorporate Microsoft Equation Editor 3.0 into your application?
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
•
•
Join Date: Jul 2009
Posts: 123
Reputation:
Solved Threads: 10
•
•
•
•
But if I understand it well, what you want, is feed a textbox some latex text and expect it shows math formulas you see in textbooks.
Did you not try it for yourself to notice that this won't work?
Why not try this or try to incorporate Microsoft Equation Editor 3.0 into your application?
But the same replacement I was not able to do with fraction .In case of fraction it is not replacing with latex symbol rather its interpreting it is displaying it as user friendly notation only..........
I tried a lot but could not find any solution.....
The only solution which I could find is to make math dictionary from all latex types to user friendly symbols.I am working on that and hope that I may work....
We have done our best here to answer your question. You wanted to display a user friendly version of the equation in the textbox then convert that to latex in order to create the equation output. We have given you the code you need to parse a user friendly fraction using regular expressions to convert it into a latex format.
Your task now, having understood how our code works, is to adjust it to find the different symbols that the user friendly string might contain and convert those into latex format also.
If you decide to go the LINQ route I would recommend starting a new thread since that doesnt relate to this question. A thread titled "Help with LINQ Dictionary" or something similar is far more likely to attract the help you need than a 4 page thread on something losely related
Either way, please mark the thread as solved if you feel there is nothing more we can do for you.
Your task now, having understood how our code works, is to adjust it to find the different symbols that the user friendly string might contain and convert those into latex format also.
If you decide to go the LINQ route I would recommend starting a new thread since that doesnt relate to this question. A thread titled "Help with LINQ Dictionary" or something similar is far more likely to attract the help you need than a 4 page thread on something losely related

Either way, please mark the thread as solved if you feel there is nothing more we can do for you.
Please don't take for granted the work that solvers do for you. Take the time to fully understand the code they give you so that you might adapt it to future problems.
"Learning is more than absorbing facts, it is acquiring understanding.” - William Arthur Ward
"Learning is more than absorbing facts, it is acquiring understanding.” - William Arthur Ward
•
•
Join Date: Jul 2009
Posts: 123
Reputation:
Solved Threads: 10
Ryshad, thanks for helping me............But I don't understand why you all are not getting me.
I think ddnabe understood and even replied that it won't works.
And I want to ask one thing that did you not try it for yourself to notice that it was not giving the required result that was shown in thumbail?
Ryshad just tell me one thing that were you able to get the fraction form (like in books) on running the code ?
I think ddnabe understood and even replied that it won't works.
And I want to ask one thing that did you not try it for yourself to notice that it was not giving the required result that was shown in thumbail?
Ryshad just tell me one thing that were you able to get the fraction form (like in books) on running the code ?
Last edited by vinnijain; Oct 5th, 2009 at 6:32 am.
A TextBox, well it says it, can only display text, characters. Some fonts have characters for square root etc. , but that's a poor substitute for the things you see in textbooks. The math formulas you see in textbooks are in fact pictures.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
![]() |
Similar Threads
- how to use regex or an array to display some output from an arithmetic input? (VB.NET)
- Trouble with area (Java)
- math help (PHP)
- math program (C)
- Math.max prob???...XD (Java)
- So Stuck (C++)
- Assigning Array Values En Masse (Java)
- Output in Text file-How to apply fprintf()? (C)
- Output in the text file (C)
- missing function header (C++)
Other Threads in the C# Forum
- Previous Thread: How to generate button at runtime and its text from database for windows application
- Next Thread: password setting in a software
| Thread Tools | Search this Thread |
.net access ado.net algorithm array backup barchart bitmap box broadcast buttons c# check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime decryption degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest i18n image imageprocessing index input install java label list listbox listener mandelbrot math microsystems mouseclick mysql operator path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer update uploadatextfile usercontrol users validation view visualstudio webbrowser whileloop windows winforms wpf xml






