我一直在用Markdown做课堂笔记,它很棒。我甚至在Markdown上做了一些预处理,这样我就可以做表格之类的事情。但这学期我要教一门数学课程,我希望能够将LaTeX公式与Markdown一起使用,就像这样:

The refinement relation is written $a \sqsubseteq b$, which can be 
pronounced "$a$ approximates $b$" or "$b$ is at least as defined as $a$".

我希望能够将LaTeX的每个片段预处理为一个不错的反锯齿PNG文件,然后通过HTML <img>标记将其包含在我的Markdown中。但我完全不知道如何获取LaTeX的片段并得到一张漂亮的图像

有正确的边界框吗 是平滑

我只知道如何获得DVI、PostScript或PDF格式的完整页面。

我相信这个问题已经解决了,但我还没能猜出正确的搜索词。有什么建议如何解决它或在哪里寻找现有的解决方案?


编辑:在安装了mathTeX之后,我可以说代码是不灵活的,它违反了Linux文件系统层次结构标准,而且它是业余工作——从这个词的好坏两方面来看都是如此。代码非常复杂,没有明显的错误。我会寻找替代方案。

此外,很明显,在底层,解决方案是基于dvipng的。


一年后:我从来没有得到我一直希望的无缝整合,但我在自己设计的剧本上蹒跚前行。事实证明,使用dvips -E和ImageMagick的转换程序而不是dvipng更容易一些。这样做的好处是可以更好地控制缩放等事情,并且可以轻松地制作透明的背景。 好奇的人可以看看这个例子。

我不能向任何人推荐这个解决方案。但我也不推荐MathTeX。


当前回答

你试过Pandoc吗?

EDIT: Although the documentation has become a bit complex, pandoc has supported inline LaTeX and LaTeX templates for 10 years. Documents like the following one can be written in Markdown: --- title: Just say hello! author: My Friend header-includes: | \usepackage{tikz,pgfplots} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhead[CO,CE]{This is fancy} \fancyfoot[CO,CE]{So is this} \fancyfoot[LE,RO]{\thepage} abstract: This is a pandoc test with Markdown + inline LaTeX --- Just say hello! =============== This could be a good example or inlined \LaTeX: \begin{tikzpicture} \begin{axis} \addplot[color=red]{exp(x)}; \end{axis} \end{tikzpicture} %Here ends the furst plot \hskip 5pt %Here begins the 3d plot \begin{tikzpicture} \begin{axis} \addplot3[ surf, ] {exp(-x^2-y^2)*x}; \end{axis} \end{tikzpicture} And now, just a few words to terminate: > Goodbye folks! Which can be converted to LaTeX using commands like this: pandoc -s -i Hello.md -o Hello.tex Following is an image of the converted Hello.md to Hello.pdf file using MiKTeX as LaTeX processor with the command: pandoc -s -i Hello.md -o Hello.pdf Finally, there are some open source LaTeX templates like this one: https://github.com/Wandmalfarbe/pandoc-latex-template, that can be used for better formatting. As always, the reader should dig deeper if he has less trivial use cases than presented here.

其他回答

我只是现在才看到这个讨论,所以我希望我的评论仍然有用。我参与了MathJax,从我对您的情况的理解来看,我认为这将是解决问题的好方法:保持LaTeX代码原样,让MathJax在查看时呈现数学。

有什么原因让你更喜欢图片吗?

RStudio有一个很好的免费IDE,允许Markdown和LaTeX。

你应该看看multimarkdown http://fletcherpenney.net/multimarkdown/

它支持元数据(标题,关键字,日期,作者等),表,asciimath, mathml,地狱我相信你可以把乳胶数学代码放在那里。它基本上是一个扩展,以降价添加所有其他非常有用的功能。它使用XSLT,因此您可以轻松地创建自己的LaTeX样式,并直接进行转换。我一直在用它,我很喜欢它。

我希望降价能包括多重降价。那太好了。

编辑:Multimarkdown将生成html、latex和其他一些格式。HTML可以随您选择的样式表一起提供。如果我没记错的话,它也会转换成MathML,在Firefox和Safari/Chrome中显示。

我用一个反问来回答你的问题……

你对组织模式有什么看法?它不像Markdown那样纯粹,但它像Markdown一样,我发现它很容易使用,而且它允许嵌入Latex。参见http://www.gnu.org/software/emacs/manual/html_node/org/Embedded-LaTeX.html

附言

如果您还没有看过org-mode,它作为通用的“自然标记语言”比Markdown有一个很大的优势,那就是它对表的处理。源:

| 1 | 0 | 0 |
| -1 | 1 | 0 |
| -1 | -1 | 1 |

代表的只是你所认为的……

乳胶是用texmode的preview-latex渲染成碎片的。

你试过Pandoc吗?

EDIT: Although the documentation has become a bit complex, pandoc has supported inline LaTeX and LaTeX templates for 10 years. Documents like the following one can be written in Markdown: --- title: Just say hello! author: My Friend header-includes: | \usepackage{tikz,pgfplots} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhead[CO,CE]{This is fancy} \fancyfoot[CO,CE]{So is this} \fancyfoot[LE,RO]{\thepage} abstract: This is a pandoc test with Markdown + inline LaTeX --- Just say hello! =============== This could be a good example or inlined \LaTeX: \begin{tikzpicture} \begin{axis} \addplot[color=red]{exp(x)}; \end{axis} \end{tikzpicture} %Here ends the furst plot \hskip 5pt %Here begins the 3d plot \begin{tikzpicture} \begin{axis} \addplot3[ surf, ] {exp(-x^2-y^2)*x}; \end{axis} \end{tikzpicture} And now, just a few words to terminate: > Goodbye folks! Which can be converted to LaTeX using commands like this: pandoc -s -i Hello.md -o Hello.tex Following is an image of the converted Hello.md to Hello.pdf file using MiKTeX as LaTeX processor with the command: pandoc -s -i Hello.md -o Hello.pdf Finally, there are some open source LaTeX templates like this one: https://github.com/Wandmalfarbe/pandoc-latex-template, that can be used for better formatting. As always, the reader should dig deeper if he has less trivial use cases than presented here.