#14714: Correct latex generated by DyckWord class
---------------------------------+------------------------------------------
       Reporter:  zabrocki       |         Owner:  sage-combinat
           Type:  defect         |        Status:  new          
       Priority:  major          |     Milestone:  sage-5.11    
      Component:  combinatorics  |    Resolution:               
       Keywords:                 |   Work issues:               
Report Upstream:  N/A            |     Reviewers:               
        Authors:  zabrocki       |     Merged in:               
   Dependencies:                 |      Stopgaps:               
---------------------------------+------------------------------------------

Comment (by zabrocki):

 There were a couple of bugs going on here

 bug 1 - there were a couple of places producing the latex {{{line
 width=2px}}} when it should read {{{line width=2}}} (and there should be
 no {{{px}}}).  This has an easy fix.

 bug 2 - seemed to be a little more subtle and I feel like I discovered how
 to fix it, but others will also waste time trying to figure this out if
 something else isn't changed (either the documentation or the code for
 {{{latex}}}).

 when {{{_latex_file_}}} produces code it does it in the following order:
 1. create latex header/preamble
 2. latex each object in a list
 3. latex end document

 However what we were assuming in {{{view(DyckWord([1,0]))}}} is that we
 would edit the preamble when the object was latex'ed to add the {{{tikz}}}
 package.  This caused an error the first time that {{{view}}} was called,
 but the second time that view was called the {{{tikz}}} package was in the
 header and so it worked fine.

 I found out that the way to make this work properly is to ensure that the
 {{{tikz}}} package is added to the preamble when the {{{DyckWord}}} is
 created in the {{{__init___}}} method.  This seems a little overkill since
 it seems that any time you call a {{{DyckWord}}} into creation, it adds
 the {{{tikz}}} package into the preamble even if you never latex a
 {{{DyckWord}}} object.

 Minimum fix of this problem should document that
 {{{latex.add_package_to_preamble_if_available}}} should be called before
 an object that requires the package is latexed (that is, the method
 {{{_latex_}}} should never call the function
 {{{latex.add_package_to_preamble_if_available}}}, it should always be done
 in the {{{__init__}}}).  I checked and the only other code that uses the
 {{{latex.add_package_to_preamble_if_available}}} is {{{graphs}}} and it is
 also the case that the {{{tikz}}} package is added in the {{{__init__}}}
 method.

 I will add a patch which corrects these bugs shortly.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14714#comment:2>
Sage <http://www.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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to