ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 12 Sep 2019 23:28:05 +0200Pandoc filterhttps://ask.sagemath.org/question/47799/pandoc-filter/ I'd like to use sagemath in markdown similar to sagetex:
<div class="sagesilent"> f(x)=sin(x) </div>
This is a plot of <span class="sage"> f(x) </span>
<div class="sageplot"> plot(f(x),(x,0,5)) </div>
Is there already a pandoc filter for this?Sun, 08 Sep 2019 23:55:57 +0200https://ask.sagemath.org/question/47799/pandoc-filter/Answer by Emmanuel Charpentier for <p>I'd like to use sagemath in markdown similar to sagetex:</p>
<pre><code><div class="sagesilent"> f(x)=sin(x) </div>
This is a plot of <span class="sage"> f(x) </span>
<div class="sageplot"> plot(f(x),(x,0,5)) </div>
</code></pre>
<p>Is there already a pandoc filter for this?</p>
https://ask.sagemath.org/question/47799/pandoc-filter/?answer=47800#post-id-47800I suppose that you aim at creating some object document from a source (not LaTeX: in this latter case, `pandoc`ing a LaTeX source containing (processed) `SageTeX` chunks would probably work).
I'd suggest to take a look at [codebraid](https://github.com/gpoore/codebraid), which aims to do for Markdown what [Pythontex](https://github.com/gpoore/pythontex) does for LaTeX (i. e. inserting Python (and other languages) chunks in a source text, but more general): both packages support Sage.
Processing a Markdown source via `codebraid` and translating it to HTML via `pandoc` should give you something close to what you aim at (at least for some values of "Markdown"...).
Another possibility is [org-mode](https://orgmode.org/), whose abilities are impressive, but is strictly an `emacs` tool, that comes with its [Matterhorrn](https://www.outdooractive.com/img//800/9338305/.jpg)-like learning curve... Needs a bit of time to get used to, supports an impressive array of languages (about 75 last time I looked), including Sage.
If you need heavy cross-referencing (i. e. captions and pointers to tables, figures, equations, parts of text, bibliographic reerences), your best bet is LaTeX + (possibly imperfect) translation to HTML via `pandoc` or `org-mode`: the crross-referencing abilities of Markdown are still in infancy and need (not so stable) external filters...Mon, 09 Sep 2019 02:26:04 +0200https://ask.sagemath.org/question/47799/pandoc-filter/?answer=47800#post-id-47800Comment by Georg Damm for <p>I suppose that you aim at creating some object document from a source (not LaTeX: in this latter case, <code>pandoc</code>ing a LaTeX source containing (processed) <code>SageTeX</code> chunks would probably work).</p>
<p>I'd suggest to take a look at <a href="https://github.com/gpoore/codebraid">codebraid</a>, which aims to do for Markdown what <a href="https://github.com/gpoore/pythontex">Pythontex</a> does for LaTeX (i. e. inserting Python (and other languages) chunks in a source text, but more general): both packages support Sage.</p>
<p>Processing a Markdown source via <code>codebraid</code> and translating it to HTML via <code>pandoc</code> should give you something close to what you aim at (at least for some values of "Markdown"...).</p>
<p>Another possibility is <a href="https://orgmode.org/">org-mode</a>, whose abilities are impressive, but is strictly an <code>emacs</code> tool, that comes with its <a href="https://www.outdooractive.com/img//800/9338305/.jpg">Matterhorrn</a>-like learning curve... Needs a bit of time to get used to, supports an impressive array of languages (about 75 last time I looked), including Sage.</p>
<p>If you need heavy cross-referencing (i. e. captions and pointers to tables, figures, equations, parts of text, bibliographic reerences), your best bet is LaTeX + (possibly imperfect) translation to HTML via <code>pandoc</code> or <code>org-mode</code>: the crross-referencing abilities of Markdown are still in infancy and need (not so stable) external filters...</p>
https://ask.sagemath.org/question/47799/pandoc-filter/?comment=47866#post-id-47866Thank's for your answer, but this is not what I'm looking for. I'll try to write a filter.
Is there an easy way to get the (latex) output
\sin\left(x\right)
from the following file?
f(x)=sin(x)
f(x)Thu, 12 Sep 2019 23:28:05 +0200https://ask.sagemath.org/question/47799/pandoc-filter/?comment=47866#post-id-47866