public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Unable to convert markdown to latex while it's in latex blocks
@ 2020-11-11  7:45 Bernardo Giordano
       [not found] ` <8c50d176-a9cb-422a-b78f-1e8fd36dce52n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Bernardo Giordano @ 2020-11-11  7:45 UTC (permalink / raw)
  To: pandoc-discuss


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


Hello. I'm facing the following issue: 

I have a markdown document that occasionally contains latex blocks, e.g.:

# My Title

\epigraph{
\begin{center}
Markdown text inside,
occasionally *italic*
\end{center}
}{some epigraph author}

Normal markdown text
...

When converting from markdown to latex, italic text keeps the * rather than 
being transformed to \emph{}. Is there a workaround? Thank you

-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8c50d176-a9cb-422a-b78f-1e8fd36dce52n%40googlegroups.com.

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

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

* Re: Unable to convert markdown to latex while it's in latex blocks
       [not found] ` <8c50d176-a9cb-422a-b78f-1e8fd36dce52n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-11-11  8:09   ` Albert Krewinkel
       [not found]     ` <87h7pws4a6.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  2020-11-11 18:09   ` Unable to convert markdown to latex while it's in latex blocks John MacFarlane
  1 sibling, 1 reply; 5+ messages in thread
From: Albert Krewinkel @ 2020-11-11  8:09 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Please
Bernardo Giordano writes:

> Hello. I'm facing the following issue:
>
> I have a markdown document that occasionally contains latex blocks, e.g.:
>
> # My Title
>
> \epigraph{
> \begin{center}
> Markdown text inside,
> occasionally *italic*
> \end{center}
> }{some epigraph author}
>
> Normal markdown text
> ...
>
> When converting from markdown to latex, italic text keeps the * rather than
> being transformed to \emph{}. Is there a workaround? Thank you

Telling LaTeX and Markdown apart is difficult, see also
https://github.com/jgm/pandoc/issues/2453

The best workaround (IMHO) is to mark the LaTeX explicitly,
ensuring that the rest will be interpreted as Markdown:

    # My Title

    `\epigraph{
    \begin{center}`{=latex}
    Markdown text inside,
    occasionally *italic*
    `\end{center}
    }{some epigraph author}`{=latex}

    Normal markdown text


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


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

* Re: Unable to convert markdown to latex while it's in latex blocks
       [not found]     ` <87h7pws4a6.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2020-11-11  8:19       ` Bernardo Giordano
       [not found]         ` <8c42cf82-8531-4a70-bbb1-f56de736235fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Bernardo Giordano @ 2020-11-11  8:19 UTC (permalink / raw)
  To: pandoc-discuss


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

Thank you so much, this is actually feasible for my use case.

I was already looking at the solution presented in 
https://github.com/jgm/pandoc/issues/2453#issuecomment-219233316

but this actually makes things easier for me. Thank you.

Il giorno mercoledì 11 novembre 2020 alle 09:10:04 UTC+1 Albert Krewinkel 
ha scritto:

> Please
> Bernardo Giordano writes:
>
> > Hello. I'm facing the following issue:
> >
> > I have a markdown document that occasionally contains latex blocks, e.g.:
> >
> > # My Title
> >
> > \epigraph{
> > \begin{center}
> > Markdown text inside,
> > occasionally *italic*
> > \end{center}
> > }{some epigraph author}
> >
> > Normal markdown text
> > ...
> >
> > When converting from markdown to latex, italic text keeps the * rather 
> than
> > being transformed to \emph{}. Is there a workaround? Thank you
>
> Telling LaTeX and Markdown apart is difficult, see also
> https://github.com/jgm/pandoc/issues/2453
>
> The best workaround (IMHO) is to mark the LaTeX explicitly,
> ensuring that the rest will be interpreted as Markdown:
>
> # My Title
>
> `\epigraph{
> \begin{center}`{=latex}
> Markdown text inside,
> occasionally *italic*
> `\end{center}
> }{some epigraph author}`{=latex}
>
> Normal markdown text
>
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8c42cf82-8531-4a70-bbb1-f56de736235fn%40googlegroups.com.

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

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

* File transclusion with no-inline (on steroids)
       [not found]         ` <8c42cf82-8531-4a70-bbb1-f56de736235fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-11-11  9:52           ` Gabriel Nützi
  0 siblings, 0 replies; 5+ messages in thread
From: Gabriel Nützi @ 2020-11-11  9:52 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Hi all,

I am currently useing the recursive file transclusion with `include-files.lua` filter https://github.com/pandoc/lua-filters/tree/master/include-files <https://github.com/pandoc/lua-filters/tree/master/include-files>
in full capacity (with `—citeproc` and `pandoc-crossref` afterwards!). It works great.

However: When converting to Latex we mostly end up with a monolithic huge file which is really hard to look at for further processing...

I wanted to know what options we would have to end up with an output folder with the same structure but all includes are replaced by e.g. /input{…} in the resulting .tex file:

```{.include no-inline}
chapter/A.md
chapter/B.md
```
would transform when the format is `latex` to something like (note: no-inline does not exist)

\input{<output-dir>/chapter/A.tex}
\input{<output-dir>/chapter/B.tex}

Solution 1 (External):

1. Convert with pandoc and all filters including `include-files.lua` to a monolithic `main.tex` file 
2. Split the main.tex by any means (python) into their parts by parsing start/end comment tags introduced by `include-files.lua`. I think a feature to start/end annotate each included path would be a handy thing. @albert.krewinkel: What do you think?

This is a nice solution as it completely decouples from pandoc processing

Solution 2 (Filter)

1 Adapt filter include-files.lua such that it parses (walk_block) the file and directly produces the output (how?) and then stores the output in
<new-path> := <output-dir>/<path>  where <path> is the same path but wit replace extension. (.tex). (attribute: 'no-inline')
2. Inserts RawInline(tex, "\inputt{<new-path>}”  … to replace the include code block.

Maybe another handy attribute: 'no-parse' which skips step 1. and uses the path directly as <new-path>. 
Two questions:
1. Can we produce output in the lua filter? Is there such functionality or do we need to call pandoc executable from Lua again which is possible trouble some as we need which flags, filters and other stuff needs to be set to produce correct output…?
2. Does such a solution (if possible) work with citeproc/crossref, doesnt it need the whole file?

Is there any other solution and what are the caveats which one needs to deal with when splitting up files as in Solution 2.

Thanks a lot for any input on that matter. Hopefully it will find a way to incorporate and give back the knowledge to the community in the project: https://github.com/gabyx/TechnicalMarkdown

BR Gabriel



-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/786591B8-17BD-4B09-90A2-4EC1446F54C9%40gmail.com.

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

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

* Re: Unable to convert markdown to latex while it's in latex blocks
       [not found] ` <8c50d176-a9cb-422a-b78f-1e8fd36dce52n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2020-11-11  8:09   ` Albert Krewinkel
@ 2020-11-11 18:09   ` John MacFarlane
  1 sibling, 0 replies; 5+ messages in thread
From: John MacFarlane @ 2020-11-11 18:09 UTC (permalink / raw)
  To: Bernardo Giordano, pandoc-discuss


One workaround is to use commands rather than an environment
(since pandoc will parse the whole environment as raw tex).

\epigraph{
\centering
with *italics*
}{author}

Bernardo Giordano <bernardogiordano369-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello. I'm facing the following issue: 
>
> I have a markdown document that occasionally contains latex blocks, e.g.:
>
> # My Title
>
> \epigraph{
> \begin{center}
> Markdown text inside,
> occasionally *italic*
> \end{center}
> }{some epigraph author}
>
> Normal markdown text
> ...
>
> When converting from markdown to latex, italic text keeps the * rather than 
> being transformed to \emph{}. Is there a workaround? Thank you
>
> -- 
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8c50d176-a9cb-422a-b78f-1e8fd36dce52n%40googlegroups.com.


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

end of thread, other threads:[~2020-11-11 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11  7:45 Unable to convert markdown to latex while it's in latex blocks Bernardo Giordano
     [not found] ` <8c50d176-a9cb-422a-b78f-1e8fd36dce52n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-11-11  8:09   ` Albert Krewinkel
     [not found]     ` <87h7pws4a6.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2020-11-11  8:19       ` Bernardo Giordano
     [not found]         ` <8c42cf82-8531-4a70-bbb1-f56de736235fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-11-11  9:52           ` File transclusion with no-inline (on steroids) Gabriel Nützi
2020-11-11 18:09   ` Unable to convert markdown to latex while it's in latex blocks 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).