Skip to content

Commit

Permalink
[Docs] Fix some bugs in readthedocs pdf build. (#383)
Browse files Browse the repository at this point in the history
* Add escape symbols for underscores in formulas.

* Support Chinese characters in pdf output.
  • Loading branch information
mzr1996 authored Jul 31, 2021
1 parent 469d88c commit e8822eb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
20 changes: 20 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,26 @@ def get_version():

master_doc = 'index'

latex_elements = {
# Additional stuff for the LaTeX preamble.
#'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}}
''',
}

def builder_inited_handler(app):
subprocess.run(['./stat.py'])
Expand Down
4 changes: 2 additions & 2 deletions mmcls/datasets/pipelines/auto_augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class RandAugment(object):
When magnitude_std=0, we calculate the magnitude as follows:
.. math::
\text{magnitude} = \frac{\text{magnitude_level}}
{\text{total_level}} \times (\text{val2} - \text{val1})
\text{magnitude} = \frac{\text{magnitude\_level}}
{\text{total\_level}} \times (\text{val2} - \text{val1})
+ \text{val1}
"""

Expand Down
4 changes: 2 additions & 2 deletions mmcls/datasets/pipelines/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,8 @@ class CenterCrop(object):
to perform the center crop with the ``crop_size_`` as:
.. math::
\text{crop_size_} = \frac{\text{crop_size}}{\text{crop_size} +
\text{crop_padding}} \times \text{short_edge}
\text{crop\_size\_} = \frac{\text{crop\_size}}{\text{crop\_size} +
\text{crop\_padding}} \times \text{short\_edge}
And then the pipeline resizes the img to the input crop size.
"""
Expand Down

0 comments on commit e8822eb

Please sign in to comment.