#12559: Chinese translation of "A tour of Sage"
-------------------------+-------------------------------------------------
       Reporter:  mvngu  |        Owner:  Kehengsite
           Type:         |       Status:  needs_work
  enhancement            |    Milestone:  sage-6.4
       Priority:  major  |   Resolution:
      Component:         |    Merged in:
  translations           |    Reviewers:  Volker Braun, Dmitrii Pasechnik,
       Keywords:         |  Karl-Dieter Crisman, Frédéric Chapoton
  chinese                |  Work issues:
        Authors:  Liu    |       Commit:
  Xiang (廖祥)           |  3b19812bb21f9328d09efadf06ccdd845f8638e0
Report Upstream:  N/A    |     Stopgaps:
         Branch:         |
  u/kcrisman/12559       |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (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?
 {{{#!diff
 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}
  """
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/12559#comment:56>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to