#5975: [with patch, needs review] Implement latex output for (combinatorial)
graphs
--------------------------+-------------------------------------------------
 Reporter:  rbeezer       |       Owner:  rbeezer                          
     Type:  enhancement   |      Status:  new                              
 Priority:  major         |   Milestone:  sage-feature                     
Component:  graph theory  |    Keywords:                                   
 Reviewer:                |      Author:  Robert Beezer, Fidel Barrera Cruz
   Merged:                |  
--------------------------+-------------------------------------------------

Comment(by rbeezer):

 Hi John,

 1.  The initialization of a {{{GenericGraph}}} has the necessary
 {{{\usepackage}}} as you included in your patch and I added the jsmath-
 avoidance string based on the {{{tikzpicture}}} latex environment.  This
 only happens if the right packages are actually installed, so a user's
 preamble won't get fouled with missing packages.

 2.  After several approaches, I finally created a {{{check_tkz_graph}}}
 method.  This acts as a one-time check and warning on a user's
 environment.  It is called from the routine that actually builds the latex
 string ({{{tkz_picture}}}).  So if a user never tries to render a graph,
 they never hear about it.  And when they do try, they get a one-time
 warning if the packages are missing.  This makes doctesting easier -
 before testing a latex string, we call {{{check_tkz_graph}}} as a "random"
 doctest and possibly warnings are emitted, but are ignored.  Then we
 actually build the string and it will be free of error messages for
 comparison to the expected output.  Consequently, {{{have_tkz_graph}}} no
 longer emits messages, just reports the presence of the packages.  This
 scheme should scale to other packages that might be employed to draw
 graphs.

 3.  {{{have_tkz_graph}}} is now a module level function, as it should be,
 alongside the new {{{check_tkz_graph}}}.

 4.  I didn't study your original question very carefully about
 {{{GenericGraph.latex_options()}}}.  No, it wasn't really designed to
 accept options, but the {{{kwds}}} argument was needed to make the
 @options decorator work.  I wasn't very happy with @options, since it
 appeared twice, requiring two (identical) edits to keep the defaults in
 sync.  So, I've removed the decorators and now default options are set in
 the {{{GraphLatex}}} initialization where they need only be edited once.
 And so {{{latex_options()}}} will no longer accept any arguments.

 5.  Documentation:
     (a)  "Visualization" section for graphs has a short blurb and points
 to the {{{sage.graphs.graph_latex}}} module for details.[[BR]]
     (b)  Module level documentation in sage.graphs.graph_latex is meant to
 be a fairly comprehensive introduction.  I was asked not to pile too much
 stuff into {{{sage/graphs/graph.py}}} since it is so big already, which
 mostly explains why I've put it here.[[BR]]
     (c)  Authoritative documentation for the actual options is being kept
 in the docstring for {{{GraphLatex.set_option()}}}, which is were options
 actually get set.  We only have one option right now, but there will be
 more.  Necessarily some of these will need to refer to the approximately
 100-page manual for tkz-graph.[[BR]]
     (d)  I've added pointers to the module documentation from the
 {{{plot()}}} and {{{plot3d()}}} methods for graphs.[[BR]]

 Delta patch should help you *see* where latest changes are - it begins
 after your reviewer patch to my version 3.  I wouldn't trust this delta
 patch as something to apply on an old branch, please do any testing based
 on the self-contained version 4, which needs to be applied on top of
 #6089.

 Thanks,
 Rob

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5975#comment:21>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to