public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Convert LaTeX to MarkDown with custom equation syntax
@ 2018-12-19 11:34 Foad S Farimani
       [not found] ` <e22d88f8-e350-4dcf-8a03-37000a4a4a4d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Foad S Farimani @ 2018-12-19 11:34 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1593 bytes --]

Hello everyone, 

Very new to Pandac (just installed) and my first question here.

I want to use Pandoc to convert my Latex back to MarkDown so I can use some 
of the common linters such as Proselint. However Pandoc converts LateX math 
equations in a way not rendereable in my favorite 
<https://github.com/amperser/proselint> WYSIWYG editors like Typora 
<https://typora.io/> and Qilin <https://github.com/qilin-editor/qilin-app>. 
I want Pandoc to convert math equations in double dollar sign $$...$$ or 
\begin{equation} \lable{...} \end{equation} to 
   
    ```math
    …
    ```

which is renderable in Qilin with KaTeX or

    $$ {label}
    …
   $$

which is renderable in Typora. I would appreciate if you could help me with 
this.

P.S. Out of the box solutions are also appreciated. For example if there is 
a way to use linters directly on the LaTeX file or there are similar 
editors for other markup formats which give instant preview or are WYSIWYG. 

Best,
Foad

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e22d88f8-e350-4dcf-8a03-37000a4a4a4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2798 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Convert LaTeX to MarkDown with custom equation syntax
       [not found] ` <e22d88f8-e350-4dcf-8a03-37000a4a4a4d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-12-19 11:35   ` Foad S Farimani
  2018-12-19 16:14   ` John MacFarlane
  1 sibling, 0 replies; 3+ messages in thread
From: Foad S Farimani @ 2018-12-19 11:35 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1870 bytes --]

posted also on Reddit 
<https://www.reddit.com/r/pandoc/comments/a7lmpx/convert_latex_to_markdown_with_custom_equation/>
 

F.

On Wednesday, December 19, 2018 at 12:34:02 PM UTC+1, Foad S Farimani wrote:
>
> Hello everyone, 
>
> Very new to Pandac (just installed) and my first question here.
>
> I want to use Pandoc to convert my Latex back to MarkDown so I can use 
> some of the common linters such as Proselint. However Pandoc converts 
> LateX math equations in a way not rendereable in my favorite 
> <https://github.com/amperser/proselint> WYSIWYG editors like Typora 
> <https://typora.io/> and Qilin <https://github.com/qilin-editor/qilin-app>. 
> I want Pandoc to convert math equations in double dollar sign $$...$$ or 
> \begin{equation} \lable{...} \end{equation} to 
>    
>     ```math
>     …
>     ```
>
> which is renderable in Qilin with KaTeX or
>
>     $$ {label}
>     …
>    $$
>
> which is renderable in Typora. I would appreciate if you could help me 
> with this.
>
> P.S. Out of the box solutions are also appreciated. For example if there 
> is a way to use linters directly on the LaTeX file or there are similar 
> editors for other markup formats which give instant preview or are 
> WYSIWYG. 
>
> Best,
> Foad
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/c04c8007-f866-4665-9349-04a823749dc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 4344 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Convert LaTeX to MarkDown with custom equation syntax
       [not found] ` <e22d88f8-e350-4dcf-8a03-37000a4a4a4d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-12-19 11:35   ` Foad S Farimani
@ 2018-12-19 16:14   ` John MacFarlane
  1 sibling, 0 replies; 3+ messages in thread
From: John MacFarlane @ 2018-12-19 16:14 UTC (permalink / raw)
  To: Foad S Farimani, pandoc-discuss


Your best bet is to use a lua filter that intercepts
Math inlines and replaces them with the raw markdown
you want.

This should be fairly simple. Something like this:

function Math(el)
  if FORMAT == 'markdown' then
      if el.mathtype == 'DisplayMath' then
        return pandoc.RawInline('markdown', '\n```math\n' .. el.text .. '\n```\n')
      end
  end
end

(I'm sorry, I don't know the details of these ad hoc
formats you're using, and you don't say anything about
how to deal with inline math, but this should give you
enough to go on to customize your own filter.)

Btw, texshop has a GUI with instant preview for LateX.

Foad S Farimani <f.s.farimani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello everyone, 
>
> Very new to Pandac (just installed) and my first question here.
>
> I want to use Pandoc to convert my Latex back to MarkDown so I can use some 
> of the common linters such as Proselint. However Pandoc converts LateX math 
> equations in a way not rendereable in my favorite 
> <https://github.com/amperser/proselint> WYSIWYG editors like Typora 
> <https://typora.io/> and Qilin <https://github.com/qilin-editor/qilin-app>. 
> I want Pandoc to convert math equations in double dollar sign $$...$$ or 
> \begin{equation} \lable{...} \end{equation} to 
>    
>     ```math
>     …
>     ```
>
> which is renderable in Qilin with KaTeX or
>
>     $$ {label}
>     …
>    $$
>
> which is renderable in Typora. I would appreciate if you could help me with 
> this.
>
> P.S. Out of the box solutions are also appreciated. For example if there is 
> a way to use linters directly on the LaTeX file or there are similar 
> editors for other markup formats which give instant preview or are WYSIWYG. 
>
> Best,
> Foad
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e22d88f8-e350-4dcf-8a03-37000a4a4a4d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2k1k5pk7j.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-19 16:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19 11:34 Convert LaTeX to MarkDown with custom equation syntax Foad S Farimani
     [not found] ` <e22d88f8-e350-4dcf-8a03-37000a4a4a4d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-12-19 11:35   ` Foad S Farimani
2018-12-19 16:14   ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).