Skip to content

Commit

Permalink
Fix rendering of custom latex commands in html spec (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgouicem authored Nov 10, 2022
1 parent 30bb2cc commit 19d4dd1
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions source/conf/common_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,88 @@
\newcommand{\diffgamma}{\operatorname{diff\_\gamma}}
\newcommand{\diffbeta}{\operatorname{diff\_\beta}}
\newcommand{\workspace}{\operatorname{workspace}}
\newcommand{\srcshape}{\operatorname{src\_shape}}
''',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
'extraclassoptions': 'openany,oneside',
}

imgmath_latex_preamble = r'''
\newcommand{\src}{\operatorname{src}}
\newcommand{\srclayer}{\operatorname{src\_layer}}
\newcommand{\srciter}{\operatorname{src\_iter}}
\newcommand{\srciterc}{\operatorname{src\_iter\_c}}
\newcommand{\weights}{\operatorname{weights}}
\newcommand{\weightslayer}{\operatorname{weights\_layer}}
\newcommand{\weightsiter}{\operatorname{weights\_iter}}
\newcommand{\weightspeephole}{\operatorname{weights\_peephole}}
\newcommand{\weightsprojection}{\operatorname{weights\_projection}}
\newcommand{\bias}{\operatorname{bias}}
\newcommand{\dst}{\operatorname{dst}}
\newcommand{\dstlayer}{\operatorname{dst\_layer}}
\newcommand{\dstiter}{\operatorname{dst\_iter}}
\newcommand{\dstiterc}{\operatorname{dst\_iter\_c}}
\newcommand{\diffsrc}{\operatorname{diff\_src}}
\newcommand{\diffsrclayer}{\operatorname{diff\_src\_layer}}
\newcommand{\diffsrciter}{\operatorname{diff\_src\_iter}}
\newcommand{\diffsrciterc}{\operatorname{diff\_src\_iter\_c}}
\newcommand{\diffweights}{\operatorname{diff\_weights}}
\newcommand{\diffweightslayer}{\operatorname{diff\_weights\_layer}}
\newcommand{\diffweightsiter}{\operatorname{diff\_weights\_iter}}
\newcommand{\diffweightspeephole}{\operatorname{diff\_weights\_peephole}}
\newcommand{\diffweightsprojection}{\operatorname{diff\_weights\_projection}}
\newcommand{\diffbias}{\operatorname{diff\_bias}}
\newcommand{\diffdst}{\operatorname{diff\_dst}}
\newcommand{\diffdstlayer}{\operatorname{diff\_dst\_layer}}
\newcommand{\diffdstiter}{\operatorname{diff\_dst\_iter}}
\newcommand{\diffdstiterc}{\operatorname{diff\_dst\_iter\_c}}
\newcommand{\diffgamma}{\operatorname{diff\_\gamma}}
\newcommand{\diffbeta}{\operatorname{diff\_\beta}}
\newcommand{\workspace}{\operatorname{workspace}}
\newcommand{\srcshape}{\operatorname{src\_shape}}
'''

mathjax3_config = {
'tex': {
'macros': {
'src': '\\operatorname{src}',
'srclayer': '\\operatorname{src\\_layer}',
'srciter': '\\operatorname{src\\_iter}',
'srciterc': '\\operatorname{src\\_iter\\_c}',
'weights': '\\operatorname{weights}',
'weightslayer': '\\operatorname{weights\\_layer}',
'weightsiter': '\\operatorname{weights\\_iter}',
'weightspeephole': '\\operatorname{weights\\_peephole}',
'weightsprojection': '\\operatorname{weights\\_projection}',
'bias': '\\operatorname{bias}',
'dst': '\\operatorname{dst}',
'dstlayer': '\\operatorname{dst\\_layer}',
'dstiter': '\\operatorname{dst\\_iter}',
'dstiterc': '\\operatorname{dst\\_iter\\_c}',
'diffsrc': '\\operatorname{diff\\_src}',
'diffsrclayer': '\\operatorname{diff\\_src\\_layer}',
'diffsrciter': '\\operatorname{diff\\_src\\_iter}',
'diffsrciterc': '\\operatorname{diff\\_src\\_iter\\_c}',
'diffweights': '\\operatorname{diff\\_weights}',
'diffweightslayer': '\\operatorname{diff\\_weights\\_layer}',
'diffweightsiter': '\\operatorname{diff\\_weights\\_iter}',
'diffweightspeephole': '\\operatorname{diff\\_weights\\_peephole}',
'diffweightsprojection': '\\operatorname{diff\\_weights\\_projection}', # noqa: E501
'diffbias': '\\operatorname{diff\\_bias}',
'diffdst': '\\operatorname{diff\\_dst}',
'diffdstlayer': '\\operatorname{diff\\_dst\\_layer}',
'diffdstiter': '\\operatorname{diff\\_dst\\_iter}',
'diffdstiterc': '\\operatorname{diff\\_dst\\_iter\\_c}',
'diffgamma': '\\operatorname{diff\\_\\gamma}',
'diffbeta': '\\operatorname{diff\\_\\beta}',
'workspace': '\\operatorname{workspace}',
'srcshape': '\\operatorname{src\\_shape}',
}
}
}


def supsub_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
node = docutils.nodes.superscript()
Expand Down

0 comments on commit 19d4dd1

Please sign in to comment.