iOS开源 - 数学,物理,化学公式以及图形渲染库
iqrhtv6594
8年前
<p><strong>Latex</strong></p> <p>latex是目前比较全面用于将数学,物理,化学公式转换成格式化字符的形式,现在也是各大主流教育类app的主要数据存储形式.</p> <p><strong>Katex</strong></p> <p>Katex是基于js实现的渲染Latex代码的库,据称是目前渲染效率最好,性能最优的公式渲染引擎.</p> <p><strong>MathKit</strong></p> <p>基于Katex渲染库,并用YYText进行异步排版,完美实现了理科公式非数据化数据的处理以及视图展示.MathKit github链接</p> <p><strong>MathKit强在哪?</strong></p> <ul> <li>强劲的渲染性能</li> <li>非常简单的代码</li> <li>快速集成</li> <li>极少的依赖库</li> <li>一个类,一个属性,一句话解决理科公式渲染 <p><strong>如何使用</strong></p> </li> </ul> <pre> <code class="language-lua">#import "MathSubjectView.h"</code></pre> <pre> <code class="language-lua">NSString*str =@"4.<math>\\displaystyle= \\frac{k(k+1)}{2}+k+1</math>这个大家知道是什么吗?请写出答案吧"; MathSubjectView*subject = [[MathSubjectViewalloc]initWithFrame:CGRectMake(10,100,self.view.bounds.size.width-20,0)]; subject.font= [UIFontsystemFontOfSize:12]; subject.testStr= str; [self.viewaddSubview:subject];</code></pre> <p><strong>举个例子</strong></p> <p style="text-align: center;"><img src="https://simg.open-open.com/show/c737d9e59d28309b0b33b95139224193.png" alt="iOS开源 - 数学,物理,化学公式以及图形渲染库" width="1100" height="1868"></p> <p> </p> <p><strong>GitHub介绍</strong></p> <p><strong>MathKit</strong></p> <h2><strong>What MathKit can do?</strong></h2> <ul> <li> <p>It will render you your math, physics, chemistry or any science formula,Geometric graphics and pictures, as well as general text.</p> </li> <li> <p>MathKit used by the rendering engine from the current fastest performance of the best JavaScript mathematical formula rendering engine</p> </li> <li> <p>MathKit the mathematical formula derived from the code is very simple and very easy to store the <code>Latex code</code></p> </li> </ul> <p>Based on this, we believe that it will become the most popular science formula and graphics rendering Library</p> <h2><strong>Why you need MathKit?</strong></h2> <ul> <li>Strong rendering performance</li> <li>Very simple code</li> <li>Fast integration</li> <li>Minimal dependency Library</li> </ul> <h2><strong>Usage</strong></h2> <ol> <li>Download all the files in the MathKit subdirectory.</li> <li>Add the source files to your Xcode project.</li> <li>Link with required frameworks: <ul> <li>CoreText</li> <li>UIKit</li> <li><a href="/misc/goto?guid=4958838688702703567">SDWebImage</a></li> <li><a href="/misc/goto?guid=4958971667887126889">YYText</a></li> </ul> </li> <li>Import <code>MathSubjectView.h</code>.</li> <li>Initialization of an instance object, and give the <code>testStr</code> attribute assignment, where the object will be copied to the mixture of arbitrary science formulas and pictures of the string.<br> Note: Here's the formula in the string need to use a tag similar to <code><math></math></code> wrapped up, and the picture will need to use a tag similar to <code><image></image></code> wrapped up, so as to be recognized</li> <li>Add the instance object to your view.</li> </ol> <p>If you still do not know how to use it, then download the code to see it, the package has my prepared sample demo.</p> <p> <!-- further readings --></p> <ul> <li> <p><a href="/misc/goto?guid=4959652010556459514">Katex-https://github.com/Khan/KaTeX</a></p> <p><a href="/misc/goto?guid=4959727569976751267">CodingSha</a>・ <a href="/misc/goto?guid=4959652010556459514"> github.com → </a></p> </li> <li> <p><a href="/misc/goto?guid=4959727570071324986">GitHub - CodingSha/SPMathKit: Render math exercises for your view. Contains the rendering of mathematical formulas and mathematical graphics</a></p> <a href="/misc/goto?guid=4959727570071324986">— SPMathKit - Render math exercises for your view. Contains the rendering of mathematical formulas and mathematical graphics, as well as the general text </a> <p> </p> </li> </ul> <p><br> </p> <p> </p> <p> </p>