Hi John, Thanks for the fix! That behavior was driving me crazy. ;-) I've been away for a few days, so I'm sorry I didn't reply to your other messages as you diagnosed this.
I'll get back to this soon and I'll keep an eye out for any explanations, in addition to looking at #5610. I've only written a few new doctests for this file, but have spent enough time with the code that I might be able to add some more, more quickly. While on the topic, is there a need for the global "_have_dvipng" variable in this file? it only seems to be used within the have_dvipng () function, and nowhere else. I was thinking of removing it. Rob On Apr 14, 11:57 am, John H Palmieri <jhpalmier...@gmail.com> wrote: > On Apr 11, 5:57 pm, Rob Beezer <goo...@beezer.cotse.net> wrote: > > > > > I've been adding documentation to sage/misc/latex.py and discovered > > that if I add a trivial docstring (empty, one-line, other variants of > > trivial) to the first function in the file (which is "have_dvipng") > > then a test run on that file really goes haywire. Take out the > > trivial docstring and all tests pass. > > > It would appear that the value of the boolean constant EMBEDDED_MODE > > might be affected, as much of the erroneous doctest output gets > > wrapped in HTML tags, when the expected output is not in this format. > > I haven't put much work into trying to isolate the problem (other than > > removing/adding the additional docstring repeatedly - that sound you > > hear is me banging my head on the wall). I'm wondering if this sounds > > familiar to anybody, or if there is output I could post that would be > > helpful in diagnosing the problem. > > > Thanks, > > Rob > > Hi Rob, > > I figured out how to fix the problem, although I still don't know why > adding a docstring should cause it. > > To fix it: the docstring for "print_or_typeset" contains the lines > > sage: sys.displayhook = sage.misc.latex.pretty_print > sage: sage.misc.latex.print_or_typeset(3) > <html><span class="math">3</span></html> > sage: sage.misc.latex.EMBEDDED_MODE=False > > You need to add a line to the beginning and a line to the end, making > it: > > sage: TEMP = sys.displayhook > sage: sys.displayhook = sage.misc.latex.pretty_print > sage: sage.misc.latex.print_or_typeset(3) > <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</ > span></html> > sage: sage.misc.latex.EMBEDDED_MODE=False > sage: sys.displayhook = TEMP > > This is included in the patch for <http://trac.sagemath.org/sage_trac/ > ticket/5610>, although that patch includes lots of other things, too. > As part of that patch, I added a few doctests to latex.py, but I don't > have time to get anywhere close to 100%. > > John --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---