Wanted: Unicode testers with PR #36861

157 views
Skip to first unread message

Kwankyu Lee

unread,
Dec 14, 2023, 4:18:41 AM12/14/23
to sage-devel
Hi,

The PR 


aims at switching from pdflatex to xelatex the latex engine to render objects in pdf using the command like "view(objects)" as well as in building the sage documentation.

As xelatex natively supports Unicode, we removed lots of commands like

\DeclareUnicodeCharacter{03B1}{\ensuremath{\alpha}}

which were needed to support Unicode in pdflatex. 

We worry that some Unicode functionality was lost in this process, and so we invite Unicode users to test with the PR.

Here is the Binder link to where you can play around with xelatex-enabled sage:


or you should build sage with the PR.

If you find some Unicode-related defect not existent in sage 10.2, please report it to the PR. 

Thanks.

Doris Behrendt

unread,
Dec 14, 2023, 3:06:17 PM12/14/23
to sage-...@googlegroups.com
Hi all,

why xelatex and not lualatex?

Doris
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/ac185d29-e64b-42a3-a4b9-d25e2b31474cn%40googlegroups.com.

Dima Pasechnik

unread,
Dec 14, 2023, 4:22:49 PM12/14/23
to sage-...@googlegroups.com
Hi Doris,
It just has been turned to use lualatex

HTH
Dima
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/93C23CA8-99D8-4051-B01B-DBF0CDEF8FD1%40me.com.

William Stein

unread,
Dec 14, 2023, 4:30:27 PM12/14/23
to sage-...@googlegroups.com
Hi,

Last time I benchmarked things, luatex was sometimes the slowest of
the three major latex compilers, sometimes by a factor of 2.
I realize benchmarking could be impacted by things like how exactly
Lua was built on the target platform, as part of latex. In any case,
for
this application, performance could matter.

I had nothing to do with them making xelatex the default, and I think
Lua and Luatex are beautiful pieces of software.

-- William
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq343js%3DCYzBMt9z8PmX5AkPd2qfkpRqUaB%3DUSL21b%3D5tw%40mail.gmail.com.



--
William (http://wstein.org)

Dima Pasechnik

unread,
Dec 14, 2023, 5:01:55 PM12/14/23
to sage-...@googlegroups.com
On Thu, Dec 14, 2023 at 9:30 PM William Stein <wst...@gmail.com> wrote:
>
> Hi,
>
> Last time I benchmarked things, luatex was sometimes the slowest of
> the three major latex compilers, sometimes by a factor of 2.
> I realize benchmarking could be impacted by things like how exactly
> Lua was built on the target platform, as part of latex. In any case,
> for
> this application, performance could matter.

Let me say few words on preference for lualatex. Once I heard about
Kwankyu's PR, I immediately suggested that should be luatex, not
xetex. After trying xetex he decided to switch it to luatex.

1) lua(lat)tex is the official TexLive's successor of pdf(la)tex. It
has proper unicode support,
one can use unicode maths, etc. luatex is packaged better within TeXLive too.

2) xelatex has been in maintenance mode for some year by now, and
it's unicode support is a bit funny. (in pdflatex it's next to nonexistent)

3) For building sagemath PDF docs it doesn't matter much, one doesn't
do it often, it's not instant.
Using unicode in docstrings makes them more readable and faster (less MathJax).

OTOH Sage's view() might need the speed, but you can change what
engine you use there
irrespective of what's used for building the docs.

Dima
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CACLE5GDwsFq2CJzQ9xFO8F14N-7zbZuTVQ1-hFuKo9mLt_Ekpw%40mail.gmail.com.

William Stein

unread,
Dec 14, 2023, 6:23:51 PM12/14/23
to sage-...@googlegroups.com
Hi,

I just did some new benchmarks comparing lualatex to xelatex on some
basic formulas like what I think is likely
to be relevant. This just involved running laulatex and xelatex many
times on the same tex file full of equations
and looking at the time. I used a ramdisk to avoid disk speed
mattering. The times were very stable:

lualatex -- 1 second
xelatex -- 1.2 seconds
pdflatex -- 0.43 seconds

So I totally retract my concern about lualatex being slower than
xelatex. In fact it's about the same or faster
in this benchmark. That said, pdflatex is noticeably faster than either.

-- William
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq2882pWK9YWE-ZiVzmR0xXqXM6zX64_Y7ko96ko%3Dh0ftg%40mail.gmail.com.



--
William (http://wstein.org)

Dima Pasechnik

unread,
Dec 14, 2023, 6:46:49 PM12/14/23
to sage-...@googlegroups.com, Doris Behrendt
On Thu, Dec 14, 2023 at 11:23 PM William Stein <wst...@gmail.com> wrote:

> I just did some new benchmarks comparing lualatex to xelatex on some
> basic formulas like what I think is likely
> to be relevant. This just involved running laulatex and xelatex many
> times on the same tex file full of equations
> and looking at the time.

AFAIK there is a way to speeding things up with luatex on files with
the same preamble.
Namely, one can generate a custom format, speeding up things like font loading.
(might be relevant for speeding up view()).

But it's above my pay grade, we need a real TeX hacker here. Maybe
Doris (in CC) could help us.

Best,
Dima
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CACLE5GCVeJW_vyAXHA8UiejPUFDS4%3D_MoJuNfZ7Ro__Y%3D2YWRA%40mail.gmail.com.

Doris Behrendt

unread,
Dec 15, 2023, 12:57:05 AM12/15/23
to sage-...@googlegroups.com
Hi all,
> AFAIK there is a way to speeding things up with luatex on files with
> the same preamble.
> Namely, one can generate a custom format, speeding up things like font loading.
> (might be relevant for speeding up view()).
>
> But it's above my pay grade, we need a real TeX hacker here. Maybe
> Doris (in CC) could help us.
>


I can look into it, but not before Christmas ... you'll hear from me.
And btw I'm not a tex hacker, only the treasurer of DANTE e.V., but I know whom to ask ...

Doris
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAAWYfq39hGSAq73zjfLoRj50ntMzjgQwepyFmWpjKf%3DgM2u%3D%3Dg%40mail.gmail.com.


Kwankyu Lee

unread,
Dec 15, 2023, 2:26:07 AM12/15/23
to sage-devel
lualatex -- 1 second
xelatex -- 1.2 seconds
pdflatex -- 0.43 seconds

So I totally retract my concern about lualatex being slower than
xelatex. In fact it's about the same or faster
in this benchmark. That said, pdflatex is noticeably faster than either.

That gives another reason to choose lualatex over xelatex. And hopefully Unicode support is more worth than the speed loss. 

Emmanuel Charpentier

unread,
Dec 16, 2023, 5:07:07 AM12/16/23
to sage-devel

I seond the previous arguments for switching to lualatex rather than xetex : the former is officially the heir apparent to pdftex, while the latter is bound to become an historical, then unmaintained, then paleontological piece of software…

And, yes, supporting Unicode is a necessity. Unless you insist on ressurecting the horrors of codepages or EBCDIC

Of note : using TeXLive setup, I noticed that the most important slowdown of lualatex seems to originate in the first use of a given font in a given document : lualatex seems to compile a file of font metrics, which is lengthy, but is re-used in following recompilations. This compilation is especially long for math fonts, which have a few thousands of glyphs/symbols (rather than a mere hundreds for a vanilla alphabetic font. And don’t get me sarted on hanzi or kanji fonts…).

ISTR that this “font metrics caching” can be directed to be shared for a whole directory, subtree or even globally, bu, my head on the billot, I couldn’t remember how… Maybe Doris migh be more helpful ?

Reply all
Reply to author
Forward
0 new messages