Update conf.py

Add the support for compiling Latex with Chinese.
This commit is contained in:
Weihua Tong 2017-04-07 12:32:53 +08:00 committed by GitHub
parent 08b3e4f7a3
commit a4160d9a59

32
conf.py
View File

@ -31,6 +31,38 @@ htmlhelp_basename = 'google-styleguide'
html_add_permalinks = None
file_insertion_enabled = False
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
'preamble': r'''
\hypersetup{unicode=true}
\usepackage{CJKutf8}
\DeclareUnicodeCharacter{00A0}{\nobreakspace}
\DeclareUnicodeCharacter{2203}{\ensuremath{\exists}}
\DeclareUnicodeCharacter{2200}{\ensuremath{\forall}}
\DeclareUnicodeCharacter{2286}{\ensuremath{\subseteq}}
\DeclareUnicodeCharacter{2713}{x}
\DeclareUnicodeCharacter{27FA}{\ensuremath{\Longleftrightarrow}}
\DeclareUnicodeCharacter{221A}{\ensuremath{\sqrt{}}}
\DeclareUnicodeCharacter{221B}{\ensuremath{\sqrt[3]{}}}
\DeclareUnicodeCharacter{2295}{\ensuremath{\oplus}}
\DeclareUnicodeCharacter{2297}{\ensuremath{\otimes}}
\begin{CJK}{UTF8}{gbsn}
\AtEndDocument{\end{CJK}} ''',
}
else:
latex_elements = {
'papersize' : 'a4paper',
'utf8extra' : '',
'inputenc' : '',
'babel' : r'''\usepackage[english]{babel}''',
'preamble' : r''' \usepackage{ctex} ''',
}
latex_documents = [
('index', 'google-styleguide.tex', u'Google 开源项目风格指南',
u'', 'manual'),