77#include " properties/LaTeXForm.hh"
88#include " properties/Derivative.hh"
99#include " properties/Accent.hh"
10+ #include " properties/Tableau.hh"
11+ #include " properties/FilledTableau.hh"
12+ #include " properties/TableauInherit.hh"
1013
1114#define nbsp " "
1215// (( parent.utf8_output?(unichar(0x00a0)):" "))
@@ -69,6 +72,8 @@ bool DisplayTeX::needs_brackets(Ex::iterator it)
6972 }
7073 }
7174
75+ if (parent==" \\ oplus" && child==" \\ otimes" ) return true ;
76+
7277 if (parent==" \\ pow" && (child==" \\ prod" || child==" \\ sum" || child==" \\ oplus" || der)) return true ;
7378
7479 if (parent==" \\ wedge" && child==" \\ prod" ) return true ;
@@ -200,17 +205,16 @@ void DisplayTeX::print_tableau(std::ostream& str, Ex::iterator it)
200205 str << " \\ , " ;
201206 }
202207
203- str << texify (*it-> name ) ;
208+ str << " \\ ydiagram{ " ;
204209 auto sib=tree.begin (it);
205- str << " {" ;
206210 while (sib!=tree.end (it)) {
207- str << " {" ;
208- dispatch (str, sib);
209- str << " }" ;
211+ str << *sib->multiplier ;
210212 ++sib;
213+ if (sib!=tree.end (it))
214+ str << " ," ;
211215 }
212216 str << " }" ;
213-
217+
214218 if (needs_brackets (it))
215219 str << " \\ right)" ;
216220 }
@@ -226,12 +230,9 @@ void DisplayTeX::print_ftableau(std::ostream& str, Ex::iterator it)
226230 str << " \\ , " ;
227231 }
228232
229- str << texify (*it-> name ) ;
233+ str << " \\ ytableaushort{ " ;
230234 auto sib=tree.begin (it);
231- str << " {" ;
232235 while (sib!=tree.end (it)) {
233- if (sib!=tree.begin (it))
234- str << " ," ;
235236 if (*sib->name !=" \\ comma" ) {
236237 str << " {" ;
237238 dispatch (str, sib);
@@ -247,6 +248,8 @@ void DisplayTeX::print_ftableau(std::ostream& str, Ex::iterator it)
247248 }
248249 }
249250 ++sib;
251+ if (sib!=tree.end (it))
252+ str << " ," ;
250253 }
251254 str << " }" ;
252255
@@ -458,26 +461,26 @@ void DisplayTeX::print_parent_rel(std::ostream& str, str_node::parent_rel_t pr,
458461
459462void DisplayTeX::dispatch (std::ostream& str, Ex::iterator it)
460463 {
461- if (*it->name ==" \\ prod" ) print_productlike (str, it, " " );
462- else if (*it->name ==" \\ sum" || *it->name ==" \\ oplus" ) print_sumlike (str, it);
463- else if (*it->name ==" \\ frac" ) print_fraclike (str, it);
464- else if (*it->name ==" \\ comma" ) print_commalike (str, it);
465- else if (*it->name ==" \\ arrow" ) print_arrowlike (str, it);
466- else if (*it->name ==" \\ inner" ) print_dot (str, it);
467- else if (*it->name ==" \\ pow" ) print_powlike (str, it);
468- else if (*it->name ==" \\ int" ) print_intlike (str, it);
469- else if (*it->name ==" \\ equals" || *it->name ==" \\ unequals" ) print_equalitylike (str, it);
470- else if (*it->name ==" \\ commutator" ) print_commutator (str, it, true );
471- else if (*it->name ==" \\ anticommutator" ) print_commutator (str, it, false );
472- else if (*it->name ==" \\ components" ) print_components (str, it);
473- else if (*it->name ==" \\ wedge" ) print_wedgeproduct (str, it);
474- else if (*it->name ==" \\ conditional" ) print_conditional (str, it);
475- else if (*it->name ==" \\ greater" || *it->name ==" \\ less" ) print_relation (str, it);
476- else if (*it->name ==" \\ indexbracket" ) print_indexbracket (str, it);
477- else if (*it->name ==" \\ tableau " ) print_tableau (str, it);
478- else if (*it-> name == " \\ ftableau " ) print_ftableau (str, it);
479- else if (*it-> name == " \\ ldots " ) print_dots (str, it);
480- else print_other (str, it);
464+ if (*it->name ==" \\ prod" ) print_productlike (str, it, " " );
465+ else if (*it->name ==" \\ sum" || *it->name ==" \\ oplus" ) print_sumlike (str, it);
466+ else if (*it->name ==" \\ frac" ) print_fraclike (str, it);
467+ else if (*it->name ==" \\ comma" ) print_commalike (str, it);
468+ else if (*it->name ==" \\ arrow" ) print_arrowlike (str, it);
469+ else if (*it->name ==" \\ inner" ) print_dot (str, it);
470+ else if (*it->name ==" \\ pow" ) print_powlike (str, it);
471+ else if (*it->name ==" \\ int" ) print_intlike (str, it);
472+ else if (*it->name ==" \\ equals" || *it->name ==" \\ unequals" ) print_equalitylike (str, it);
473+ else if (*it->name ==" \\ commutator" ) print_commutator (str, it, true );
474+ else if (*it->name ==" \\ anticommutator" ) print_commutator (str, it, false );
475+ else if (*it->name ==" \\ components" ) print_components (str, it);
476+ else if (*it->name ==" \\ wedge" ) print_wedgeproduct (str, it);
477+ else if (*it->name ==" \\ conditional" ) print_conditional (str, it);
478+ else if (*it->name ==" \\ greater" || *it->name ==" \\ less" ) print_relation (str, it);
479+ else if (*it->name ==" \\ indexbracket" ) print_indexbracket (str, it);
480+ else if (*it->name ==" \\ ldots " ) print_dots (str, it);
481+ else if (kernel. properties . get <Tableau>(it)) print_tableau (str, it);
482+ else if (kernel. properties . get <FilledTableau>(it)) print_ftableau (str, it);
483+ else print_other (str, it);
481484 }
482485
483486void DisplayTeX::print_commalike (std::ostream& str, Ex::iterator it)
@@ -576,6 +579,14 @@ void DisplayTeX::print_productlike(std::ostream& str, Ex::iterator it, const std
576579 str_node::bracket_t previous_bracket_=str_node::b_invalid;
577580// bool beginning_of_group=true;
578581 Ex::sibling_iterator ch=tree.begin (it);
582+ bool prev_is_tableau=false ;
583+ if (ch!=tree.end (it)) {
584+ const Tableau *tab =kernel.properties .get <Tableau>(ch);
585+ const FilledTableau *ftab=kernel.properties .get <FilledTableau>(ch);
586+ const TableauInherit *itab=kernel.properties .get <TableauInherit>(ch);
587+ if (tab || ftab || itab)
588+ prev_is_tableau=true ;
589+ }
579590 while (ch!=tree.end (it)) {
580591 str_node::bracket_t current_bracket_=(*ch).fl .bracket ;
581592 if (previous_bracket_!=current_bracket_) {
@@ -590,14 +601,26 @@ void DisplayTeX::print_productlike(std::ostream& str, Ex::iterator it, const std
590601 if (current_bracket_!=str_node::b_none)
591602 print_closing_bracket (str, current_bracket_, str_node::p_none);
592603 }
593-
594- if (ch!=tree.end (it)) {
595- if (print_star) {
596- if (tight_star) str << inbetween;
597- else str << " " << inbetween << " " ;
604+ else {
605+ const Tableau *tab =kernel.properties .get <Tableau>(ch);
606+ const FilledTableau *ftab=kernel.properties .get <FilledTableau>(ch);
607+ const TableauInherit *itab=kernel.properties .get <TableauInherit>(ch);
608+ if (tab || ftab || itab) {
609+ if (prev_is_tableau)
610+ str << " \\ otimes " ;
611+ else
612+ str << " " ;
613+ prev_is_tableau=true ;
598614 }
599615 else {
600- str << " " ;
616+ prev_is_tableau=false ;
617+ if (print_star) {
618+ if (tight_star) str << inbetween;
619+ else str << " " << inbetween << " " ;
620+ }
621+ else {
622+ str << " " ;
623+ }
601624 }
602625 }
603626 previous_bracket_=current_bracket_;
@@ -618,6 +641,14 @@ void DisplayTeX::print_sumlike(std::ostream& str, Ex::iterator it)
618641 unsigned int steps=0 ;
619642
620643 Ex::sibling_iterator ch=tree.begin (it);
644+ bool prev_is_tableau=false ;
645+ if (ch!=tree.end (it)) {
646+ const Tableau *tab =kernel.properties .get <Tableau>(ch);
647+ const FilledTableau *ftab=kernel.properties .get <FilledTableau>(ch);
648+ const TableauInherit *itab=kernel.properties .get <TableauInherit>(ch);
649+ if (tab || ftab || itab)
650+ prev_is_tableau=true ;
651+ }
621652 while (ch!=tree.end (it)) {
622653 // if(ch!=tree.begin(it))
623654 // str << "%\n"; // prevent LaTeX overflow.
@@ -626,8 +657,20 @@ void DisplayTeX::print_sumlike(std::ostream& str, Ex::iterator it)
626657 str << " %\n " ; // prevent LaTeX overflow.
627658 }
628659 if (*ch->multiplier >=0 && ch!=tree.begin (it)) {
629- if (*it->name ==" \\ sum" )
630- str << " +" ;
660+ if (*it->name ==" \\ sum" ) {
661+ const Tableau *tab =kernel.properties .get <Tableau>(ch);
662+ const FilledTableau *ftab=kernel.properties .get <FilledTableau>(ch);
663+ const TableauInherit *itab=kernel.properties .get <TableauInherit>(ch);
664+ if (tab || ftab || itab) {
665+ if (prev_is_tableau)
666+ str << " \\ oplus " ;
667+ else
668+ str << " +" ;
669+ prev_is_tableau=true ;
670+ }
671+ else
672+ str << " +" ;
673+ }
631674 else
632675 str << *it->name << " {}" ;
633676 }
0 commit comments