Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

Pandoc Latex to Markdown do not parse environment

Background

I am looking to convert some LaTeX files I have already written into markdown for use on my Jekyll site hosted by GitHub Pages. The command

$ pandoc --mathjax -f latex -t gfm+tex_math_dollars my_file.tex -o my_file.md

works quite well for the majority of the file, creates divs around environments like proof or theorem, and handles listings for code.

The issues is that pandoc will strip all of the LaTeX code from an environment that it does not recognize, such as the algorithm environment, except for basic $x+y$-type expressions. Other issues I've found here and here about custom templates only seem to apply when converting from markdown to LaTeX.

The pandoc --filter option only works after the file is parsed. Pandoc parses out surrounding egin and end statements of algorithm, without making a Div to separate the algorithm environment, so it is nearly impossible to recreate the algorithm using a filter.

Question

Is there a way to tell pandoc how to process an unknown LaTeX environment (i.e. algorithm) and the special subcommands therein?

At the very least I'm looking for the reverse of this pandoc discussion, so that the environment is wrapped in a 'Div' and can be processed with --filter.

See also: discussion on Jekyll Talk

question from:https://stackoverflow.com/questions/65930404/pandoc-latex-to-markdown-do-not-parse-environment

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...