On Sat, Dec 10, 2016 at 11:47 AM, Qian Hong <fract...@gmail.com> wrote:
> hi folks, > > I posted this question in irc but no reply, so I re-post here, also > for better archive. Sorry for duplicating! > (BTW, http://boxen.math.washington.edu/home/keshav/irclogs/ doesn't > work, anyone have a look?) > No problem; IRC is not very active. If you don't get an answer there, I think asking here is perfectly appropriate. I think that the boxen machine is no longer operational; I don't know if the IRC logs are currently being kept, or where they might have migrated to. > > Is there any update or future plan for the below question? > https://ask.sagemath.org/question/9698/latex-function- > prevent-simplification/ > > Quote: " I am trying to use the latex function without the subject > simplifying before it converting to LaTeX. This is similar to the > hold=True for algebra functions. For example, I want latex(x/x) to > return \frac{x}{x} rather than 1" > > If nobody is working on, could you tell me where to start to hack in > sage source code? > The issue is with the simplification of the expression, rather than the latex function. The following currently works: sage: latex(x.mul(x.power(-1),hold=True)) \frac{x}{x} Is this sufficient for your purposes? If not, the relevant code is in sage/symbolic/expression.pyx (it's a big file: search for `hold=False`). David > > My goal is to create a dataset similar to the im2latex-100k set, lets > call im2sage-100k dataset. im2late-100k [1] is a dataset for OpenAI's > task for image-2-latex system [2], which is a task about math formula > OCR. The current best result is made by Harvard NLP Team, which > provides a demo here: http://lstm.seas.harvard.edu/latex/ > > The problem with im2latex is, one math formula image could have > multiple latex representations. To solve the problem, I'm trying to > build a similar dataset im2sage, with formula in sage expression and > formula images. Using im2sage dataset, we can train a deep learning > model to convert formula images back to sage expressions. > > In order to create the im2sage set, i hope to use some function like > latex(sage_expression, hold=True) to convert sage expression to latex > code and then render as image. > > Any hints? Thank you! > > [1] im2latex-100k: https://zenodo.org/record/56198#.WEv8Poh96b9 > [2] OpenAI im2latex: https://openai.com/requests-for-research/#im2latex > > -- > Regards, > Qian Hong > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.