Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markdown reader, latex and the -R flag #1961

Closed
puterleat opened this issue Feb 20, 2015 · 4 comments
Closed

markdown reader, latex and the -R flag #1961

puterleat opened this issue Feb 20, 2015 · 4 comments

Comments

@puterleat
Copy link

The docs for the -R flag state:

-R, --parse-raw
Parse untranslatable HTML codes and LaTeX environments as raw HTML or LaTeX, instead of ignoring them. Affects only HTML and LaTeX input. ...

However it's valid for pandoc markdown to contain latex commands. Is it possible for the markdown reader to also honour the -R flag, to enable latex to be printed into the rst output?

@jgm
Copy link
Owner

jgm commented Feb 20, 2015

The -R flag only affects parsing. As you note, pandoc
markdown with default extensions already allows raw LaTeX,
and this gets into the parse tree. You don't need -R for
that.

However, the RST writer doesn't pass through raw LaTeX
inlines. (It does pass through raw LaTeX environments
using .. raw:.) If there's a way to handle LaTeX
inlines in RST, we could add that.

+++ puterleat [Feb 19 15 16:13 ]:

The docs for the -R flag state:

-R, --parse-raw
Parse untranslatable HTML codes and LaTeX environments as raw HTML or
LaTeX, instead of ignoring them. Affects only HTML and LaTeX input. ...

However it's valid for pandoc markdown to contain latex commands. Is it
possible for the markdown reader to also honour the -R flag, to enable
latex to be printed into the rst output?


Reply to this email directly or [1]view it on GitHub.

References

  1. markdown reader, latex and the -R flag #1961

@puterleat
Copy link
Author

On 20 Feb 2015, at 02:29, John MacFarlane notifications@github.com wrote:

The -R flag only affects parsing. As you note, pandoc
markdown with default extensions already allows raw LaTeX,
and this gets into the parse tree. You don't need -R for
that.

However, the RST writer doesn't pass through raw LaTeX
inlines. (It does pass through raw LaTeX environments
using .. raw:.) If there's a way to handle LaTeX
inlines in RST, we could add that.

I see… Would the equivalent of .. raw: be to add them as inline literal ?

@jgm
Copy link
Owner

jgm commented Feb 20, 2015

+++ puterleat [Feb 20 15 01:10 ]:

I see… Would the equivalent of .. raw: be to add them as inline literal ?

I don't know. If you find the answer, please link to part
of the docutils documentation.

@puterleat
Copy link
Author

I don't know. If you find the answer, please link to part
of the docutils documentation.

On checking, it should actually use the ‘raw' role, so something like :raw:\mylatexcommand{foo}

http://docutils.sourceforge.net/docs/ref/rst/roles.html#raw http://docutils.sourceforge.net/docs/ref/rst/roles.html#raw

It also recommends to subclass the role, so you might add this to the document:

.. role:: raw-latex(raw)
:format: latex
And then inline use would be :raw-latex:\mylatexcommand{foo}

@jgm jgm closed this as completed in 28497d4 Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants