2020-06-05 00:15:41 +08:00
<!DOCTYPE html>
< html lang = "zh-CN" class = "loading" >
< head >
<!-- hexo - inject:begin --> <!-- hexo - inject:end --> < meta charset = "UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" / >
< meta name = "viewport" content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
< title > 技巧速记: 如何在Hexo中插入多行公式 - Blog< / title >
< meta name = "apple-mobile-web-app-capable" content = "yes" / >
< meta name = "apple-mobile-web-app-status-bar-style" content = "black-translucent" >
< meta name = "google" content = "notranslate" / >
< meta name = "keywords" content = "Developer, Python, C++, JavaScript, Java," >
< meta name = "description" content = "DavidZ's Blog ,
原创发表于 DavidZ Blog, 遵循 CC 4.0 BY-NC-SA 版权协议,转载请附上原文出处链接及本声明。
¶Q
我在博客中写公式的时候使用双斜线\\来代表换行,效果是这样的,
$$
,">
< meta name = "author" content = "DavidZ" >
< link rel = "alternative" href = "atom.xml" title = "Blog" type = "application/atom+xml" >
< link rel = "icon" href = "/img/favicon.png" >
< link href = "https://fonts.loli.net/css?family=Roboto+Mono|Rubik&display=swap" rel = "stylesheet" >
< link rel = "stylesheet" href = "//at.alicdn.com/t/font_1429596_nzgqgvnmkjb.css" >
< link rel = "stylesheet" href = "//cdn.bootcss.com/animate.css/3.7.2/animate.min.css" >
< link rel = "stylesheet" href = "//cdn.bootcss.com/social-share.js/1.0.16/css/share.min.css" >
< link rel = "stylesheet" href = "//cdn.bootcss.com/codemirror/5.48.4/codemirror.min.css" >
< link rel = "stylesheet" href = "//cdn.bootcss.com/codemirror/5.48.4/theme/dracula.css" >
< link rel = "stylesheet" href = "/css/obsidian.css" >
< link rel = "stylesheet" href = "/css/ball-atom.min.css" >
< meta name = "generator" content = "Hexo 4.2.0" > <!-- hexo - inject:begin --> <!-- hexo - inject:end --> < / head >
< body class = "loading" >
<!-- hexo - inject:begin --> <!-- hexo - inject:end --> < div class = "loader" >
< div class = "la-ball-atom la-2x" >
< div > < / div >
< div > < / div >
< div > < / div >
< div > < / div >
< / div >
< / div >
< span id = "config-title" style = "display:none" > Blog< / span >
< div id = "loader" > < / div >
< div id = "single" >
< div class = "scrollbar gradient-bg-rev" > < / div >
< div id = "top" style = "display: block;" >
< div class = "bar" style = "width: 0;" > < / div >
< div class = "navigation animated fadeIn fast delay-1s" >
< img id = "home-icon" class = "icon-home" src = "/img/favicon.png" alt = "" data-url = "https://blog.davidz.cn" >
< div id = "play-icon" title = "Play/Pause" class = "iconfont icon-play" > < / div >
< h3 class = "subtitle" > 技巧速记: 如何在Hexo中插入多行公式< / h3 >
< div class = "social" >
<!-- <div class="like - icon"> -->
<!-- <a href="javascript:;" class="likeThis active"><span class="icon - like"></span><span class="count">76</span></a> -->
<!-- </div> -->
< div >
< div class = "share" >
< a href = "javascript:;" class = "iconfont icon-share1" > < / a >
< div class = "share-component-cc" data-disabled = "facebook,douban,linkedin,diandian,tencent,google" > < / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "section" >
< div class = article-header-wrapper >
< div class = "article-header" >
< div class = "article-cover animated fadeIn" style = "
animation-delay: 600ms;
animation-duration: 1.2s;
background-image:
radial-gradient(ellipse closest-side, rgba(0, 0, 0, 0.65), #100e17),
url(//davidz.cn/static/blog/img/workaround.jpg) ">
< / div >
< div class = "else" >
< p class = "animated fadeInDown" >
< a href = "/categories/Workaround" > < b > 「
< / b > WORKAROUND< b > 」< / b > < / a >
六月 04, 2020
< / p >
< h3 class = "post-title animated fadeInDown" > < a href = "/multiline-equation-in-hexo/" title = "技巧速记: 如何在Hexo中插入多行公式" class = "" > 技巧速记: 如何在Hexo中插入多行公式< / a >
< / h3 >
< p class = "post-count animated fadeInDown" >
< span >
< b class = "iconfont icon-text2" > < / b > < i > 文章字数< / i >
2020-06-05 12:12:10 +08:00
1.2k
2020-06-05 00:15:41 +08:00
< / span >
< span >
< b class = "iconfont icon-timer__s" > < / b > < i > 阅读约需< / i >
1 mins.
< / span >
< span id = "busuanzi_container_page_pv" >
< b class = "iconfont icon-read" > < / b > < i > 阅读次数< / i >
< span id = "busuanzi_value_page_pv" > 0< / span >
< / span >
< / p >
< ul class = "animated fadeInDown post-tags-list" itemprop = "keywords" > < li class = "animated fadeInDown post-tags-list-item" > < a class = "animated fadeInDown post-tags-list-link" href = "/tags/Markdown/" rel = "tag" > Markdown< / a > < / li > < / ul >
< / div >
< / div >
< / div >
< div class = "screen-gradient-after" >
< div class = "screen-gradient-content" >
< div class = "screen-gradient-content-inside" >
< div class = "bold-underline-links screen-gradient-sponsor" >
< p >
< span class = "animated fadeIn delay-1s" > < / span >
< / p >
< / div >
< / div >
< / div >
< / div >
< div class = "article" >
< div class = 'main' >
< div class = "content markdown animated fadeIn" >
< blockquote >
< p > 原创发表于 < a href = "https://blog.davidz.cn" > DavidZ Blog< / a > ,遵循 < a href = "https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" target = "_blank" rel = "noopener" > CC 4.0 BY-NC-SA< / a > 版权协议,转载请附上原文出处链接及本声明。< / p >
< / blockquote >
< h2 id = "Q" > < a class = "header-anchor" href = "#Q" > ¶< / a > Q< / h2 >
< p > 我在博客中写公式的时候使用双斜线< code > \\< / code > 来代表换行,效果是这样的,< / p >
< p > $$< br >
\begin{bmatrix}< br >
cos\theta & sin\theta \< br >
-sin\theta & cos\theta< br >
\end{bmatrix}< br >
$$< / p >
2020-06-05 12:12:10 +08:00
< pre > < code class = "language-latex" > $$
\begin{bmatrix}
cos\theta & sin\theta \\
-sin\theta & cos\theta
\end{bmatrix}
$$
< / code > < / pre >
2020-06-05 00:15:41 +08:00
< p > 那么如何插入多行公式呢?< / p >
< h2 id = "A" > < a class = "header-anchor" href = "#A" > ¶< / a > A< / h2 >
< p > 根据< a href = "https://github.com/gcushen/hugo-academic/issues/291#issuecomment-334746889" target = "_blank" rel = "noopener" > Multiple lines Mathjax formulas flattened to one line< / a > ,应该插入 < em > 六个< / em > 斜线来表示换行, 应该是由于Markdown的渲染机制导致< code > \\< / code > 被反义。< / p >
< p > $$< br >
\begin{bmatrix}< br >
cos\theta & sin\theta \\\< br >
-sin\theta & cos\theta< br >
\end{bmatrix}< br >
$$< / p >
2020-06-05 12:12:10 +08:00
< pre > < code class = "language-latex" > $$
\begin{bmatrix}
cos\theta & sin\theta \\\\\\
-sin\theta & cos\theta
\end{bmatrix}
$$
< / code > < / pre >
2020-06-05 00:15:41 +08:00
<!-- [if lt IE 9]><script>document.createElement('audio');</script><![endif] -->
< audio id = "audio" loop = "1" preload = "auto" controls = "controls"
data-autoplay="false">
< source type = "audio/mpeg" src = "" >
< / audio >
< ul id = "audio-list" style = "display:none" >
< li title = '0' data-url = '/statics/chengdu.mp3' > < / li >
< / ul >
< div id = 'gitalk-container' class = "comment link"
data-ae='true'
data-ci='489076c5dd3f5ba13f67'
data-cs='d6e3b245787b0b74d0dbe2639ef87f452a401194'
data-r='blog.davidz.cn'
data-o='DavidZhang73'
data-a='DavidZhang73'
data-d=''
>留言< / div >
< / div >
< div class = "sidebar" >
< div class = "box animated fadeInRight" >
< div class = "subbox" >
< img src = "//davidz.cn/static/blog/img/avator.jpg" height = 300 width = 300 > < / img >
< p > DavidZ< / p >
< span > 凡事都要留几分< / span >
< dl >
< dd > < a href = "https://github.com/DavidZhang73" target = "_blank" > < span
class=" iconfont icon-github">< / span > < / a > < / dd >
< dd > < a href = "https://twitter.com/david731998" target = "_blank" > < span
class=" iconfont icon-twitter">< / span > < / a > < / dd >
< dd > < a href = "https://stackoverflow.com/users/12693553/davidz" target = "_blank" > < span
class=" iconfont icon-stack-overflow">< / span > < / a > < / dd >
< / dl >
< / div >
< ul >
2020-06-27 12:58:00 +08:00
< li > < a href = "/" > 13 < p > 文章< / p > < / a > < / li >
2020-06-05 00:15:41 +08:00
< li > < a href = "/categories" > 7 < p > 分类< / p > < / a > < / li >
< li > < a href = "/tags" > 12 < p > 标签< / p > < / a > < / li >
< / ul >
< / div >
< div class = "box sticky animated fadeInRight faster" >
< div id = "toc" class = "subbox" >
< h4 > 目录< / h4 >
< ol class = "toc" > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#Q" > < span class = "toc-number" > 1.< / span > < span class = "toc-text" > ¶Q< / span > < / a > < / li > < li class = "toc-item toc-level-2" > < a class = "toc-link" href = "#A" > < span class = "toc-number" > 2.< / span > < span class = "toc-text" > ¶A< / span > < / a > < / li > < / ol >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< div id = "back-to-top" class = "animated fadeIn faster" >
< div class = "flow" > < / div >
< span class = "percentage animated fadeIn faster" > 0%< / span >
< span class = "iconfont icon-top02 animated fadeIn faster" > < / span >
< / div > <!-- hexo - inject:begin --> <!-- hexo - inject:end -->
< / body >
< footer >
< p class = "copyright" id = "copyright" >
© 2020
< span class = "gradient-text" >
DavidZ
< / span > .
Powered by < a href = "http://hexo.io/" title = "Hexo" target = "_blank" rel = "noopener" > Hexo< / a >
Theme
< span class = "gradient-text" >
< a href = "https://github.com/TriDiamond/hexo-theme-obsidian" title = "Obsidian" target = "_blank" rel = "noopener" > Obsidian< / a >
< / span >
< small > < a href = "https://github.com/TriDiamond/hexo-theme-obsidian/blob/master/CHANGELOG.md" title = "v1.4.3" target = "_blank" rel = "noopener" > v1.4.3< / a > < / small >
< / p >
< / footer >
2020-06-05 12:12:10 +08:00
< script type = "text/javascript" src = "https://cdn.bootcss.com/mathjax/2.7.7/MathJax.js?config=TeX-AMS-MML_HTMLorMML" >
2020-06-05 00:15:41 +08:00
< / script >
< script >
MathJax.Hub.Config({
"HTML-CSS": {
preferredFont: "TeX",
availableFonts: ["STIX", "TeX"],
linebreaks: {
automatic: true
},
EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)
},
tex2jax: {
inlineMath: [
["$", "$"],
["\\(", "\\)"]
],
processEscapes: true,
ignoreClass: "tex2jax_ignore|dno",
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
TeX: {
noUndefined: {
attributes: {
mathcolor: "red",
mathbackground: "#FFEEEE",
mathsize: "90%"
}
},
Macros: {
href: "{}"
}
},
messageStyle: "none"
});
< / script >
< script >
function initialMathJax() {
MathJax.Hub.Queue(function () {
var all = MathJax.Hub.getAllJax(),
i;
// console.log(all);
for (i = 0; i < all.length ; i + = 1 ) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
}
function reprocessMathJax() {
if (typeof MathJax !== 'undefined') {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}
}
< / script >
2020-06-05 12:12:10 +08:00
< link rel = "stylesheet" href = "//cdn.bootcss.com/gitalk/1.6.2/gitalk.min.css" >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/gitalk/1.6.2/gitalk.min.js" > < / script >
2020-06-05 00:15:41 +08:00
< script src = "//cdn.bootcss.com/jquery/3.4.1/jquery.min.js" > < / script >
< script src = "/js/plugin.js" > < / script >
< script src = "/js/obsidian.js" > < / script >
< script src = "/js/jquery.truncate.js" > < / script >
< script src = "/js/search.js" > < / script >
< script src = "//cdn.bootcss.com/typed.js/2.0.10/typed.min.js" > < / script >
< script src = "//cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js" > < / script >
< script src = "//cdn.bootcss.com/social-share.js/1.0.16/js/social-share.min.js" > < / script >
2020-06-05 12:12:10 +08:00
< script src = "https://cdn.bootcss.com/codemirror/5.54.0/codemirror.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/javascript/javascript.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/css/css.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/xml/xml.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/htmlmixed/htmlmixed.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/clike/clike.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/php/php.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/shell/shell.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/python/python.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/cmake/cmake.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/powershell/powershell.min.js" > < / script >
2020-06-05 00:15:41 +08:00
2020-06-05 12:12:10 +08:00
< script src = "//cdn.bootcss.com/codemirror/5.54.0/mode/yaml/yaml.min.js" > < / script >
2020-06-05 00:15:41 +08:00
< script src = "/js/busuanzi.min.js" > < / script >
< script >
$(document).ready(function () {
if ($('span[id^="busuanzi_"]').length) {
initialBusuanzi();
}
});
< / script >
< link rel = "stylesheet" href = "//cdn.bootcss.com/photoswipe/4.1.3/photoswipe.min.css" >
< link rel = "stylesheet" href = "//cdn.bootcss.com/photoswipe/4.1.3/default-skin/default-skin.min.css" >
< script src = "//cdn.bootcss.com/photoswipe/4.1.3/photoswipe.min.js" > < / script >
< script src = "//cdn.bootcss.com/photoswipe/4.1.3/photoswipe-ui-default.min.js" > < / script >
<!-- Root element of PhotoSwipe. Must have class pswp. -->
< div class = "pswp" tabindex = "-1" role = "dialog" aria-hidden = "true" >
<!-- Background of PhotoSwipe.
It's a separate element as animating opacity is faster than rgba(). -->
< div class = "pswp__bg" > < / div >
<!-- Slides wrapper with overflow:hidden. -->
< div class = "pswp__scroll-wrap" >
<!-- Container that holds slides.
PhotoSwipe keeps only 3 of them in the DOM to save memory.
Don't modify these 3 pswp__item elements, data is added later on. -->
< div class = "pswp__container" >
< div class = "pswp__item" > < / div >
< div class = "pswp__item" > < / div >
< div class = "pswp__item" > < / div >
< / div >
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
< div class = "pswp__ui pswp__ui--hidden" >
< div class = "pswp__top-bar" >
<!-- Controls are self - explanatory. Order can be changed. -->
< div class = "pswp__counter" > < / div >
< button class = "pswp__button pswp__button--close" title = "Close (Esc)" > < / button >
< button class = "pswp__button pswp__button--share" title = "Share" > < / button >
< button class = "pswp__button pswp__button--fs" title = "Toggle fullscreen" > < / button >
< button class = "pswp__button pswp__button--zoom" title = "Zoom in/out" > < / button >
<!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
<!-- element will get class pswp__preloader - - active when preloader is running -->
< div class = "pswp__preloader" >
< div class = "pswp__preloader__icn" >
< div class = "pswp__preloader__cut" >
< div class = "pswp__preloader__donut" > < / div >
< / div >
< / div >
< / div >
< / div >
< div class = "pswp__share-modal pswp__share-modal--hidden pswp__single-tap" >
< div class = "pswp__share-tooltip" > < / div >
< / div >
< button class = "pswp__button pswp__button--arrow--left" title = "Previous (arrow left)" >
< / button >
< button class = "pswp__button pswp__button--arrow--right" title = "Next (arrow right)" >
< / button >
< div class = "pswp__caption" >
< div class = "pswp__caption__center" > < / div >
< / div >
< / div >
< / div >
< / div >
<!-- Global site tag (gtag.js) - Google Analytics -->
< script async src = "//www.googletagmanager.com/gtag/js?id=UA-157733505-1" > < / script >
< script >
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-157733505-1');
< / script >
< script >
function initialTyped () {
var typedTextEl = $('.typed-text');
if (typedTextEl & & typedTextEl.length > 0) {
var typed = new Typed('.typed-text', {
strings: ["凡事都要留几分", "颜值是第一生产力"],
typeSpeed: 90,
loop: true,
loopCount: Infinity,
backSpeed: 20,
});
}
}
if ($('.article-header') & & $('.article-header').length) {
$(document).ready(function () {
initialTyped();
});
}
< / script >
< / html >