akrabat / avalanche

A theme for landslide
68 stars 22 forks source link

Cannot render LaTeX #24

Open A205B064 opened 5 years ago

A205B064 commented 5 years ago

The default avalanche theme is impressingly clean and beautiful, but it seems don't render LaTeX codes despite the -m option is set to be True. I know nearly nothing about CSS, so I really don't know what's gonging wrong in the background. How can I fix this?

A205B064 commented 5 years ago

I took some HTML and CSS crash course and "solved" the problem by manually adding the following MathJax loading script in the head of the rendered HTML file:

<!-- Loading mathjax macro -->
<!-- Load mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_HTML"></script>
<!-- MathJax configuration -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: true,
        processEnvironments: true
    },
    // Center justify equations in code and markdown cells. Elsewhere
    // we use CSS to left justify single line equations in code cells.
    displayAlign: 'center',
    "HTML-CSS": {
        styles: {'.MathJax_Display': {"margin": 0}},
        linebreaks: { automatic: true }
    }
});
</script>
<!-- End of mathjax configuration -->

and adding the following to the default screen.css to fixed undesired grey font caused by pygments :

.MathJax .mi, .MathJax .mo
 {
     color: black !important;
 }

I know this surely not the correct way to achieve my goal, but it does work. I hope someone can come up with an efficient way to enable TeX rendering.