Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chinese translation of "A tour of Sage" #12559

Open
sagetrac-mvngu mannequin opened this issue Feb 22, 2012 · 78 comments · May be fixed by #37265
Open

Chinese translation of "A tour of Sage" #12559

sagetrac-mvngu mannequin opened this issue Feb 22, 2012 · 78 comments · May be fixed by #37265

Comments

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Feb 22, 2012

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@163.com). In addition, thanks Nguyen to create a trac account for me!

CC: lq52655963@163.com @vbraun

Component: translations

Keywords: chinese

Author: Liu Xiang (廖祥)

Branch/Commit: u/chapoton/12559 @ 396cce1

Reviewer: Volker Braun, Dmitrii Pasechnik, Karl-Dieter Crisman, Frédéric Chapoton

Issue created by migration from https://trac.sagemath.org/ticket/12559

@sagetrac-mvngu sagetrac-mvngu mannequin added this to the sage-5.11 milestone Feb 22, 2012
@sagetrac-mvngu sagetrac-mvngu mannequin self-assigned this Feb 22, 2012
@sagetrac-mvngu
Copy link
Mannequin Author

sagetrac-mvngu mannequin commented Feb 22, 2012

Attachment: A_tour_of_sage_Zh.tar.bz2.gz

@ppurka
Copy link
Member

ppurka commented Feb 22, 2012

comment:1

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

@ppurka
Copy link
Member

ppurka commented Feb 23, 2012

Attachment: A_tour_of_sage_Zh.pdf.gz

@ppurka
Copy link
Member

ppurka commented Feb 23, 2012

comment:2

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

@sagetrac-Kehengsite

This comment has been minimized.

@sagetrac-Kehengsite
Copy link
Mannequin

sagetrac-Kehengsite mannequin commented Feb 26, 2012

comment:4

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.

@sagetrac-Kehengsite
Copy link
Mannequin

sagetrac-Kehengsite mannequin commented Feb 26, 2012

Author: Kehengsite

@sagetrac-Kehengsite
Copy link
Mannequin

sagetrac-Kehengsite mannequin commented Feb 26, 2012

Work Issues: I don't konw how to convert LaTeX file to Sphinx

@sagetrac-Kehengsite

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented Feb 26, 2012

comment:7

Replying to @sagetrac-Kehengsite:

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

@sagetrac-Kehengsite
Copy link
Mannequin

sagetrac-Kehengsite mannequin commented Mar 31, 2012

Attachment: A_tour_of_sage_Zh.rar.gz

Finished intsallation guide

@sagetrac-Kehengsite
Copy link
Mannequin

sagetrac-Kehengsite mannequin commented Mar 31, 2012

comment:8

Waiting to be converted to rst

@dimpase
Copy link
Member

dimpase commented Mar 31, 2012

comment:9

Replying to @sagetrac-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...

@sagetrac-Kehengsite
Copy link
Mannequin

sagetrac-Kehengsite mannequin commented Apr 1, 2012

comment:10

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!

@sagetrac-Kehengsite
Copy link
Mannequin

sagetrac-Kehengsite mannequin commented Apr 1, 2012

comment:11

Replying to @dimpase:

Replying to @sagetrac-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!

@dimpase
Copy link
Member

dimpase commented Jun 5, 2013

comment:12

this is a real UTF challenge :–)

@vbraun
Copy link
Member

vbraun commented Jun 5, 2013

comment:13

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

@dimpase
Copy link
Member

dimpase commented Jun 6, 2013

Attachment: A_tour_of_sage_Zh.rst.gz

converted to rST using pandoc

@dimpase
Copy link
Member

dimpase commented Jun 6, 2013

comment:14

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...

@vbraun

This comment has been minimized.

@vbraun
Copy link
Member

vbraun commented Jun 6, 2013

comment:15

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)

@dimpase
Copy link
Member

dimpase commented Jun 6, 2013

comment:16

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...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 4, 2014

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

3b19812Reorganize and fix links

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 4, 2014

Changed commit from 26ac224 to 3b19812

@kcrisman
Copy link
Member

kcrisman commented Dec 4, 2014

comment:50

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;

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

Fix this; and

  1. 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!

@kcrisman
Copy link
Member

kcrisman commented Dec 5, 2014

comment:51

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!

--- a/src/doc/zh_CN/a_tour_of_sage/conf.py
+++ b/src/doc/zh_CN/a_tour_of_sage/conf.py
@@ -41,9 +41,12 @@ latex_elements['utf8extra'] = ''
 
 latex_elements['preamble'] = """
 \usepackage[noindent,UTF8]{ctexcap}
-\setCJKmainfont{AR PL UMing CN}
-\setCJKsansfont{WenQuanYi Zen Hei}
-\setCJKmonofont{WenQuanYi Zen Hei Mono}
+\setCJKmainfont[BoldFont=STHeiti,ItalicFont=STKaiti]{STSong}
+\setCJKsansfont[BoldFont=STHeiti]{STXihei}
+\setCJKmonofont{STFangsong}
+%\setCJKmainfont{AR PL UMing CN}
+%\setCJKsansfont{WenQuanYi Zen Hei}
+%\setCJKmonofont{WenQuanYi Zen Hei Mono}
 \usepackage{amsmath}
 \usepackage{amssymb}
 """

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.

@kcrisman
Copy link
Member

kcrisman commented Dec 5, 2014

comment:52

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

@kcrisman
Copy link
Member

kcrisman commented Dec 5, 2014

comment:53

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.)

@kcrisman
Copy link
Member

kcrisman commented Dec 5, 2014

Changed dependencies from #14669, #14571 to none

@kcrisman
Copy link
Member

kcrisman commented Dec 5, 2014

comment:55

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)?

@kcrisman
Copy link
Member

kcrisman commented Dec 6, 2014

comment:56

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?

diff --git a/src/doc/common/CJKsupport.py b/src/doc/common/CJKsupport.py
index 4635793..209f409 100644
--- a/src/doc/common/CJKsupport.py
+++ b/src/doc/common/CJKsupport.py
@@ -19,11 +19,17 @@ def enable_if_necessary(lang, latex_directory):
         print "which you do not have installed"
         disable(latex_directory, lang)
         return False
+    if not have_texlive_2014():
+        print "Disabling pdf documentation for {0} because it requires TeX Live 2014+".for
+        print "by default, which you do not have installed"
+        disable(latex_directory, lang)
+        return False
     fixup_makefile(os.path.join(latex_directory, 'Makefile'), lang)
     return True
 
 
 HAVE_XELATEX = None
+HAVE_TEXLIVE_2014 = None
 
 def have_xelatex():
     """
@@ -43,6 +49,26 @@ def have_xelatex():
             HAVE_XELATEX = False
     return HAVE_XELATEX
 
+def have_texlive_2014():
+    """
+    Return whether TeX Live 2014+ is installed, so that you
+    have the Fandol fonts
+
+    EXAMPLES::
+
+        sage: import os, sys; sys.path.append(os.environ['SAGE_DOC']+'/common/'); import C
+        sage: CJKsupport.have_texlive_2014() in [True, False]
+        True
+    """
+    global HAVE_TEXLIVE_2014
+    if HAVE_TEXLIVE_2014 is None:
+        try:
+            S = check_output(["kpsewhich", "--var-value", "TEXMFDIST"])
+            fontdir = os.path.join(S.split()[0],'fonts/opentype/public')
+            HAVE_TEXLIVE_2014 = 'fandol' in check_output(['ls', fontdir])
+         except OSError:
+            HAVE_TEXLIVE_2014 = False
+
 
 def fixup_makefile(makefile, lang):
     """
@@ -63,7 +89,7 @@ DISABLED_LATEX_FILE = r"""
 \begin{document}
 
 Running LaTeX for documents containing CJK fonts requires XeTeX, which
-you do not have installed. Consult your latex installation manual to
+you may not have installed. Consult your latex installation manual to
 find out how you can add it.
 \begin{itemize}
 \item 
@@ -71,6 +97,12 @@ find out how you can add it.
   \texttt{tlmgr install common-xetex}
 \end{itemize}
 
+If you have XeTeX but are using TeXlive before 2014, or another package,
+you will need to modify src/doc/common/CJKsupport.py by having the function
+have_texlive_2014 return True, and replace the default fonts in the conf.py
+for the file you are compiling to fonts available on your system or
+latex installation.
+
 \end{document}
 """

@fchapoton fchapoton modified the milestones: sage-6.4, sage-6.8 Jul 17, 2015
@fchapoton

This comment has been minimized.

@fchapoton fchapoton modified the milestones: sage-6.8, sage-6.10 Oct 28, 2015
@fchapoton
Copy link
Contributor

comment:59

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


New commits:

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

@fchapoton
Copy link
Contributor

Changed branch from u/kcrisman/12559 to u/chapoton/12559

@fchapoton
Copy link
Contributor

Changed commit from 3b19812 to 8b5743f

@kcrisman
Copy link
Member

kcrisman commented Nov 9, 2015

comment:60
+        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.

@fchapoton fchapoton modified the milestones: sage-6.10, sage-7.0 Dec 30, 2015
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 22, 2016

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

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 22, 2016

Changed commit from 8b5743f to 2562fbd

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 25, 2016

Changed commit from 2562fbd to 396cce1

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 25, 2016

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

396cce1trac #12559 remove stupid tentative

@fchapoton fchapoton modified the milestones: sage-7.0, sage-8.0 Jun 8, 2017
@mkoeppe mkoeppe removed this from the sage-8.0 milestone Dec 29, 2022
mkoeppe pushed a commit to mkoeppe/sage that referenced this issue Feb 9, 2024
mkoeppe pushed a commit to mkoeppe/sage that referenced this issue Feb 9, 2024
@mkoeppe mkoeppe linked a pull request Feb 9, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants