zoukankan      html  css  js  c++  java
  • 在博客中使用MathJax写数学公式

    前言

    总结一些在博客园使用MathJax写数学公式的经验。

    博客园

    设置使用数学公式

    • 进入你的博客:管理 > 选项

    里面有个启用数学公式支持,选上后保存。
    这时,你就可以在你的博客里写数学公式了。

    美化数学公式

    本文中数学公式的显示风格和默认的不同。
    数学公式的背景色为浅灰;
    行间数学公式有个灰色框;
    行间数学公式设定为居左;
    行间数学公式带编号。

    下面是对应的配置。

    • 进入你的博客管理 > 配置
      页首脚tml代码中输入一下内容:
    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [['$','$'], ['\(','\)']],
      processEscapes: true
      },
    displayAlign : "left",
    TeX: {
                equationNumbers: {
                    autoNumber: "all",
                    useLabelIds: true
                }
            },
            "HTML-CSS": {
                linebreaks: {
                    automatic: true
                },
                scale: 100,
                styles: {
                  ".MathJax_Display": {
                    "text-align": "left",
                    "width" : "auto",
                    "margin": "10px 0px 10px 0px !important",
                    "background-color": "#f5f5f5 !important",
                    "border-radius": "3px !important",
                    border:  "1px solid #ccc !important",
                    padding: "5px 5px 5px 5px !important"
                  },
                  ".MathJax": {
                    "background-color": "#f5f5f5 !important",
                    padding: "2px 2px 2px 2px !important"
                  }
                }
            },
            SVG: {
                linebreaks: {
                    automatic: true
                }
            }
    });
    </script>
    <!--
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
    </script>
    -->

    注意:如果你发现保存后,输入的内容丢失了。这是因为默认情况下不能在页脚Html代码使用JS.
    配置页面上有个申请使用JS的按钮(具体的按钮标签记不清了),
    点击这个按钮,输入申请理由,比如:“需要使用MathJax写数学公式”, 然后等管理员批准之后,就可以输入了。

    LaTex 语法

    • 行内
      一个行内$f(x)$函数.
      一个行内f(x)f(x)函数
    • 行间
      一个行间
    $$f(x)$$

    函数
    一个行间

    f(x)(1)(1)f(x)


    函数

    • 一些例子
    LaTex SyntaxSampleDescription
    a qquad b abab double quad space
    a quad b abab quad space
    a b$ xixi subscript
    ext{subject to} subject tosubject to text
    e^{ipi} eiπeiπ upperscript
    x_i^2 x2ixi2 subscript and upperscript
    sqrt{2} 2–√2 square root
    frac{1}{2} 1212 fraction
    extstyle sum_{i=1}^n w_ix_i ni=1wixi∑i=1nwixi sum
    displaystyle sum_{i=1}^n w_ix_i i=1nwixi∑i=1nwixi sum
    ecause because
    herefore therefore
    = == equal to
    > >> great than
    < << great than
    geqslant great than and equal to
    leqslant less than and equal to
    geq great than and equal to
    leq less than and equal to
    eq not equal to
    lVert w Vert w‖w‖ vertical
    langle x, y angle x,y⟨x,y⟩ angle
    underset{a}{max} maxamaxa under set
    ar{gamma} γ¯γ¯ bar
    • multiple lines
    b = 
    begin{cases}
        b_1, & text{if} b_1 > 0  \
        b_2, & text{if} b_2 > 0  \
        frac{b_1 + b_2}{2} & text{otherwise}
    end{cases}
    b=⎧⎩⎨⎪⎪b1,b2,b1+b22if b1>0if b2>0otherwise(2)(2)b={b1,if b1>0b2,if b2>0b1+b22otherwise

    LaTex资源

    原文:https://www.cnblogs.com/steven-yang/p/5668125.html

  • 相关阅读:
    ubuntu命令
    mac获取root权限
    centos7安装解压缩工具 ncompress
    ubuntu17.04 配置go环境变量
    vue.js 拦截器
    ubuntu 安装jdk
    ubuntu安装deb文件
    初识 阿里云 SSL 证书申请
    java之XML
    LanProxy 内网映射穿透
  • 原文地址:https://www.cnblogs.com/Ph-one/p/11064570.html
Copyright © 2011-2022 走看看