Math output

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2009
Posts: 3,258
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 579
Sponsor
sknake's Avatar
sknake sknake is online now Online
.NET Enthusiast

Re: Math output

 
0
  #11
Sep 30th, 2009
Ryshad has already given you the information you need. You need to make regex patterns with groups for each math command from latex.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
0
  #12
Oct 1st, 2009
Originally Posted by sknake View Post
Ryshad has already given you the information you need. You need to make regex patterns with groups for each math command from latex.
Hello Mr.Scott,
Thanks for your reply........
I don't know much about regular expression......
I tried the links given by Ryshad,they helped me but not much.....
My application is attached in this thread, Can you please give me some hint or sample example in that.Rest I 'll do it on my own.

Like for fraction ,in textbox I want "()/()" and its corresponding latex symbol is "\frac {}{}" and for nth root in textbox there is "root:{}()" and its corresponding latex symbol is "\sqrt[]{}" and so on...........
Kindly help me..........
Last edited by vinnijain; Oct 1st, 2009 at 3:51 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,258
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 579
Sponsor
sknake's Avatar
sknake sknake is online now Online
.NET Enthusiast

Re: Math output

 
0
  #13
Oct 1st, 2009
  1. private void button5_Click(object sender, EventArgs e)
  2. {
  3. const string matchNumerator = @"\((?<Numerator>[\d,]*(\.\d*))\)";
  4. const string matchDenominator = @"\((?<Denominator>[\d,]*(\.\d*))\)";
  5. const string matchBoth = matchNumerator + @"\/" + matchDenominator;
  6.  
  7. const string txtBoxInput = @"(5.2)/(4.3)";
  8.  
  9.  
  10. System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(txtBoxInput, matchBoth);
  11.  
  12. if (m.Success)
  13. {
  14. decimal dNumerator, dDenominator;
  15. if (decimal.TryParse(m.Groups["Numerator"].Value, out dNumerator) && decimal.TryParse(m.Groups["Denominator"].Value, out dDenominator))
  16. {
  17. string latex = @"\frac {" + dNumerator.ToString() + "}{" + dDenominator.ToString() + "}";
  18. decimal valueOut = dNumerator / dDenominator;
  19. System.Diagnostics.Debugger.Break();
  20. }
  21. }
  22.  
  23. }
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
0
  #14
Oct 1st, 2009
Thanks for this code Mr.Scott.
But this code is not working and its giving error on line :
  1. System.Diagnostics.Debugger.Break();
Also,it is for particular value i.e. @"(5.2)/(4.3)" ,but I want it to use for all type of values.
Kindly help me....
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,258
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 579
Sponsor
sknake's Avatar
sknake sknake is online now Online
.NET Enthusiast

Re: Math output

 
0
  #15
Oct 1st, 2009
I know. I gave you one regex, you need to write the rest.

Please mark this thread as solved if you have found an answer to your question and good luck!
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
0
  #16
Oct 1st, 2009
Originally Posted by sknake View Post
I know. I gave you one regex, you need to write the rest.

Please mark this thread as solved if you have found an answer to your question and good luck!
Mr.Scott you gave me for one regex ,but that is not working ..........
So how can I proceed further.
Also,kindly give me hint for making it for all values
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,258
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 579
Sponsor
sknake's Avatar
sknake sknake is online now Online
.NET Enthusiast

Re: Math output

 
0
  #17
Oct 1st, 2009
What do you mean "all values"? The demo worked fine for me...
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
0
  #18
Oct 1st, 2009
Its giving error in line:
  1. System.Diagnostics.Debugger.Break();

Since the code is for particularly for this (@"(5.2)/(4.3)") fraction value
kindly give me common hint for using it for all fraction values .
kindly resolve this error please.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 123
Reputation: vinnijain is an unknown quantity at this point 
Solved Threads: 10
vinnijain vinnijain is offline Offline
Junior Poster

Re: Math output

 
0
  #19
Oct 1st, 2009
hi Sknake,
I am using "()/()" for fraction but its not giving equivalent fraction image ,its displaying the textbox data only........
Also I don't want it to work only for (5.2)/(4.3) but for any fractions.
Kindly tell me how make it general for all fraction values.
Help me please
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,258
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 579
Sponsor
sknake's Avatar
sknake sknake is online now Online
.NET Enthusiast

Re: Math output

 
0
  #20
Oct 1st, 2009
The code does work for any fraction. const string txtBoxInput = @"(5.2)/(4.3)"; was the simulated sample input. You can instead take the value of textbox1.Text and the code will still function.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC