Ticket #5791 (closed enhancement: fixed)

Opened 17 months ago

Last modified 16 months ago

[with patch, positive review] Allow custom packages to be injected or %latex and the Sage latex mode

Reported by: mabshoff Owned by: jhpalmieri
Priority: major Milestone: sage-3.4.2
Component: misc Keywords:
Cc: Author(s):
Report Upstream: Reviewer(s):
Merged in: Work issues:

Description

See  http://groups.google.com/group/sage-devel/browse_thread/thread/39f1d0e71eae2453 for the discussion: It would be great of one could add packages that are automatically included when running LaTeX, i.e. for commutative diagrams.

Cheers,

Michael

Attachments

latex-5791.patch Download (8.2 KB) - added by jhpalmieri 17 months ago.

Change History

Changed 17 months ago by jhpalmieri

  • owner changed from cwitty to jhpalmieri
  • status changed from new to assigned
  • summary changed from Allow custom packages to be injected or %latex and the Sage latex mode to [with patch, needs review] Allow custom packages to be injected or %latex and the Sage latex mode

Here's an attempt at this. To use it:

sage: latex.add_macro('\\newcommand{\\foo}{bar}')

and then a %latex cell with \\foo in it will be processed correctly, as will %jsmath and %html cells. Also,

sage: latex.add_to_preamble('\\usepackage{blah}')

will do what it says; it should only have an effect on %latex cells.

(In this patch, "macros" are things which are processed by latex and jsmath, while the "preamble" is only passed to latex. For both categories, you can add to the current string with latex.add_macro or latex.add_preamble, or you can replace it with latex.extra_macros or latex.extra_preamble.)

Some pictures are  here and  here.

Anyway, please test it out; the patch is against 3.4.2.alpha0.

Changed 17 months ago by jhpalmieri

Changed 17 months ago by rbeezer

  • summary changed from [with patch, needs review] Allow custom packages to be injected or %latex and the Sage latex mode to [with patch, positive review] Allow custom packages to be injected or %latex and the Sage latex mode

Passes tests on misc/latex.py and misc/latex_macros.py in 3.4.2.alpha0, and works as advertised at command-line and in notebook.

PDF version of documentation builds fine also. Another great addition to Sage-LaTeX integration.

So this is ready to go - positive review.

Changed 16 months ago by mabshoff

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone changed from sage-4.0 to sage-3.4.2

Merged in Sage 3.4.2.rc0.

Cheers,

Michael

Note: See TracTickets for help on using tickets.