Opened 8 years ago

Last modified 3 years ago

#12559 needs_work enhancement

Chinese translation of "A tour of Sage"

Reported by: mvngu Owned by: Kehengsite
Priority: major Milestone: sage-8.0
Component: translations Keywords: chinese
Cc: lq52655963@…, vbraun Merged in:
Authors: Liu Xiang (廖祥) Reviewers: Volker Braun, Dmitrii Pasechnik, Karl-Dieter Crisman, Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: u/chapoton/12559 (Commits) Commit: 396cce186aa2c6e044bde8e78292b7a5962d01f4
Dependencies: Stopgaps:

Description (last modified by chapoton)

The attachment is created by "kehengsite", whose Chinese name is 廖祥. If you have some good ideas to promote this Sage Chinese document, please tell me throught e-mail (lq52655963@…). In addition, thanks Nguyen to create a trac account for me!

Attachments (7)

A_tour_of_sage_Zh.tar.bz2 (939.4 KB) - added by mvngu 8 years ago.
A_tour_of_sage_Zh.pdf (765.6 KB) - added by ppurka 8 years ago.
A_tour_of_sage_Zh.rar (1005.7 KB) - added by Kehengsite 8 years ago.
Finished intsallation guide
A_tour_of_sage_Zh.rst (14.6 KB) - added by dimpase 7 years ago.
converted to rST using pandoc
SageTutorial_zh_CN.pdf (930.0 KB) - added by vbraun 7 years ago.
pdf output
index.rst (14.6 KB) - added by dimpase 7 years ago.
the rST doc, for review only (it's also in the patch)
trac_12559_tour_chinese.patch (846.2 KB) - added by vbraun 7 years ago.
Updated patch

Change History (71)

Changed 8 years ago by mvngu

comment:1 Changed 8 years ago by ppurka

I have asked one of my Chinese colleagues to take a look at the contents for review.

Changed 8 years ago by ppurka

comment:2 Changed 8 years ago by ppurka

Attached in the pdf file are some comments by my colleague Chengmin Wang. Many thanks to him.

comment:3 Changed 8 years ago by dimpase

  • Cc jpang added

comment:4 Changed 8 years ago by Kehengsite

  • Description modified (diff)
  • Owner changed from mvngu to Kehengsite

In the next,I will add instalation guide to this document.But at first,I need a few days to make understand how this trac syetem works.

comment:5 Changed 8 years ago by Kehengsite

  • Authors set to Kehengsite

comment:6 follow-up: Changed 8 years ago by Kehengsite

  • Description modified (diff)
  • Work issues set to I don't konw how to convert LaTeX file to Sphinx

comment:7 in reply to: ↑ 6 Changed 8 years ago by dimpase

Replying to Kehengsite:

latex->rst [converter http://johnmacfarlane.net/pandoc/]

Changed 8 years ago by Kehengsite

Finished intsallation guide

comment:8 follow-up: Changed 8 years ago by Kehengsite

Waiting to be converted to rst

comment:9 in reply to: ↑ 8 ; follow-up: Changed 8 years ago by dimpase

  • Status changed from new to needs_info

Replying to Kehengsite:

Waiting to be converted to rst

If I try to run latex and then dvips on these files I get

$ dvips A_tour_of_sage_Zh
This is dvips(k) 5.991 Copyright 2011 Radical Eye Software (www.radicaleye.com)
' TeX output 2012.04.01:0058' -> A_tour_of_sage_Zh.ps

kpathsea: Running mktexpk --mfmode ljfour --bdpi 600 --mag 1+437/600 --dpi 1037 unihei52
mktexpk: don't know how to create bitmap font for unihei52.
mktexpk: perhaps unihei52 is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
dvips: Font unihei52 not found; using cmr10

</usr/local/texlive/2011/texmf-dist/fonts/pk/ljfour/public/cm/dpi600/cmr10.pk>
dvips: ! invalid char 159 from font unihei52

If I try pdflatex I get

!pdfTeX error: pdflatex (file simsun.ttc): cannot open TrueType font file for reading
 ==> Fatal error occurred, no output PDF file produced!

Is it a problem with my TeX installation (TeXLive 2011 on MacOSX) ? Or something non-standard in this file? I tried googling for these errors, but most of the results are in Chinese, and I can't see what is the problem...

comment:10 Changed 8 years ago by Kehengsite

I use CTeX distrbution (www.ctex.org) to finish this work,in the compiling process,

several Chinese fonts were needed. so,if you use TeXLive to commpile the .tex file,as

lack of CTeX macro,it won't success.

In fact,I'm trying to find a perfect way to convert this .tex file to rst,but yet

successed. Now,I'm working on it!

Thinks very much for you help anyway!

comment:11 in reply to: ↑ 9 Changed 8 years ago by Kehengsite

Replying to dimpase:

Replying to Kehengsite:

Waiting to be converted to rst

If I try to run latex and then dvips on these files I get

$ dvips A_tour_of_sage_Zh
This is dvips(k) 5.991 Copyright 2011 Radical Eye Software (www.radicaleye.com)
' TeX output 2012.04.01:0058' -> A_tour_of_sage_Zh.ps

kpathsea: Running mktexpk --mfmode ljfour --bdpi 600 --mag 1+437/600 --dpi 1037 unihei52
mktexpk: don't know how to create bitmap font for unihei52.
mktexpk: perhaps unihei52 is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
dvips: Font unihei52 not found; using cmr10

</usr/local/texlive/2011/texmf-dist/fonts/pk/ljfour/public/cm/dpi600/cmr10.pk>
dvips: ! invalid char 159 from font unihei52

If I try pdflatex I get

!pdfTeX error: pdflatex (file simsun.ttc): cannot open TrueType font file for reading
 ==> Fatal error occurred, no output PDF file produced!

Is it a problem with my TeX installation (TeXLive 2011 on MacOSX) ? Or something non-standard in this file? I tried googling for these errors, but most of the results are in Chinese, and I can't see what is the problem...

I use CTeX distrbution (www.ctex.org) to finish this work,in the compiling process,

several Chinese fonts were needed. so,if you use TeXLive to commpile the .tex file,as

lack of CTeX macro,it won't success.

In fact,I'm trying to find a perfect way to convert this .tex file to rst,but yet

successed. Now,I'm working on it!

Thinks very much for you help anyway!

comment:12 Changed 7 years ago by dimpase

  • Cc vbraun added; jpang removed

this is a real UTF challenge :–)

comment:13 follow-up: Changed 7 years ago by vbraun

First question, is this simplified or traditional chinese? ;-)

Changed 7 years ago by dimpase

converted to rST using pandoc

comment:14 in reply to: ↑ 13 Changed 7 years ago by dimpase

Replying to vbraun:

First question, is this simplified or traditional chinese? ;-)

Simplified. I just attached the result of using pandoc on the latex source. It will surely need more reformatting etc.

Now one has to figure out where it should go, and how to run sphinx on it...

comment:15 follow-up: Changed 7 years ago by vbraun

  • Description modified (diff)

The attached patch lets you build the html version with

sage -docbuild zh_CN/a_tour_of_sage html

There are some errors because I'm missing the images (we need them as png, not pdf for the html docs)

comment:16 in reply to: ↑ 15 Changed 7 years ago by dimpase

Replying to vbraun:

The attached patch lets you build the html version with

sage -docbuild zh_CN/a_tour_of_sage html

There are some errors because I'm missing the images (we need them as png, not pdf for the html docs)

I presume one can steal the images from this document in other languages...

comment:17 follow-up: Changed 7 years ago by vbraun

And there is a lot of installation stuff before the "A Tour OF Sage" starts, which is not present in the English version. Shouldn't that be broken out to a separate document?

comment:18 in reply to: ↑ 17 Changed 7 years ago by dimpase

Replying to vbraun:

And there is a lot of installation stuff before the "A Tour OF Sage" starts, which is not present in the English version. Shouldn't that be broken out to a separate document?

Indeed. I was wondering if there is a corresponding part of Sage docs that has this info.

comment:19 Changed 7 years ago by vbraun

I've fixed up the images and the pdf build. The latter pretty much requires xelatex; Apparently you can also use standard pdflatex but then you need the CJK package which is not in TeXlive. So I think its better to use xelatex, and simply disable it if xelatex is not available.

Changed 7 years ago by vbraun

pdf output

comment:20 Changed 7 years ago by vbraun

  • Status changed from needs_info to needs_review

comment:21 Changed 7 years ago by dimpase

PDF doc does not build for me:

sage -docbuild zh_CN/a_tour_of_sage pdf                 
[a_tour_of] loading translations [zh_CN]... done
[a_tour_of] Compiling the master document
[a_tour_of] building [latex]: all documents
[a_tour_of] Merging environment/index files...
[a_tour_of] ... done (0 todos, 1 index, 0 citations, 0 modules)
[a_tour_of] Saved pickle file: citations.pickle
[a_tour_of] processing SageTutorial_zh_CN.tex... index
[a_tour_of] resolving references...
[a_tour_of] writing... done
[a_tour_of] copying images... interact_screenshot.jpg sin_plot.png circles_plot.png plot_3d.jpg eigen_plot.png
[a_tour_of] copying TeX support files... done
[a_tour_of] build succeeded, 1 warning.
env </dev/null pool_size=4000000 save_size=50000 extra_mem_top=2000000 xelatex  'SageTutorial_zh_CN.tex'
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
(Fatal format file error; I'm stymied)
make: *** [SageTutorial_zh_CN.pdf] Error 1
Traceback (most recent call last):
  File "/usr/local/src/sage/sage-5.10.rc1/devel/sage/doc/common/builder.py", line 1454, in <module>
    getattr(get_builder(name), type)()
  File "/usr/local/src/sage/sage-5.10.rc1/devel/sage/doc/common/builder.py", line 208, in pdf
    raise RuntimeError("failed to run $MAKE all-pdf in %s"%tex_dir)
RuntimeError: failed to run $MAKE all-pdf in /usr/local/src/sage/sage-5.10.rc1/devel/sage/doc/output/latex/zh_CN/a_tour_of_sage

Just in Sage shell in sage/doc/output/latex/zh_CN/a_tour_of_sage I get

$ make    
env </dev/null pool_size=4000000 save_size=50000 extra_mem_top=2000000 xelatex  'SageTutorial_zh_CN.tex'
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
(Fatal format file error; I'm stymied)
make: *** [SageTutorial_zh_CN.pdf] Error 1

This seems to indicate that xelatex cannot find the right format file. Indeed, it works on "normal" files. Also note that and in the normal shell I get

$ make
env </dev/null pool_size=4000000 save_size=50000 extra_mem_top=2000000 xelatex  'SageTutorial_zh_CN.tex'
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
entering extended mode
(./SageTutorial_zh_CN.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, farsi, arabic, croatian, bulgarian, ukrainian, russian, czech, slov
ak, danish, dutch, finnish, french, basque, ngerman, german, german-x-2009-06-1
9, ngerman-x-2009-06-19, ibycus, monogreek, greek, ancientgreek, hungarian, san
skrit, italian, latin, latvian, lithuanian, mongolian2a, mongolian, bokmal, nyn
orsk, romanian, irish, coptic, serbian, turkish, welsh, esperanto, uppersorbian
, estonian, indonesian, interlingua, icelandic, kurmanji, slovenian, polish, po
rtuguese, spanish, galician, catalan, swedish, ukenglish, pinyin, loaded.
(./sphinxmanual.cls
Document Class: sphinxmanual 2009/06/02 Document class (Sphinx manual)
(/usr/share/texmf-texlive/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo)))
! Undefined control sequence.
l.5 \DeclareUnicodeCharacter
                            {00A0}{\nobreakspace}
?
! Emergency stop.
l.5 \DeclareUnicodeCharacter
                            {00A0}{\nobreakspace}
No pages of output.
Transcript written on SageTutorial_zh_CN.log.
make: *** [SageTutorial_zh_CN.pdf] Error 1

comment:22 Changed 7 years ago by dimpase

With TexLive 2012, the error is less strange:

sage -docbuild zh_CN/a_tour_of_sage pdf
[a_tour_of] loading translations [zh_CN]... done
[a_tour_of] Compiling the master document
[a_tour_of] building [latex]: all documents
[a_tour_of] updating environment: 0 added, 1 changed, 0 removed
[a_tour_of] reading sources... [100%] index
[a_tour_of] Merging environment/index files...
[a_tour_of] ... done (0 todos, 1 index, 0 citations, 0 modules)
[a_tour_of] Saved pickle file: citations.pickle
[a_tour_of] pickling environment... done
[a_tour_of] checking consistency... done
[a_tour_of] processing SageTutorial_zh_CN.tex... index
[a_tour_of] resolving references...
[a_tour_of] writing... done
[a_tour_of] copying images... interact_screenshot.jpg sin_plot.png circles_plot.png plot_3d.jpg eigen_plot.png
[a_tour_of] copying TeX support files... done
[a_tour_of] build succeeded, 1 warning.
env </dev/null pool_size=4000000 save_size=50000 extra_mem_top=2000000 xelatex  'SageTutorial_zh_CN.tex'
This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012)
 restricted \write18 enabled.
entering extended mode
(./SageTutorial_zh_CN.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian,
kurmanji, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk,
 piedmontese, polish, portuguese, romanian, romansh, russian, sanskrit, serbian
, serbianc, slovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, u
ppersorbian, welsh, loaded.
(./sphinxmanual.cls
Document Class: sphinxmanual 2009/06/02 Document class (Sphinx manual)
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/size10.clo)))
! Undefined control sequence.
l.5 \DeclareUnicodeCharacter
                            {00A0}{\nobreakspace}
?
! Emergency stop.
l.5 \DeclareUnicodeCharacter
                            {00A0}{\nobreakspace}
No pages of output.
Transcript written on SageTutorial_zh_CN.log.
make: *** [SageTutorial_zh_CN.pdf] Error 1
Traceback (most recent call last):
  File "/usr/local/src/sage/sage-5.10.rc1/devel/sage/doc/common/builder.py", line 1454, in <module>
    getattr(get_builder(name), type)()
  File "/usr/local/src/sage/sage-5.10.rc1/devel/sage/doc/common/builder.py", line 208, in pdf
    raise RuntimeError("failed to run $MAKE all-pdf in %s"%tex_dir)
RuntimeError: failed to run $MAKE all-pdf in /usr/local/src/sage/sage-5.10.rc1/devel/sage/doc/output/latex/zh_CN/a_tour_of_sage

comment:23 follow-up: Changed 7 years ago by vbraun

Did you delete the old (cached) latex file? I.e. rm -rf doc/output before running the docbuild. It seems that your latex file contains precisely what I disabled...

comment:24 Changed 7 years ago by vbraun

  • Dependencies set to #14669, #14571

comment:25 in reply to: ↑ 23 Changed 7 years ago by dimpase

Replying to vbraun:

Did you delete the old (cached) latex file? I.e. rm -rf doc/output before running the docbuild. It seems that your latex file contains precisely what I disabled...

I just tried this, makes no difference. By the way, ru/tutorial pdf builds OK.

comment:26 follow-ups: Changed 7 years ago by vbraun

Sorry, I had the wrong latex file cached. Fixed in the updated patch.

comment:27 in reply to: ↑ 26 ; follow-up: Changed 7 years ago by dimpase

Last edited 7 years ago by dimpase (previous) (diff)

comment:28 in reply to: ↑ 27 Changed 7 years ago by dimpase

Last edited 7 years ago by dimpase (previous) (diff)

comment:29 in reply to: ↑ 26 Changed 7 years ago by dimpase

Replying to vbraun:

Sorry, I had the wrong latex file cached. Fixed in the updated patch.

OK, it's all good. I was missing system zh, etc, fonts on Debian.

comment:30 Changed 7 years ago by jdemeyer

  • Description modified (diff)
  • Work issues I don't konw how to convert LaTeX file to Sphinx deleted

Using subprocess.check_output() in the docbuilder is dangerous, it caused #14626. So either you need to be very sure that this cannot happen again or you need to apply a workaround similar to #14626.

comment:31 Changed 7 years ago by vbraun

Fixed.

comment:32 follow-up: Changed 7 years ago by dimpase

  • Status changed from needs_review to needs_info

There are few more or less trivial issues with the text:

1) references to Sage are quite outdated

2) the part corresponding to the "Tour fo Sage" has strange formatting (extra sub-headers)

3) it should be proofread by a native speaker just in case

Fixing 1) ought to be done by (with help of) a native speaker, as it's not really clear what's going on there. I'll ask someone to have a look, but he unfortunately doesn't work with Sage. Should I ask for a rough English translation of the 1st part, so that links/refs can be adjusted?

I've also emailed the original author asking if (s)he can help.

Last edited 7 years ago by dimpase (previous) (diff)

comment:33 follow-up: Changed 7 years ago by vbraun

I don't think its a good idea to translate English->Chinese->English and then edit that as an English speaker ;-)

The installation instructions should be rewritten to not reference a particular version number (as in http://www.sagemath.org/doc/installation/). And separated into a different page, at least. Ideally we'd have a separate translation of the installation instructions, but that is a bigger task.

Also, I don't think its really necessary to spend time on typesetting nitpicks in the pdf version. The html output is the one we should be worrying about.

Changed 7 years ago by dimpase

the rST doc, for review only (it's also in the patch)

Changed 7 years ago by vbraun

Updated patch

comment:34 Changed 7 years ago by vbraun

Updated with better check for XeTeX

comment:35 in reply to: ↑ 33 Changed 7 years ago by dimpase

Replying to vbraun:

I don't think its a good idea to translate English->Chinese->English and then edit that as an English speaker ;-)

The installation instructions should be rewritten to not reference a particular version number (as in http://www.sagemath.org/doc/installation/). And separated into a different page, at least. Ideally we'd have a separate translation of the installation instructions, but that is a bigger task.

Hopefully my student will work on this next month.

comment:36 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:37 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:38 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:39 Changed 6 years ago by chapoton

  • Keywords chinese added

comment:40 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:41 Changed 5 years ago by chapoton

  • Branch set to u/chapoton/12559
  • Commit set to 64c476c55e6120ba94205f6d516981068fdd5d5f
  • Status changed from needs_info to needs_work

The files seem to be pretty outdated, with many references to Sage 4.8 (sic).


New commits:

016759a# Tue Jun 18 16:08:13 2013 -0700
64c476ctrac #12559 correct a failing doctest

comment:42 Changed 5 years ago by git

  • Commit changed from 64c476c55e6120ba94205f6d516981068fdd5d5f to 06b96eaceda59f7c2c992767490715be17d02be4

Branch pushed to git repo; I updated commit sha1. New commits:

06b96eaMerge branch 'u/chapoton/12559' into 6.5.b0

comment:43 Changed 5 years ago by git

  • Commit changed from 06b96eaceda59f7c2c992767490715be17d02be4 to 28936449b499efa4a7ae566502ce561950f02d69

Branch pushed to git repo; I updated commit sha1. New commits:

2893644trac #12559 correct a failing doctest

comment:44 Changed 5 years ago by kcrisman

  • Component changed from documentation to translations

comment:45 Changed 5 years ago by kcrisman

A couple comments.

  • First, do we even care about zh versus zh_CN and friends? In which case we may want to change some of our other doc - but I'm not interested in breaking links for this sake. But thought I'd ask.
  • I agree we should break this out into a (small) separate installation document with updated references. (Google translate is a lot more powerful than it used to be.) Hopefully not too hard to do.
  • I'm not quite as worried about it diverging from the "original" tour because
    • the tour is really not THAT useful
    • our translations always diverge from the "up-to-date"
    • we can think about it as no translation is one-to-one, like the LOTR movies versus the books...

but if it's important to keep them the same, that will probably mean this stagnates and is only available on the website of the guy. Honestly, this tour is better than the "real" one though I understand why that one is the way it is (mimicking some old Wolfram document, right?).

  • I agree that the subheadings are (mostly) superfluous, and will probably remove them.
  • I note that the plot thing in the "tour" is actually completely mysterious in the standard doc. See #17444.

I have a native speaker who has agreed (in principle) to proofread this (and #9577) as well.

comment:46 Changed 5 years ago by kcrisman

I'm having exactly the same pdf build problem Dima had in the now-vanquished comment:27. I do have xelatex and

$ latex -v
pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012)
kpathsea version 6.1.0
Copyright 2012 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.5.10; using libpng 1.5.10
Compiled with zlib 1.2.7; using zlib 1.2.7
Compiled with xpdf version 3.03

I don't know how to update these fonts, browsing tex.SX left me unenlightened.

comment:47 Changed 5 years ago by kcrisman

Incidentally, in the installation bit, I think it's not so horrible if we have old version names in the thing, as long as it's clear those are samples. However, the reference to Cygwin needs to go, since it's not exactly easy even though it's now more or less supported.

Also, I think the bottom bit about versions of the document and the second paragraph at the top about the author's own reasons for doing it, while both okay, are not really useful. I'm not sure how to interpret the CC-BY-SA, since there is no actual attribution in the document of the author!

comment:48 Changed 5 years ago by kcrisman

  • Authors changed from Kehengsite to Liu Xiang (廖祥)
  • Branch changed from u/chapoton/12559 to u/kcrisman/12559
  • Commit changed from 28936449b499efa4a7ae566502ce561950f02d69 to 26ac224469dc545982c06b19e0f9d3827f71aa8f
  • Reviewers set to Volker Braun, Dmitrii Pasechnik, Karl-Dieter Crisman, Frédéric Chapoton

Note the author's gh site seems to be https://github.com/kehengsite


New commits:

26ac224Merge branch 'u/chapoton/12559' of trac.sagemath.org:sage into chinese

comment:49 Changed 5 years ago by git

  • Commit changed from 26ac224469dc545982c06b19e0f9d3827f71aa8f to 3b19812bb21f9328d09efadf06ccdd845f8638e0

Branch pushed to git repo; I updated commit sha1. New commits:

3b19812Reorganize and fix links

comment:50 in reply to: ↑ 32 Changed 5 years ago by kcrisman

I think I got everything but the original things Dima pointed out. So need yet to:

1) references to Sage are quite outdated

In some fashion fix this;

2) the part corresponding to the "Tour fo Sage" has strange formatting (extra sub-headers)

Fix this; and

3) it should be proofread by a native speaker just in case

Do this.

Oh, and also probably change the project name since the "tutorial" is #9577!

Last edited 5 years ago by kcrisman (previous) (diff)

comment:51 Changed 5 years ago by kcrisman

I have pdf success! The real problem is that TeXlive 2012 assumes some Windows default fonts. Unfortunately, those are different from both the Linux defaults and the Mac defaults, which are themselves not the same!

  • src/doc/zh_CN/a_tour_of_sage/conf.py

    a b latex_elements['utf8extra'] = '' 
    4141
    4242latex_elements['preamble'] = """
    4343\usepackage[noindent,UTF8]{ctexcap}
    44 \setCJKmainfont{AR PL UMing CN}
    45 \setCJKsansfont{WenQuanYi Zen Hei}
    46 \setCJKmonofont{WenQuanYi Zen Hei Mono}
     44\setCJKmainfont[BoldFont=STHeiti,ItalicFont=STKaiti]{STSong}
     45\setCJKsansfont[BoldFont=STHeiti]{STXihei}
     46\setCJKmonofont{STFangsong}
     47%\setCJKmainfont{AR PL UMing CN}
     48%\setCJKsansfont{WenQuanYi Zen Hei}
     49%\setCJKmonofont{WenQuanYi Zen Hei Mono}
    4750\usepackage{amsmath}
    4851\usepackage{amssymb}
    4952"""

I couldn't find a good font that both support without extra work. Unfortunately, that means that Volker's workaround for auto-detecting xelatex isn't good enough, because even with this not all of them will work the same. What do you guys think?

Edit: I may have a solution using the fallback option that at least some cjk packages have. Editit: or maybe not, that appears to be a fallback for characters not in the font, not for a missing font... I'll try it, anyway.

Last edited 5 years ago by kcrisman (previous) (diff)

comment:52 Changed 5 years ago by kcrisman

See the answer to this tex.SX question for what would be a solution if one had recent enough TeX Live, perhaps.

comment:53 Changed 5 years ago by kcrisman

Okay, update: Linux Chinese fonts are a mess and not standardized, Mac seems to share nearly zero pre-installed ones with them anyway, and the only portable solution is to require everyone to upgrade to TeX Live 2014! (Or so it seems.)

comment:54 Changed 5 years ago by kcrisman

  • Dependencies #14669, #14571 deleted

comment:55 Changed 5 years ago by kcrisman

Volker, do you think we could modify enable_if_necessary in src/doc/common/CJKsupport.py in such a way to check for TeX Live 2014 and just require that for building pdf here (and/or whatever fonts are eventually hard-coded in)?

Last edited 5 years ago by kcrisman (previous) (diff)

comment:56 Changed 5 years ago by kcrisman

This is very much a hack, but should guarantee at least a one-stop shop for certain Mac and Linux - although I note sage.math does not have this TeX Live version. Does the build machine have it?

  • src/doc/common/CJKsupport.py

    diff --git a/src/doc/common/CJKsupport.py b/src/doc/common/CJKsupport.py
    index 4635793..209f409 100644
    a b def enable_if_necessary(lang, latex_directory): 
    1919        print "which you do not have installed"
    2020        disable(latex_directory, lang)
    2121        return False
     22    if not have_texlive_2014():
     23        print "Disabling pdf documentation for {0} because it requires TeX Live 2014+".for
     24        print "by default, which you do not have installed"
     25        disable(latex_directory, lang)
     26        return False
    2227    fixup_makefile(os.path.join(latex_directory, 'Makefile'), lang)
    2328    return True
    2429
    2530
    2631HAVE_XELATEX = None
     32HAVE_TEXLIVE_2014 = None
    2733
    2834def have_xelatex():
    2935    """
    def have_xelatex(): 
    4349            HAVE_XELATEX = False
    4450    return HAVE_XELATEX
    4551
     52def have_texlive_2014():
     53    """
     54    Return whether TeX Live 2014+ is installed, so that you
     55    have the Fandol fonts
     56
     57    EXAMPLES::
     58
     59        sage: import os, sys; sys.path.append(os.environ['SAGE_DOC']+'/common/'); import C
     60        sage: CJKsupport.have_texlive_2014() in [True, False]
     61        True
     62    """
     63    global HAVE_TEXLIVE_2014
     64    if HAVE_TEXLIVE_2014 is None:
     65        try:
     66            S = check_output(["kpsewhich", "--var-value", "TEXMFDIST"])
     67            fontdir = os.path.join(S.split()[0],'fonts/opentype/public')
     68            HAVE_TEXLIVE_2014 = 'fandol' in check_output(['ls', fontdir])
     69         except OSError:
     70            HAVE_TEXLIVE_2014 = False
     71
    4672
    4773def fixup_makefile(makefile, lang):
    4874    """
    DISABLED_LATEX_FILE = r""" 
    6389\begin{document}
    6490
    6591Running LaTeX for documents containing CJK fonts requires XeTeX, which
    66 you do not have installed. Consult your latex installation manual to
     92you may not have installed. Consult your latex installation manual to
    6793find out how you can add it.
    6894\begin{itemize}
    6995\item
    find out how you can add it. 
    7197  \texttt{tlmgr install common-xetex}
    7298\end{itemize}
    7399
     100If you have XeTeX but are using TeXlive before 2014, or another package,
     101you will need to modify src/doc/common/CJKsupport.py by having the function
     102have_texlive_2014 return True, and replace the default fonts in the conf.py
     103for the file you are compiling to fonts available on your system or
     104latex installation.
     105
    74106\end{document}
    75107"""

comment:57 Changed 5 years ago by chapoton

  • Milestone changed from sage-6.4 to sage-6.8

comment:58 Changed 4 years ago by chapoton

  • Description modified (diff)
  • Milestone changed from sage-6.8 to sage-6.10

comment:59 Changed 4 years ago by chapoton

  • Branch changed from u/kcrisman/12559 to u/chapoton/12559
  • Commit changed from 3b19812bb21f9328d09efadf06ccdd845f8638e0 to 8b5743f032587b3bb8f0958435b8d8bbd82d6dfb

I tried to use the same trick as for japanese..


New commits:

8b5743fMerge branch 'u/kcrisman/12559' into 6.10.beta3

comment:60 Changed 4 years ago by kcrisman

+        For the special case of the ja docs, run 'all-pdf-ja(ex,to run
+        platex)' there.

Should this also read the zh docs?

If you found a trick that works on Mac and at least some Linux with pdf, that would be very good indeed! Make sure it works on both.

comment:61 Changed 4 years ago by chapoton

  • Milestone changed from sage-6.10 to sage-7.0

comment:62 Changed 4 years ago by git

  • Commit changed from 8b5743f032587b3bb8f0958435b8d8bbd82d6dfb to 2562fbd5a86e11afe84497ccbc530a2ece4d6331

Branch pushed to git repo; I updated commit sha1. New commits:

2562fbdMerge branch 'u/chapoton/12559' into 7.1

comment:63 Changed 4 years ago by git

  • Commit changed from 2562fbd5a86e11afe84497ccbc530a2ece4d6331 to 396cce186aa2c6e044bde8e78292b7a5962d01f4

Branch pushed to git repo; I updated commit sha1. New commits:

396cce1trac #12559 remove stupid tentative

comment:64 Changed 3 years ago by chapoton

  • Milestone changed from sage-7.0 to sage-8.0
Note: See TracTickets for help on using tickets.