Project

General

Profile

Design #1075

LaTeX package: power-product printing

Added by John Abbott almost 7 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Low
Category:
enhancing/improving
Target version:
Start date:
22 May 2017
Due date:
% Done:

100%

Estimated time:
3.65 h
Spent time:

Description

I have just checked in a revised version of the LaTeX package:
  • revised spacing between indets in a power-product (so that x*y looks slightly different from xy)

2017-12 split ideal into new Design #1137


Related issues

Related to CoCoA-5 - Bug #995: LaTeX(x^10) should use curly bracketsClosed2017-01-11

Related to CoCoA-5 - Design #1137: Latex: idealClosed2017-12-11

History

#1 Updated by John Abbott almost 7 years ago

  • Related to Bug #995: LaTeX(x^10) should use curly brackets added

#2 Updated by John Abbott almost 7 years ago

Since CoCoA-5 allows indets with long names, I wanted to revise LaTeX.cpkg5 so that the product x*y looks different from the indet xy. I did this by inserting a little space between indets in a power-product.

There may be other ways of distinguishing the two cases. For instance an indet called alpha should probably be translated into LaTeX \alpha; but I am not sure how to do this in a "scalable" way.

Currently only exponents greater than 9 are printed inside curly brackets; presumably it is done this way because that is what a person would do. Why not put all exponents inside curly brackets? Can we ever have negative exponents? Perhaps not yet; maybe never!

I think that using \ideal{...} for ideals is better than just putting the gens inside round brackets, because the user can then define \ideal to do "the right thing". It also adds a "semantic hint" to the generated LaTeX.

#3 Updated by Anna Maria Bigatti almost 7 years ago

  • % Done changed from 0 to 10

I would define space to the empty string if [1] = MakeSet([ len(IndetName(X)) | X in indets(R) ]);

(or some similar check)

I'd rather have the output of latex more similar to a human generated latex, otherwise the typeset would look "strange".

#4 Updated by Anna Maria Bigatti over 6 years ago

  • Subject changed from LaTeX package: some details to LaTeX package: power-product printing
  • Description updated (diff)
  • Status changed from New to In Progress
  • Assignee set to Anna Maria Bigatti
  • Target version changed from CoCoA-5.?.? to CoCoA-5.2.4

#5 Updated by Anna Maria Bigatti over 6 years ago

#6 Updated by Anna Maria Bigatti over 6 years ago

Made simpler in easy, common cases: when all the indets in the ring are single letters, then the indets in a power-product
are separated by " " (i.e. a space). Otherwise they are separated by "\!\:".

#7 Updated by John Abbott almost 6 years ago

  • % Done changed from 10 to 50

The use of "\!\:" is not ideal since "\:" is elastic. Maybe it is a reasonable compromise?
Anna points out that if the symbols all have subscripts then there is (probably) no need to put spaces between them.

#8 Updated by John Abbott almost 6 years ago

  • Target version changed from CoCoA-5.2.4 to CoCoA-5.?.?

#9 Updated by John Abbott over 4 years ago

  • Target version changed from CoCoA-5.?.? to CoCoA-5.3.0

I have just tried a quick test: it is a bit surprising that the resulting strings are different

/**/ use QQ[x,y];
/**/ latex(x*y);
x y
/**/ use QQ[x,y,alpha,beta];
/**/ latex(x*y);
x \!\: y

Perhaps the criterion in comment 3 should consider only those indets which actually appear in the PP? (or is that too un-KISS-like?)

#10 Updated by Anna Maria Bigatti over 4 years ago

John Abbott wrote:

Perhaps the criterion in comment 3 should consider only those indets which actually appear in the PP? (or is that too un-KISS-like?)

sounds un-KISS.
Another proposal could be that indets with more than one letter are printed with "\".
Indeed, if I'm using "alpha" in cocoa, I probably think of "\alpha" in TeX.

#11 Updated by Anna Maria Bigatti about 4 years ago

  • Target version changed from CoCoA-5.3.0 to CoCoA-5.4.0

#12 Updated by John Abbott over 2 years ago

  • Target version changed from CoCoA-5.4.0 to CoCoA-5.4.2

#13 Updated by John Abbott about 1 year ago

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 80
I like the suggestion of putting a backslash in front of all long indet names:
  • if the indet name is a greek letter then it will do just what is wanted
  • if the indet name is not a greek letter then the user must anyway intervene manually to say how to print it
    (and a good approach is to define an appropriate LaTeX macro)

Not sure what happens to letters from other alphabets...

#14 Updated by John Abbott about 1 year ago

I am a little unhappy about \!\: which does look rather ugly.
Maybe it is OK if (at least) one of the indets does have a long name?
I'd like to re-propose my suggestion in comment 9: use spacing only if at least one indet is long.

#15 Updated by Anna Maria Bigatti about 1 year ago

John Abbott wrote:

I like the suggestion of putting a backslash in front of all long indet names:
  • if the indet name is a greek letter then it will do just what is wanted
  • if the indet name is not a greek letter then the user must anyway intervene manually to say how to print it
    (and a good approach is to define an appropriate LaTeX macro)

this is still my preferred choice.
Moreover, I'd leave a space " " (not "\;") between indet names if there is at least one with a not-single-letter name. This is just to make the LaTeX source more readable/robust (e.g. "$\alpha x y$")

#16 Updated by John Abbott about 1 year ago

I think I now agree with Anna's comment 15.
If there are long indet names then the user will almost surely have to refine the LaTeX output manually,
so we may as well make the LaTeX output as easy-to-read as possible: in other words we just put a space
between indet names (but a long is preceded by a backslash).

Example of my latest "hack":

/**/ use QQ[x,alpha,y];
/**/ LaTeX(x*alpha*y);
x \alpha y

NOTE: we currently separate indexes by \, -- is this what we want?

#17 Updated by John Abbott about 1 year ago

  • Status changed from Resolved to Feedback
  • % Done changed from 80 to 90

#18 Updated by John Abbott 5 months ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100
  • Estimated time set to 3.65 h

It seems that current impl has opted for KISS with long names preceded by a backslash.
This seems to be a good compromise.
Closing after 9 months in feedback.

Also available in: Atom PDF