1

几个月来我一直在使用 Anki 和 MathJax,但是在桌面上字体大小非常小(不过在 AnkiDroid 上很好)。我每次使用 MathJax 时都使用 \huge 来解决它,但这显然不是最好的解决方案。它还使移动设备上的所有内容都变得太大。

我的 MathJax 配置如本文所述。我已经搜索了如何编辑 MathJax 的缩放比例和字体大小,但没有任何效果(例如),它大多只是破坏了它。

MathJax.Hub.processSectionDelay = 0;
MathJax.Hub.Config({
extensions: ["tex2jax.js"],    
    showProcessingMessages:false,
    tex2jax:{
        inlineMath: [['$','$']],
        displayMath:[['$$','$$']],
        processEscapes:true
    }
});

另外,我的卡的设置:

.card {
font-family: arial;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}

.cloze {
font-weight: bold;
color: blue;
}

默认大小(太小)和 \huge(更合理):

默认大小和 \huge

我知道这应该很容易。如果可能的话,也许会大大降低 MathJax 的缩放比例。

编辑:Alistair Martin 基本上解决了它(桌面和 AnkiDroid 都很好)。它是这样工作的:

<script type="text/x-mathjax-config">
MathJax.Hub.processSectionDelay = 0;
MathJax.Hub.Config({
  messageStyle: 'none',
  showProcessingMessages: false,
  tex2jax: {
    inlineMath: [['$', '$']],
    displayMath: [['$$', '$$']],
    processEscapes: true
  },
  SVG: {
    scale: (!!navigator.userAgent.match(/(mac)|(mobile)/i) ? 100 : 180)
  }
});
</script>

<script type="text/javascript">
(function() {
  if (window.MathJax != null) {
    var card = document.querySelector('.card');
    MathJax.Hub.Queue(['Typeset', MathJax.Hub, card]);
    return;
  }
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG';
  document.body.appendChild(script);
})();
    </script>
4

1 回答 1

1

到目前为止,这对我有用:

  1. 更改为 SVG。这意味着将 url 参数更改为?config=TeX-MML-AM_SVG,如您链接的文章中所述。
  2. 更改卡片开头的 JS 脚本以包含 SVG 比例,其值基于设备

像这样的东西:

<script type="text/x-mathjax-config">
MathJax.Hub.processSectionDelay = 0;
MathJax.Hub.Config({
  messageStyle: 'none',
  showProcessingMessages: false,
  tex2jax: {
    inlineMath: [['$', '$']],
    displayMath: [['$$', '$$']],
    processEscapes: true
  },
  SVG: {
    scale: (!!navigator.userAgent.match(/(mac)|(mobile)/i) ? 100 : 180)
  }
});
</script>

^ 这里 100 是 Ankidroid 和 macOS 的百分比,180 是 Windows 的百分比。

于 2018-07-10T05:34:06.407 回答