Ticket #4945 (closed defect: fixed)

Opened 20 months ago

Last modified 20 months ago

[with patch, positive review] LaTeX for gp elements shouldn't use verbatim environment

Reported by: malb Owned by: cwitty
Priority: minor Milestone: sage-3.3
Component: misc Keywords: jsmath
Cc: Author(s):
Report Upstream: Reviewer(s):
Merged in: Work issues:

Description

Gary wrote: When using the SAGE notebook with typeset on, the command

  gp(2+2) 

gives the error 'Unknown environment "verbatim"'. Typing

  gp(2+2) 

in the SAGE command line works fine. I think it is a latex output error. I can confirm this bug. It is caused by the generic latex method for Expect elements:

sage: latex(gp(2+2)) 
\begin{verbatim}4\end{verbatim} 

which apparently doesn't play well with jsMath. search_src("begin{verbatim}") returns 43 hits.

Attachments

4945.patch Download (1.4 KB) - added by jhpalmieri 20 months ago.

Change History

  Changed 20 months ago by jhpalmieri

  • summary changed from LaTeX for gp elements shouldn't use verbatim environment to [with patch, needs review] LaTeX for gp elements shouldn't use verbatim environment

| search_src("begin{verbatim}") returns 43 hits

Most of those are in docstrings, so we don't need to worry about them. I think the only relevant instances are interfaces/expect.py, misc/latex.py, misc/log.py. I don't understand how verbatim is used in the last two. The attached patch seems to fix the problem in the first one: latex(gp(2+2)) works in the notebook now.

(The solution here is to change verbatim to verb -- search misc/all.py for 'verbatim' to see very similar code) and then to use the jsMath 'verb' extension.)

follow-up: ↓ 3   Changed 20 months ago by malb

The extra \require{verb} worries me, since it is included each time an element is LaTeXified?. Shouldn't it be in some header?

Cheers, Martin

in reply to: ↑ 2   Changed 20 months ago by jhpalmieri

Replying to malb:

The extra \require{verb} worries me, since it is included each time an element is LaTeXified?. Shouldn't it be in some header?

Yes, maybe it should. I couldn't figure out where, though.

(For more on the jsMath verb extension, including different ways of loading it, see  this web page.)

  Changed 20 months ago by jhpalmieri

I just posted a slightly different version of the patch. It doesn't address malb's issue, but it is a little cleaner: it only includes '\require{verb}' if in notebook mode.

  Changed 20 months ago by jhpalmieri

Okay, here's a patch which (I think) addresses malb's issue.

Changed 20 months ago by jhpalmieri

  Changed 20 months ago by malb

  • summary changed from [with patch, needs review] LaTeX for gp elements shouldn't use verbatim environment to [with patch, positive review] LaTeX for gp elements shouldn't use verbatim environment

Patch looks good.

  Changed 20 months ago by mabshoff

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from sage-3.4.1 to sage-3.3

Merged in Sage 3.3.alpha0

Note: See TracTickets for help on using tickets.