public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Converting mixed latex (lhs) + markdown to latex (lhs)
@ 2012-03-17  7:58 Alessandro Vermeulen
       [not found] ` <8e3f5907-1c7d-4ef9-ae76-8103621fa223-2dFLOe7gW+OqFmioV6QfyGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Alessandro Vermeulen @ 2012-03-17  7:58 UTC (permalink / raw)
  To: pandoc-discuss

Dear all,

I'm seeking for a solution to convert blocks of markdown syntax within
a latex lhs file to another file in latex lhs but with the markdown
parts transformed to latex. E.g. a file containing the following:

```
    \documentclass{article}
    \begin{document}
    Some paragraph

    \begin{someliterallatex}
    \end{someliterallatex}

    * A markdown
    * list

    \end{document}
```

Should be converted into the following:

```
    \documentclass{article}
    \begin{document}
    Some paragraph

    \begin{someliterallatex}
    \end{someliterallatex}

    \begin{itemize}
      \item A markdown
      \item list
    \end{itemize}

    \end{document}
```

I have tried to this with vanilla pandoc with a combination of input
and output formats, but to no avail. Has someone done or tried this
before?


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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
       [not found] ` <8e3f5907-1c7d-4ef9-ae76-8103621fa223-2dFLOe7gW+OqFmioV6QfyGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org>
@ 2012-03-17 16:17   ` John MacFarlane
  2012-03-19 19:47   ` Alessandro Vermeulen
  1 sibling, 0 replies; 9+ messages in thread
From: John MacFarlane @ 2012-03-17 16:17 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ Alessandro Vermeulen [Mar 17 12 00:58 ]:
> Dear all,
> 
> I'm seeking for a solution to convert blocks of markdown syntax within
> a latex lhs file to another file in latex lhs but with the markdown
> parts transformed to latex. E.g. a file containing the following:
> 
> ```
>     \documentclass{article}
>     \begin{document}
>     Some paragraph
> 
>     \begin{someliterallatex}
>     \end{someliterallatex}
> 
>     * A markdown
>     * list
> 
>     \end{document}
> ```
> 
> Should be converted into the following:
> 
> ```
>     \documentclass{article}
>     \begin{document}
>     Some paragraph
> 
>     \begin{someliterallatex}
>     \end{someliterallatex}
> 
>     \begin{itemize}
>       \item A markdown
>       \item list
>     \end{itemize}
> 
>     \end{document}
> ```

Cut out the document body, and run it through
'pandoc -f markdown -t latex'.  Literal LaTeX environments
will be passed through verbatim, and the rest converted from
markdown to latex. Then add in the preamble and
'\begin{document}...\end{document}'.

If you leave in the \begin{document}...\end{document}, pandoc
treats the whole thing as a literal latex environment and does
not convert markdown within it.

John


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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
       [not found] ` <8e3f5907-1c7d-4ef9-ae76-8103621fa223-2dFLOe7gW+OqFmioV6QfyGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org>
  2012-03-17 16:17   ` John MacFarlane
@ 2012-03-19 19:47   ` Alessandro Vermeulen
  2012-03-20  2:29     ` John MacFarlane
  2012-03-20 11:33     ` Ivan Lazar Miljenovic
  1 sibling, 2 replies; 9+ messages in thread
From: Alessandro Vermeulen @ 2012-03-19 19:47 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

It seems I cannot reply to you directly fiddlosopher.

Thanks for the help. The only problem I have now is that I have text like 
the following in my source:

The transformation from a document into a table of contents can be
> implemented as a pure function with the (Haskell type) signature 
> |toc :: Document -> TableOfContents|.


The | and the > are transformed into LaTeX commands.

... function with the (Haskell type) signature
> \textbar{}toc :: Document -\textgreater{} TableOfContents\textbar{}. 


Also some comments are removed entirely (the ones that read like %text), 
comments that have a space after the % remain, but the % is prefixed with a 
\.

Can you suggest fixes or workarounds for this as well? 

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/5IH-Y9dIrUUJ.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.


[-- Attachment #2: Type: text/html, Size: 1979 bytes --]

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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
  2012-03-19 19:47   ` Alessandro Vermeulen
@ 2012-03-20  2:29     ` John MacFarlane
  2012-03-20 11:33     ` Ivan Lazar Miljenovic
  1 sibling, 0 replies; 9+ messages in thread
From: John MacFarlane @ 2012-03-20  2:29 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ Alessandro Vermeulen [Mar 19 12 12:47 ]:
>    It seems I cannot reply to you directly fiddlosopher.
> 
>    Thanks for the help. The only problem I have now is that I have text
>    like the following in my source:
> 
>      The transformation from a document into a table of contents can be
>      implemented as a pure function with the (Haskell type) signature
>      |toc :: Document -> TableOfContents|.
> 
>    The | and the > are transformed into LaTeX commands.
> 
>      ... function with the (Haskell type) signature
>      \textbar{}toc :: Document -\textgreater{}
>      TableOfContents\textbar{}.

The |<haskell>| notation used in LaTeX literate Haskell is not
supported in pandoc's markdon literate Haskell.  You can use
backticks instead:  `toc :: Document -> TableOfContents`.

>    Also some comments are removed entirely (the ones that read like
>    %text), comments that have a space after the % remain, but the % is
>    prefixed with a \.

If they're in the first three lines of the document, then they're
being interpreted as a pandoc title block.  That's why they're
being removed (actually, they're being interpreted as document
title, author, date.) Note: pandoc markdown does not have a comment
syntax (aside from HTML comments). You can't use LaTeX comments in
markdown and expect them to be interpreted as comments.


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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
  2012-03-19 19:47   ` Alessandro Vermeulen
  2012-03-20  2:29     ` John MacFarlane
@ 2012-03-20 11:33     ` Ivan Lazar Miljenovic
       [not found]       ` <CA+u6gbzhBsD-0GisSnHKJuwHKoqvXcNr-PWdt0SuNqG-OC_YcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Ivan Lazar Miljenovic @ 2012-03-20 11:33 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 20 March 2012 06:47, Alessandro Vermeulen
<alessandro.vermeulen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> It seems I cannot reply to you directly fiddlosopher.
>
> Thanks for the help. The only problem I have now is that I have text like
> the following in my source:
>
>> The transformation from a document into a table of contents can be
>> implemented as a pure function with the (Haskell type) signature
>> |toc :: Document -> TableOfContents|.
>
>
> The | and the > are transformed into LaTeX commands.
>
>> ... function with the (Haskell type) signature
>> \textbar{}toc :: Document -\textgreater{} TableOfContents\textbar{}.

What does that transformation?  Is that a lhs2tex-ism?

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://IvanMiljenovic.wordpress.com


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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
       [not found]       ` <CA+u6gbzhBsD-0GisSnHKJuwHKoqvXcNr-PWdt0SuNqG-OC_YcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-03-22  8:24         ` Alessandro Vermeulen
  2012-03-22  9:09           ` Tillmann Rendel
  2012-03-22  9:35           ` Ivan Lazar Miljenovic
  0 siblings, 2 replies; 9+ messages in thread
From: Alessandro Vermeulen @ 2012-03-22  8:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Code between |'s is inline code. So it will be typeset as such.

On Tuesday, March 20, 2012 12:33:50 PM UTC+1, Ivan Miljenovic wrote:
>
> On 20 March 2012 06:47, Alessandro Vermeulen
> > It seems I cannot reply to you directly fiddlosopher.
> >
> > Thanks for the help. The only problem I have now is that I have text like
> > the following in my source:
> >
> >> The transformation from a document into a table of contents can be
> >> implemented as a pure function with the (Haskell type) signature
> >> |toc :: Document -> TableOfContents|.
> >
> >
> > The | and the > are transformed into LaTeX commands.
> >
> >> ... function with the (Haskell type) signature
> >> \textbar{}toc :: Document -\textgreater{} TableOfContents\textbar{}.
>
> What does that transformation?  Is that a lhs2tex-ism?
>
> -- 
> Ivan Lazar Miljenovic
> Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> http://IvanMiljenovic.wordpress.com
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/5z05LztlHIoJ.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.


[-- Attachment #2: Type: text/html, Size: 1949 bytes --]

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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
  2012-03-22  8:24         ` Alessandro Vermeulen
@ 2012-03-22  9:09           ` Tillmann Rendel
  2012-03-22  9:35           ` Ivan Lazar Miljenovic
  1 sibling, 0 replies; 9+ messages in thread
From: Tillmann Rendel @ 2012-03-22  9:09 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hi Alessandro,

if pandoc sees a | in markdown input, it assumes that you want a visible 
| in your final pdf output, so it produces \textbar in the latex output.

If pandoc sees some text enclosed in `, it assumes that you want literal 
code in your final pdf output, so it produces latex that will activate 
typewriter font etc.

So if you want pandoc to parse your inline code correctly, you need to 
enclose it in ` instead of in |. For example, you need to use `toc :: 
Doc -> TOC` instead of |toc :: Doc -> TOC|.



I am not sure what exactly you want to do, but I have a pandoc script 
that converts `...` in the input to |...| in the output. I use it to 
process the same file first with pandoc, and then with lhs2tex. Would 
that help you?

   Tillmann


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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
  2012-03-22  8:24         ` Alessandro Vermeulen
  2012-03-22  9:09           ` Tillmann Rendel
@ 2012-03-22  9:35           ` Ivan Lazar Miljenovic
       [not found]             ` <CA+u6gbzWEvFLRFCE1rh9AtN5LygqQfe11AMBwGHv2UgOoVDSoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Ivan Lazar Miljenovic @ 2012-03-22  9:35 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 22 March 2012 19:24, Alessandro Vermeulen
<alessandro.vermeulen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Code between |'s is inline code. So it will be typeset as such.

Where did you get this information from though?  I couldn't find
anything on that, and the Haskell report doesn't mention inline code
at all: http://www.haskell.org/onlinereport/literate.html

>
>
> On Tuesday, March 20, 2012 12:33:50 PM UTC+1, Ivan Miljenovic wrote:
>>
>> On 20 March 2012 06:47, Alessandro Vermeulen
>> > It seems I cannot reply to you directly fiddlosopher.
>> >
>> > Thanks for the help. The only problem I have now is that I have text
>> > like
>> > the following in my source:
>> >
>> >> The transformation from a document into a table of contents can be
>> >> implemented as a pure function with the (Haskell type) signature
>> >> |toc :: Document -> TableOfContents|.
>> >
>> >
>> > The | and the > are transformed into LaTeX commands.
>> >
>> >> ... function with the (Haskell type) signature
>> >> \textbar{}toc :: Document -\textgreater{} TableOfContents\textbar{}.
>>
>> What does that transformation?  Is that a lhs2tex-ism?
>>
>> --
>> Ivan Lazar Miljenovic
>> Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> http://IvanMiljenovic.wordpress.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pandoc-discuss/-/5z05LztlHIoJ.
>
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/pandoc-discuss?hl=en.



-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://IvanMiljenovic.wordpress.com

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.



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

* Re: Converting mixed latex (lhs) + markdown to latex (lhs)
       [not found]             ` <CA+u6gbzWEvFLRFCE1rh9AtN5LygqQfe11AMBwGHv2UgOoVDSoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-03-22 15:50               ` John MacFarlane
  0 siblings, 0 replies; 9+ messages in thread
From: John MacFarlane @ 2012-03-22 15:50 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ Ivan Lazar Miljenovic [Mar 22 12 20:35 ]:
> On 22 March 2012 19:24, Alessandro Vermeulen
> <alessandro.vermeulen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Code between |'s is inline code. So it will be typeset as such.
> 
> Where did you get this information from though?  I couldn't find
> anything on that, and the Haskell report doesn't mention inline code
> at all: http://www.haskell.org/onlinereport/literate.html

As I understand it, this is not part of official literate Haskell; it's
a feature in the lhs2tex preprocessor.


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

end of thread, other threads:[~2012-03-22 15:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-17  7:58 Converting mixed latex (lhs) + markdown to latex (lhs) Alessandro Vermeulen
     [not found] ` <8e3f5907-1c7d-4ef9-ae76-8103621fa223-2dFLOe7gW+OqFmioV6QfyGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org>
2012-03-17 16:17   ` John MacFarlane
2012-03-19 19:47   ` Alessandro Vermeulen
2012-03-20  2:29     ` John MacFarlane
2012-03-20 11:33     ` Ivan Lazar Miljenovic
     [not found]       ` <CA+u6gbzhBsD-0GisSnHKJuwHKoqvXcNr-PWdt0SuNqG-OC_YcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-22  8:24         ` Alessandro Vermeulen
2012-03-22  9:09           ` Tillmann Rendel
2012-03-22  9:35           ` Ivan Lazar Miljenovic
     [not found]             ` <CA+u6gbzWEvFLRFCE1rh9AtN5LygqQfe11AMBwGHv2UgOoVDSoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-22 15:50               ` 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).