public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Algorithms
@ 2018-02-02 11:46 Umut Acar
       [not found] ` <e6689bc2-ed40-42c4-86a2-e3b6c40fa3d0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Umut Acar @ 2018-02-02 11:46 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]

I wish to use pandoc to translate algorithmic pseudo code written in latex to html.  In latex, I typically use lstlisting with linenumbers and syntax highlighting on.  Because this is pseudo code, I have my own keywords and define the syntax using lstlisting commands.  I also use lots of math within the pseudo code.

This is all possible when going from latex to PDF using say pdflatex but I have not had success in producing decent looking html from the same code using pandoc. I have had some success with using math arrays by basically writing the algorithms as math but it is painful and alignment and  indentation is a big headache.

I would be happy to use a different latex environment etc.  What would be a good way to do this? I would appreciate any suggestions!  Thank you

Umut

-- 
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/e6689bc2-ed40-42c4-86a2-e3b6c40fa3d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* Re: Algorithms
       [not found] ` <e6689bc2-ed40-42c4-86a2-e3b6c40fa3d0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-02-02 21:11   ` John MACFARLANE
  2018-02-03 18:51     ` Algorithms Umut Acar
  2018-02-05 21:28   ` Algorithms Christophe Demko
  1 sibling, 1 reply; 6+ messages in thread
From: John MACFARLANE @ 2018-02-02 21:11 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Pandoc is not really set up to handle verbatim environments
that contain commands, math, etc.

You could try using an alltt environment, but our support
for this is currently rudimentary.  There's an issue on the
tracker to improve this.

+++ Umut Acar [Feb 02 18 03:46 ]:
>I wish to use pandoc to translate algorithmic pseudo code written in latex to html.  In latex, I typically use lstlisting with linenumbers and syntax highlighting on.  Because this is pseudo code, I have my own keywords and define the syntax using lstlisting commands.  I also use lots of math within the pseudo code.
>
>This is all possible when going from latex to PDF using say pdflatex but I have not had success in producing decent looking html from the same code using pandoc. I have had some success with using math arrays by basically writing the algorithms as math but it is painful and alignment and  indentation is a big headache.
>
>I would be happy to use a different latex environment etc.  What would be a good way to do this? I would appreciate any suggestions!  Thank you
>
>Umut
>
>-- 
>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/e6689bc2-ed40-42c4-86a2-e3b6c40fa3d0%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/20180202211158.GE26187%40protagoras.
For more options, visit https://groups.google.com/d/optout.


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

* Re: Algorithms
  2018-02-02 21:11   ` Algorithms John MACFARLANE
@ 2018-02-03 18:51     ` Umut Acar
  0 siblings, 0 replies; 6+ messages in thread
From: Umut Acar @ 2018-02-03 18:51 UTC (permalink / raw)
  To: pandoc-discuss


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

OK thank you.  I will experiment with alltt.  If possible, would you mind 
giving me a brief summary of what is supported or not in the alltt env? 

BTW, thank you for your great work on pandoc.  

On Friday, February 2, 2018 at 4:12:14 PM UTC-5, John MacFarlane wrote:
>
> Pandoc is not really set up to handle verbatim environments 
> that contain commands, math, etc. 
>
> You could try using an alltt environment, but our support 
> for this is currently rudimentary.  There's an issue on the 
> tracker to improve this. 
>
> +++ Umut Acar [Feb 02 18 03:46 ]: 
> >I wish to use pandoc to translate algorithmic pseudo code written in 
> latex to html.  In latex, I typically use lstlisting with linenumbers and 
> syntax highlighting on.  Because this is pseudo code, I have my own 
> keywords and define the syntax using lstlisting commands.  I also use lots 
> of math within the pseudo code. 
> > 
> >This is all possible when going from latex to PDF using say pdflatex but 
> I have not had success in producing decent looking html from the same code 
> using pandoc. I have had some success with using math arrays by basically 
> writing the algorithms as math but it is painful and alignment and 
>  indentation is a big headache. 
> > 
> >I would be happy to use a different latex environment etc.  What would be 
> a good way to do this? I would appreciate any suggestions!  Thank you 
> > 
> >Umut 
> > 
> >-- 
> >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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
> <javascript:>. 
> >To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/e6689bc2-ed40-42c4-86a2-e3b6c40fa3d0%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/5336af19-3fbf-43b6-af71-795d4c7bcef5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Algorithms
       [not found] ` <e6689bc2-ed40-42c4-86a2-e3b6c40fa3d0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-02-02 21:11   ` Algorithms John MACFARLANE
@ 2018-02-05 21:28   ` Christophe Demko
       [not found]     ` <014a69ac-7b58-484f-b24f-44a601c25af7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Christophe Demko @ 2018-02-05 21:28 UTC (permalink / raw)
  To: pandoc-discuss


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

If I understand correctly, you want to define your own langage with its 
proper highlighting.

If this is the case, you have to define a Kate syntax definition file 
<https://github.com/KDE/syntax-highlighting> and run pandoc 
with --syntax-definition=/path/to/your/file.xml

Example mylanguage.xml:
<?xml version="1.0" encoding="UTF-8"?>
<language name="mylanguage">
  <highlighting>
    <list name="somename">
      <item> class </item>
      <item> const </item>
    </list>
    <contexts>
      <context attribute="Normal Text" lineEndContext="#pop" name="Normal 
Text" >
        <keyword attribute="Keyword" context="#stay" String="somename" />
        <DetectChar attribute="String" context="string" char="&quot;" />
      </context>
      <context attribute="String" lineEndContext="#stay" name="string" >
        <DetectChar attribute="String" context="#pop" char="&quot;" />
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal" />
      <itemData name="Keyword" defStyleNum="dsKeyword" />
      <itemData name="String" defStyleNum="dsString" />
    </itemDatas>
  </highlighting>
</language>

in your pandoc document, simply make reference to mylanguage codeblock

~~~mylanguage
class const normal "string"
~~~


will produce highlighted syntax in HTML *and* in pdf.

See https://docs.kde.org/stable5/en/applications/katepart/highlight.html 
for a complete documentation on Kate syntax definition files

Ch.D

Le vendredi 2 février 2018 12:46:57 UTC+1, Umut Acar a écrit :
>
> I wish to use pandoc to translate algorithmic pseudo code written in latex 
> to html.  In latex, I typically use lstlisting with linenumbers and syntax 
> highlighting on.  Because this is pseudo code, I have my own keywords and 
> define the syntax using lstlisting commands.  I also use lots of math 
> within the pseudo code.
>
> This is all possible when going from latex to PDF using say pdflatex but I 
> have not had success in producing decent looking html from the same code 
> using pandoc. I have had some success with using math arrays by basically 
> writing the algorithms as math but it is painful and alignment and 
>  indentation is a big headache.
>
> I would be happy to use a different latex environment etc.  What would be 
> a good way to do this? I would appreciate any suggestions!  Thank you
>
> Umut
>
>

-- 
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/014a69ac-7b58-484f-b24f-44a601c25af7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Algorithms
       [not found]     ` <014a69ac-7b58-484f-b24f-44a601c25af7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-02-08 23:47       ` Umut Acar
  2019-05-16 19:03       ` Algorithms Umut Acar
  1 sibling, 0 replies; 6+ messages in thread
From: Umut Acar @ 2018-02-08 23:47 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 50 bytes --]

That sounds nice.  I will try this...

Thank you!

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

* Re: Algorithms
       [not found]     ` <014a69ac-7b58-484f-b24f-44a601c25af7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-02-08 23:47       ` Algorithms Umut Acar
@ 2019-05-16 19:03       ` Umut Acar
  1 sibling, 0 replies; 6+ messages in thread
From: Umut Acar @ 2019-05-16 19:03 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi Christophe,
This has been very helpful.  Thank you! I  have not  gotten it to work at 
this point... I have a few followup questions.

1)  Ane language that i would like to define is a small extension of C.  Is 
there a Kate spec for C that I can take and modify? 

2) I am using this in LaTeX and lstlisting package.  Do you know of any 
compatibility issues? I a compiling like this: 
pandoc --verbose -f latex --inline --syntax-definition=./c-extended.xml 
--mathjax -s  myfile.tex -n myfile.html

Here c-extended.xml is my xml definition.

When I run this command, it seems that the spec does not have any effect.  
I would like to start with a working spec and then see where I can get to...


Best,

-- Umut



On Monday, February 5, 2018 at 4:28:48 PM UTC-5, Christophe Demko wrote:
>
> If I understand correctly, you want to define your own langage with its 
> proper highlighting.
>
> If this is the case, you have to define a Kate syntax definition file 
> <https://github.com/KDE/syntax-highlighting> and run pandoc 
> with --syntax-definition=/path/to/your/file.xml
>
> Example mylanguage.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <language name="mylanguage">
>   <highlighting>
>     <list name="somename">
>       <item> class </item>
>       <item> const </item>
>     </list>
>     <contexts>
>       <context attribute="Normal Text" lineEndContext="#pop" name="Normal 
> Text" >
>         <keyword attribute="Keyword" context="#stay" String="somename" />
>         <DetectChar attribute="String" context="string" char="&quot;" />
>       </context>
>       <context attribute="String" lineEndContext="#stay" name="string" >
>         <DetectChar attribute="String" context="#pop" char="&quot;" />
>       </context>
>     </contexts>
>     <itemDatas>
>       <itemData name="Normal Text" defStyleNum="dsNormal" />
>       <itemData name="Keyword" defStyleNum="dsKeyword" />
>       <itemData name="String" defStyleNum="dsString" />
>     </itemDatas>
>   </highlighting>
> </language>
>
> in your pandoc document, simply make reference to mylanguage codeblock
>
> ~~~mylanguage
> class const normal "string"
> ~~~
>
>
> will produce highlighted syntax in HTML *and* in pdf.
>
> See https://docs.kde.org/stable5/en/applications/katepart/highlight.html 
> for a complete documentation on Kate syntax definition files
>
> Ch.D
>
> Le vendredi 2 février 2018 12:46:57 UTC+1, Umut Acar a écrit :
>>
>> I wish to use pandoc to translate algorithmic pseudo code written in 
>> latex to html.  In latex, I typically use lstlisting with linenumbers and 
>> syntax highlighting on.  Because this is pseudo code, I have my own 
>> keywords and define the syntax using lstlisting commands.  I also use lots 
>> of math within the pseudo code.
>>
>> This is all possible when going from latex to PDF using say pdflatex but 
>> I have not had success in producing decent looking html from the same code 
>> using pandoc. I have had some success with using math arrays by basically 
>> writing the algorithms as math but it is painful and alignment and 
>>  indentation is a big headache.
>>
>> I would be happy to use a different latex environment etc.  What would be 
>> a good way to do this? I would appreciate any suggestions!  Thank you
>>
>> Umut
>>
>>

-- 
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/df1cc2f9-0a79-4bdd-a1d2-ed46770c4ea4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

end of thread, other threads:[~2019-05-16 19:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 11:46 Algorithms Umut Acar
     [not found] ` <e6689bc2-ed40-42c4-86a2-e3b6c40fa3d0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-02-02 21:11   ` Algorithms John MACFARLANE
2018-02-03 18:51     ` Algorithms Umut Acar
2018-02-05 21:28   ` Algorithms Christophe Demko
     [not found]     ` <014a69ac-7b58-484f-b24f-44a601c25af7-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-02-08 23:47       ` Algorithms Umut Acar
2019-05-16 19:03       ` Algorithms Umut Acar

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).