public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Latex command in header inclusion munged with \textbackslash{}
@ 2017-08-07  7:39 David Nebauer
       [not found] ` <85d3801f-6a20-4873-bf2e-e8cd7f13445e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: David Nebauer @ 2017-08-07  7:39 UTC (permalink / raw)
  To: pandoc-discuss


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

If I process this markdown file ('mwe-latex.md'):

---
title: "Minimal Working Example"
header-includes:
- \let\oldsection\section
- \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
---

Text.

with the pandoc command:

pandoc -t latex --latex-engine=xelatex --output=mwe-latex.pdf mwe-latex.md

I get the the error:

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.49 \let\oldsection\textbackslash{}s

pandoc: Error producing PDF

On generating latex output with the command:

pandoc -t latex --latex-engine=xelatex --standalone --output=mwe-latex.tex 
mwe-latex.md

and examining line 49 of the output file it becomes apparent that this line 
from the header inclusion:

\let\oldsection\section

has been munged by pandoc to:

\let\oldsection\textbackslash{}section

and this is causing the processing problem. (Note: changing latex engines 
makes no difference.)

Once line 49 is edited to resemble the original command from the header 
inclusion the error disappears.

How can I prevent this latex command in the header inclusion from being 
munged by pandoc?

-- 
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/85d3801f-6a20-4873-bf2e-e8cd7f13445e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Latex command in header inclusion munged with \textbackslash{}
       [not found] ` <85d3801f-6a20-4873-bf2e-e8cd7f13445e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-08-07 18:25   ` John MacFarlane
       [not found]     ` <20170807182546.GB91733-qqGlgsTyhTiCiGiXOSDXzGEIDr1rnHf9vtmmnBSr4lwnUAKC5xwfQhvRwXAb8BAkh13vi7wywA4@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2017-08-07 18:25 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

See https://github.com/jgm/pandoc/issues/2956

Alternatively, in the dev version of pandoc you can tell
it you've got raw latex, not Markdown:

header-includes:
- `\let\oldsection\section`{=latex}

Final remark:  I don't understand why it's not parsing
the `\section` as raw tex.  I'll need to look into this;
it may be a bug in the LaTeX reader.

+++ David Nebauer [Aug 07 17 00:39 ]:
>   If I process this markdown file ('mwe-latex.md'):
>   ---
>   title: "Minimal Working Example"
>   header-includes:
>   - \let\oldsection\section
>   - \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
>   ---
>   Text.
>   with the pandoc command:
>   pandoc -t latex --latex-engine=xelatex --output=mwe-latex.pdf
>   mwe-latex.md
>   I get the the error:
>   ! LaTeX Error: Missing \begin{document}.
>   See the LaTeX manual or LaTeX Companion for explanation.
>   Type H <return> for immediate help.
>   ...
>   l.49 \let\oldsection\textbackslash{}s
>   pandoc: Error producing PDF
>   On generating latex output with the command:
>   pandoc -t latex --latex-engine=xelatex --standalone
>   --output=mwe-latex.tex mwe-latex.md
>   and examining line 49 of the output file it becomes apparent that this
>   line from the header inclusion:
>   \let\oldsection\section
>   has been munged by pandoc to:
>   \let\oldsection\textbackslash{}section
>   and this is causing the processing problem. (Note: changing latex
>   engines makes no difference.)
>   Once line 49 is edited to resemble the original command from the header
>   inclusion the error disappears.
>   How can I prevent this latex command in the header inclusion from being
>   munged by pandoc?
>
>   --
>   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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [3]https://groups.google.com/d/msgid/pandoc-discuss/85d3801f-6a20-4873-
>   bf2e-e8cd7f13445e%40googlegroups.com.
>   For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   3. https://groups.google.com/d/msgid/pandoc-discuss/85d3801f-6a20-4873-bf2e-e8cd7f13445e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


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

* Re: Latex command in header inclusion munged with \textbackslash{}
       [not found]     ` <20170807182546.GB91733-qqGlgsTyhTiCiGiXOSDXzGEIDr1rnHf9vtmmnBSr4lwnUAKC5xwfQhvRwXAb8BAkh13vi7wywA4@public.gmane.org>
@ 2017-08-08 13:56       ` David Nebauer
       [not found]         ` <1cef78af-0bfb-4d45-983b-39863c588bb6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2017-08-08 14:02       ` David Nebauer
  1 sibling, 1 reply; 8+ messages in thread
From: David Nebauer @ 2017-08-08 13:56 UTC (permalink / raw)
  To: pandoc-discuss


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

Can't install dev pandoc because the ghc archive downloaded as part of the 
process is corrupt.

Once downloaded, the command:

tar xf ghc-8.0.2.tar.xz

results in:

xz: (stdin): Compressed data is corrupt
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

On Tuesday, 8 August 2017 03:56:00 UTC+9:30, John MacFarlane wrote:

> See https://github.com/jgm/pandoc/issues/2956 
>
> Alternatively, in the dev version of pandoc you can tell 
> it you've got raw latex, not Markdown: 
>
> header-includes: 
> - `\let\oldsection\section`{=latex} 
>
> Final remark:  I don't understand why it's not parsing 
> the `\section` as raw tex.  I'll need to look into this; 
> it may be a bug in the LaTeX reader. 
>
> +++ David Nebauer [Aug 07 17 00:39 ]: 
> >   If I process this markdown file ('mwe-latex.md'): 
> >   --- 
> >   title: "Minimal Working Example" 
> >   header-includes: 
> >   - \let\oldsection\section 
> >   - \renewcommand{\section}[1]{\clearpage\oldsection{#1}} 
> >   --- 
> >   Text. 
> >   with the pandoc command: 
> >   pandoc -t latex --latex-engine=xelatex --output=mwe-latex.pdf 
> >   mwe-latex.md 
> >   I get the the error: 
> >   ! LaTeX Error: Missing \begin{document}. 
> >   See the LaTeX manual or LaTeX Companion for explanation. 
> >   Type H <return> for immediate help. 
> >   ... 
> >   l.49 \let\oldsection\textbackslash{}s 
> >   pandoc: Error producing PDF 
> >   On generating latex output with the command: 
> >   pandoc -t latex --latex-engine=xelatex --standalone 
> >   --output=mwe-latex.tex mwe-latex.md 
> >   and examining line 49 of the output file it becomes apparent that this 
> >   line from the header inclusion: 
> >   \let\oldsection\section 
> >   has been munged by pandoc to: 
> >   \let\oldsection\textbackslash{}section 
> >   and this is causing the processing problem. (Note: changing latex 
> >   engines makes no difference.) 
> >   Once line 49 is edited to resemble the original command from the 
> header 
> >   inclusion the error disappears. 
> >   How can I prevent this latex command in the header inclusion from 
> being 
> >   munged by pandoc? 
> > 
> >   -- 
> >   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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To post to this group, send email to 
> >   [2]pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To view this discussion on the web visit 
> >   [3]
> https://groups.google.com/d/msgid/pandoc-discuss/85d3801f-6a20-4873- 
> >   bf2e-e8cd7f13445e%40googlegroups.com. 
> >   For more options, visit [4]https://groups.google.com/d/optout. 
> > 
> >References 
> > 
> >   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   2. mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   3. 
> https://groups.google.com/d/msgid/pandoc-discuss/85d3801f-6a20-4873-bf2e-e8cd7f13445e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer 
> >   4. 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/1cef78af-0bfb-4d45-983b-39863c588bb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Latex command in header inclusion munged with \textbackslash{}
       [not found]     ` <20170807182546.GB91733-qqGlgsTyhTiCiGiXOSDXzGEIDr1rnHf9vtmmnBSr4lwnUAKC5xwfQhvRwXAb8BAkh13vi7wywA4@public.gmane.org>
  2017-08-08 13:56       ` David Nebauer
@ 2017-08-08 14:02       ` David Nebauer
       [not found]         ` <c39d6355-1b71-4355-813f-5e85a1beb988-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: David Nebauer @ 2017-08-08 14:02 UTC (permalink / raw)
  To: pandoc-discuss


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

Not sure of the relevance of issue 2956, which is about pandoc not 
recognising options in parentheses. There are no parentheses in the 
problematic header inclusion.

On Tuesday, 8 August 2017 03:56:00 UTC+9:30, John MacFarlane wrote:
>
> See https://github.com/jgm/pandoc/issues/2956 
>
> Alternatively, in the dev version of pandoc you can tell 
> it you've got raw latex, not Markdown: 
>
> header-includes: 
> - `\let\oldsection\section`{=latex} 
>
> Final remark:  I don't understand why it's not parsing 
> the `\section` as raw tex.  I'll need to look into this; 
> it may be a bug in the LaTeX reader. 
>
> +++ David Nebauer [Aug 07 17 00:39 ]: 
> >   If I process this markdown file ('mwe-latex.md'): 
> >   --- 
> >   title: "Minimal Working Example" 
> >   header-includes: 
> >   - \let\oldsection\section 
> >   - \renewcommand{\section}[1]{\clearpage\oldsection{#1}} 
> >   --- 
> >   Text. 
> >   with the pandoc command: 
> >   pandoc -t latex --latex-engine=xelatex --output=mwe-latex.pdf 
> >   mwe-latex.md 
> >   I get the the error: 
> >   ! LaTeX Error: Missing \begin{document}. 
> >   See the LaTeX manual or LaTeX Companion for explanation. 
> >   Type H <return> for immediate help. 
> >   ... 
> >   l.49 \let\oldsection\textbackslash{}s 
> >   pandoc: Error producing PDF 
> >   On generating latex output with the command: 
> >   pandoc -t latex --latex-engine=xelatex --standalone 
> >   --output=mwe-latex.tex mwe-latex.md 
> >   and examining line 49 of the output file it becomes apparent that this 
> >   line from the header inclusion: 
> >   \let\oldsection\section 
> >   has been munged by pandoc to: 
> >   \let\oldsection\textbackslash{}section 
> >   and this is causing the processing problem. (Note: changing latex 
> >   engines makes no difference.) 
> >   Once line 49 is edited to resemble the original command from the 
> header 
> >   inclusion the error disappears. 
> >   How can I prevent this latex command in the header inclusion from 
> being 
> >   munged by pandoc? 
> > 
> >   -- 
> >   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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To post to this group, send email to 
> >   [2]pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> >   To view this discussion on the web visit 
> >   [3]
> https://groups.google.com/d/msgid/pandoc-discuss/85d3801f-6a20-4873- 
> >   bf2e-e8cd7f13445e%40googlegroups.com. 
> >   For more options, visit [4]https://groups.google.com/d/optout. 
> > 
> >References 
> > 
> >   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   2. mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> 
> >   3. 
> https://groups.google.com/d/msgid/pandoc-discuss/85d3801f-6a20-4873-bf2e-e8cd7f13445e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer 
> >   4. 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/c39d6355-1b71-4355-813f-5e85a1beb988%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Latex command in header inclusion munged with \textbackslash{}
       [not found]         ` <1cef78af-0bfb-4d45-983b-39863c588bb6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-08-09 17:54           ` Roland Hieber
       [not found]             ` <6dc05b9e-b1fd-cf4c-6d6b-8b6adb9a1df0-NSJBNaQhiPN7tPAFqOLdPg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Roland Hieber @ 2017-08-09 17:54 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 08.08.2017 15:56, David Nebauer wrote:
> Can't install dev pandoc because the ghc archive downloaded as part of
> the process is corrupt.

You could try installing one of the nightlies from
https://github.com/pandoc-extras/pandoc-nightly instead.

 - Roland


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

* Re: Latex command in header inclusion munged with \textbackslash{}
       [not found]         ` <c39d6355-1b71-4355-813f-5e85a1beb988-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-08-09 19:33           ` BP Jonsson
       [not found]             ` <eca11bcc-3eeb-a426-dcb6-7a70d4b411e4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: BP Jonsson @ 2017-08-09 19:33 UTC (permalink / raw)
  To: David Nebauer, pandoc-discuss

Den 2017-08-08 kl. 16:02, skrev David Nebauer:
> Not sure of the relevance of issue 2956, which is about pandoc not 
> recognising options in parentheses. There are no parentheses in 
> the problematic header inclusion.

Pandoc will mangle sundry other things as well including, 
sometimes, curlies which it things are not argument delimiters.
I've tried in vain to see a pattern in that. The workaround John 
mentioned (the dummy command) works in all these cases (or at 
least all cases I've come up against as yet!)

/bpj


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

* Re: Latex command in header inclusion munged with \textbackslash{}
       [not found]             ` <eca11bcc-3eeb-a426-dcb6-7a70d4b411e4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-08-09 19:36               ` BP Jonsson
  0 siblings, 0 replies; 8+ messages in thread
From: BP Jonsson @ 2017-08-09 19:36 UTC (permalink / raw)
  To: David Nebauer, pandoc-discuss

Den 2017-08-09 kl. 21:33, skrev BP Jonsson:

I wrote:

> Pandoc will mangle sundry other things as well including, 
> sometimes, curlies which it things are not argument delimiters.
                      ^^^^^^^^^^^^^^^

Should be "which it thinks" of course!

/bpj


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

* Re: Latex command in header inclusion munged with \textbackslash{}
       [not found]             ` <6dc05b9e-b1fd-cf4c-6d6b-8b6adb9a1df0-NSJBNaQhiPN7tPAFqOLdPg@public.gmane.org>
@ 2017-08-10 11:10               ` David Nebauer
  0 siblings, 0 replies; 8+ messages in thread
From: David Nebauer @ 2017-08-10 11:10 UTC (permalink / raw)
  To: pandoc-discuss


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

Using a nightly worked. Here is a better minimal working example that shows 
the effect of the redefined command:

---
title: "Minimal Working Example"
header-includes:
- \let\oldsection\section
- \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
---

# Heading 1 #

Text 1.

# Heading 2 #

Text 2.

The command

pandoc -t latex --latex-engine=xelatex --output=mwe2.pdf mwe2.md

results in a pdf file with each heading on a new page. Producing latex 
output shows the header inclusions inserted without alteration - without 
needing the "backtick" notation John mentioned.

Guess I'm using a pandoc nightly until this behaviour migrates into 
debian/testing :-)

Thanks John, Roland and BP for chipping in to help me.

P.S. It's been ages since I used Google Groups. If there is any way to mark 
this post or thread "solved" please let me know and I will.

On Thursday, 10 August 2017 03:24:41 UTC+9:30, Roland Hieber wrote:
>
> On 08.08.2017 15:56, David Nebauer wrote: 
> > Can't install dev pandoc because the ghc archive downloaded as part of 
> > the process is corrupt. 
>
> You could try installing one of the nightlies from 
> https://github.com/pandoc-extras/pandoc-nightly instead. 
>
>  - Roland 
>

-- 
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/06c61ee7-a420-4787-b90f-dda37007ef07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

end of thread, other threads:[~2017-08-10 11:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07  7:39 Latex command in header inclusion munged with \textbackslash{} David Nebauer
     [not found] ` <85d3801f-6a20-4873-bf2e-e8cd7f13445e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-07 18:25   ` John MacFarlane
     [not found]     ` <20170807182546.GB91733-qqGlgsTyhTiCiGiXOSDXzGEIDr1rnHf9vtmmnBSr4lwnUAKC5xwfQhvRwXAb8BAkh13vi7wywA4@public.gmane.org>
2017-08-08 13:56       ` David Nebauer
     [not found]         ` <1cef78af-0bfb-4d45-983b-39863c588bb6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-09 17:54           ` Roland Hieber
     [not found]             ` <6dc05b9e-b1fd-cf4c-6d6b-8b6adb9a1df0-NSJBNaQhiPN7tPAFqOLdPg@public.gmane.org>
2017-08-10 11:10               ` David Nebauer
2017-08-08 14:02       ` David Nebauer
     [not found]         ` <c39d6355-1b71-4355-813f-5e85a1beb988-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-08-09 19:33           ` BP Jonsson
     [not found]             ` <eca11bcc-3eeb-a426-dcb6-7a70d4b411e4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-09 19:36               ` BP Jonsson

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