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
Comments
Attachment: A_tour_of_sage_Zh.tar.bz2.gz |
comment:1
I have asked one of my Chinese colleagues to take a look at the contents for review. |
Attachment: A_tour_of_sage_Zh.pdf.gz |
comment:2
Attached in the pdf file are some comments by my colleague Chengmin Wang. Many thanks to him. |
This comment has been minimized.
This comment has been minimized.
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. |
Author: Kehengsite |
Work Issues: I don't konw how to convert LaTeX file to Sphinx |
This comment has been minimized.
This comment has been minimized.
comment:7
Replying to @sagetrac-Kehengsite: latex->rst [converter http://johnmacfarlane.net/pandoc/] |
Attachment: A_tour_of_sage_Zh.rar.gz Finished intsallation guide |
comment:8
Waiting to be converted to rst |
comment:9
Replying to @sagetrac-Kehengsite:
If I try to run latex and then dvips on these files I get
If I try pdflatex I get
Is it a problem with my TeX installation (TeXLive 2011 on MacOSX) ? |
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! |
comment:11
Replying to @dimpase:
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
this is a real UTF challenge :–) |
comment:13
First question, is this simplified or traditional chinese? ;-) |
Attachment: A_tour_of_sage_Zh.rst.gz converted to rST using pandoc |
comment:14
Replying to @vbraun:
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... |
This comment has been minimized.
This comment has been minimized.
comment:15
The attached patch lets you build the html version with
There are some errors because I'm missing the images (we need them as png, not pdf for the html docs) |
comment:16
Replying to @vbraun:
I presume one can steal the images from this document in other languages... |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:50
I think I got everything but the original things Dima pointed out. So need yet to:
In some fashion fix this;
Fix this; and
Do this. Oh, and also probably change the project name since the "tutorial" is #9577! |
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 |
comment:52
See the answer to this tex.SX question for what would be a solution if one had recent enough TeX Live, perhaps. |
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.) |
comment:55
Volker, do you think we could modify |
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}
""" |
This comment has been minimized.
This comment has been minimized.
comment:59
I tried to use the same trick as for japanese.. New commits:
|
Changed branch from u/kcrisman/12559 to u/chapoton/12559 |
comment:60
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. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
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
The text was updated successfully, but these errors were encountered: