public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Superscripts not working in raw latex environments?
@ 2016-04-05 14:52 Mohammed Haris Minai
       [not found] ` <4cf8c441-bd79-423e-8f97-806a9814724b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Mohammed Haris Minai @ 2016-04-05 14:52 UTC (permalink / raw)
  To: pandoc-discuss


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

Here is what I tried:

Without superscript:

> $ pandoc -f markdown -t native
\begin{tabular}
1 & 2 \\
2 & 3 \\
\end{tabular}
^D
[RawBlock (Format "latex") "\\begin{tabular}\n1 & 2 \\\\\n2 & 3 
\\\\\n\\end{tabular}"]

With superscript:

> $ pandoc -f markdown -t native
\begin{tabular}
1 & 2^2 \\
2 & 3 \\
\end{tabular}
^D
[Para [Str "\\begin{tabular}",SoftBreak,Str "1",Space,Str "&",Space,Str 
"2^2",Space,Str "\\",SoftBreak,Str "2",Space,Str "&",Space,Str 
"3",Space,Str "\\",SoftBreak,Str "\\end{tabular}"]]

I was expecting a RawBlock (format "latex") for the second invocation as 
well. What am I doing wrong?

-- 
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/4cf8c441-bd79-423e-8f97-806a9814724b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Superscripts not working in raw latex environments?
       [not found] ` <4cf8c441-bd79-423e-8f97-806a9814724b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2016-04-05 16:43   ` John MACFARLANE
       [not found]     ` <20160405164343.GB14034-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: John MACFARLANE @ 2016-04-05 16:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

`2^2` isn't legal LaTeX outside of math mode.  Try `$2^2$`.

+++ Mohammed Haris Minai [Apr 05 16 07:52 ]:
>   Here is what I tried:
>   Without superscript:
>   > $ pandoc -f markdown -t native
>   \begin{tabular}
>   1 & 2 \\
>   2 & 3 \\
>   \end{tabular}
>   ^D
>   [RawBlock (Format "latex") "\\begin{tabular}\n1 & 2 \\\\\n2 & 3
>   \\\\\n\\end{tabular}"]
>   With superscript:
>   > $ pandoc -f markdown -t native
>   \begin{tabular}
>   1 & 2^2 \\
>   2 & 3 \\
>   \end{tabular}
>   ^D
>   [Para [Str "\\begin{tabular}",SoftBreak,Str "1",Space,Str "&",Space,Str
>   "2^2",Space,Str "\\",SoftBreak,Str "2",Space,Str "&",Space,Str
>   "3",Space,Str "\\",SoftBreak,Str "\\end{tabular}"]]
>   I was expecting a RawBlock (format "latex") for the second invocation
>   as well. What am I doing wrong?
>
>   --
>   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/4cf8c441-bd79-423e-
>   8f97-806a9814724b%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/4cf8c441-bd79-423e-8f97-806a9814724b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


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

* Re: Superscripts not working in raw latex environments?
       [not found]     ` <20160405164343.GB14034-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
@ 2016-04-06 12:48       ` Mohammed Haris Minai
       [not found]         ` <e808f198-ca65-472f-86ea-5e72d172a0bb-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Mohammed Haris Minai @ 2016-04-06 12:48 UTC (permalink / raw)
  To: pandoc-discuss


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

Thanks.

I can confirm that enclosing in '$' works. In fact using 
\textsuperscript{2} also works in text mode.

> $ pandoc -f markdown -t native
\begin{tabular}
1 & $2^2$ \\
2 & 3 \\
\end{tabular}
^D
[RawBlock (Format "latex") "\\begin{tabular}\n1 & $2^2$ \\\\\n2 & 3 
\\\\\n\\end{tabular}"]

> $ pandoc -f markdown -t native
\begin{tabular}
1 & 2\textsuperscript{2} \\
2 & 3 \\
\end{tabular}
^D
[RawBlock (Format "latex") "\\begin{tabular}\n1 & 2\\textsuperscript{2} 
\\\\\n2 & 3 \\\\\n\\end{tabular}"]

On Tuesday, April 5, 2016 at 10:13:57 PM UTC+5:30, John MacFarlane wrote:
>
> `2^2` isn't legal LaTeX outside of math mode.  Try `$2^2$`. 
>
> +++ Mohammed Haris Minai [Apr 05 16 07:52 ]: 
> >   Here is what I tried: 
> >   Without superscript: 
> >   > $ pandoc -f markdown -t native 
> >   \begin{tabular} 
> >   1 & 2 \\ 
> >   2 & 3 \\ 
> >   \end{tabular} 
> >   ^D 
> >   [RawBlock (Format "latex") "\\begin{tabular}\n1 & 2 \\\\\n2 & 3 
> >   \\\\\n\\end{tabular}"] 
> >   With superscript: 
> >   > $ pandoc -f markdown -t native 
> >   \begin{tabular} 
> >   1 & 2^2 \\ 
> >   2 & 3 \\ 
> >   \end{tabular} 
> >   ^D 
> >   [Para [Str "\\begin{tabular}",SoftBreak,Str "1",Space,Str 
> "&",Space,Str 
> >   "2^2",Space,Str "\\",SoftBreak,Str "2",Space,Str "&",Space,Str 
> >   "3",Space,Str "\\",SoftBreak,Str "\\end{tabular}"]] 
> >   I was expecting a RawBlock (format "latex") for the second invocation 
> >   as well. What am I doing wrong? 
> > 
> >   --  
>
>

-- 
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/e808f198-ca65-472f-86ea-5e72d172a0bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Superscripts not working in raw latex environments?
       [not found]         ` <e808f198-ca65-472f-86ea-5e72d172a0bb-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2016-04-06 13:05           ` Melroch
       [not found]             ` <CADAJKhCtGJ_h_az=YR6Euq_skOcYdveETQyQi+JSTs4=Nyb+bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Melroch @ 2016-04-06 13:05 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I find it surprising that pandoc parses/validates the contents of an
environment block since it turns it into a raw block anyway. How come? It
seems rather wasteful since the *TeX engine will complain if it's invalid,
and why would you include a LaTeX environment unless you are going to
convert the document LaTeX and compile it?

/bpj
Den 6 apr 2016 14:49 skrev "Mohammed Haris Minai" <mhminai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:

> Thanks.
>
> I can confirm that enclosing in '$' works. In fact using
> \textsuperscript{2} also works in text mode.
>
> > $ pandoc -f markdown -t native
> \begin{tabular}
> 1 & $2^2$ \\
> 2 & 3 \\
> \end{tabular}
> ^D
> [RawBlock (Format "latex") "\\begin{tabular}\n1 & $2^2$ \\\\\n2 & 3
> \\\\\n\\end{tabular}"]
>
> > $ pandoc -f markdown -t native
> \begin{tabular}
> 1 & 2\textsuperscript{2} \\
> 2 & 3 \\
> \end{tabular}
> ^D
> [RawBlock (Format "latex") "\\begin{tabular}\n1 & 2\\textsuperscript{2}
> \\\\\n2 & 3 \\\\\n\\end{tabular}"]
>
> On Tuesday, April 5, 2016 at 10:13:57 PM UTC+5:30, John MacFarlane wrote:
>>
>> `2^2` isn't legal LaTeX outside of math mode.  Try `$2^2$`.
>>
>> +++ Mohammed Haris Minai [Apr 05 16 07:52 ]:
>> >   Here is what I tried:
>> >   Without superscript:
>> >   > $ pandoc -f markdown -t native
>> >   \begin{tabular}
>> >   1 & 2 \\
>> >   2 & 3 \\
>> >   \end{tabular}
>> >   ^D
>> >   [RawBlock (Format "latex") "\\begin{tabular}\n1 & 2 \\\\\n2 & 3
>> >   \\\\\n\\end{tabular}"]
>> >   With superscript:
>> >   > $ pandoc -f markdown -t native
>> >   \begin{tabular}
>> >   1 & 2^2 \\
>> >   2 & 3 \\
>> >   \end{tabular}
>> >   ^D
>> >   [Para [Str "\\begin{tabular}",SoftBreak,Str "1",Space,Str
>> "&",Space,Str
>> >   "2^2",Space,Str "\\",SoftBreak,Str "2",Space,Str "&",Space,Str
>> >   "3",Space,Str "\\",SoftBreak,Str "\\end{tabular}"]]
>> >   I was expecting a RawBlock (format "latex") for the second invocation
>> >   as well. What am I doing wrong?
>> >
>> >   --
>>
>> --
> 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/e808f198-ca65-472f-86ea-5e72d172a0bb%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/e808f198-ca65-472f-86ea-5e72d172a0bb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CADAJKhCtGJ_h_az%3DYR6Euq_skOcYdveETQyQi%2BJSTs4%3DNyb%2BbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Superscripts not working in raw latex environments?
       [not found]             ` <CADAJKhCtGJ_h_az=YR6Euq_skOcYdveETQyQi+JSTs4=Nyb+bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-04-06 18:24               ` John MACFARLANE
       [not found]                 ` <20160406182422.GA5843-4kKid1p5UN5kRMcaKpzQXBvRwXAb8BAkh13vi7wywA4@public.gmane.org>
  2016-04-06 21:13                 ` Ulrike Fischer
  0 siblings, 2 replies; 12+ messages in thread
From: John MACFARLANE @ 2016-04-06 18:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ Melroch [Apr 06 16 15:05 ]:
>   I find it surprising that pandoc parses/validates the contents of an
>   environment block since it turns it into a raw block anyway. How come?
>   It seems rather wasteful since the *TeX engine will complain if it's
>   invalid, and why would you include a LaTeX environment unless you are
>   going to convert the document LaTeX and compile it?

We're re-using environment parsing code from the LaTeX
reader.  And this, of course, does need to parse the
contents.  It's a bit wasteful but code reuse is good.


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

* Re: Superscripts not working in raw latex environments?
       [not found]                 ` <20160406182422.GA5843-4kKid1p5UN5kRMcaKpzQXBvRwXAb8BAkh13vi7wywA4@public.gmane.org>
@ 2016-04-06 18:31                   ` BPJ
  0 siblings, 0 replies; 12+ messages in thread
From: BPJ @ 2016-04-06 18:31 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Yes code reuse is good, of course.

onsdag 6 april 2016 skrev John MACFARLANE <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:

> +++ Melroch [Apr 06 16 15:05 ]:
>
>>   I find it surprising that pandoc parses/validates the contents of an
>>   environment block since it turns it into a raw block anyway. How come?
>>   It seems rather wasteful since the *TeX engine will complain if it's
>>   invalid, and why would you include a LaTeX environment unless you are
>>   going to convert the document LaTeX and compile it?
>>
>
> We're re-using environment parsing code from the LaTeX
> reader.  And this, of course, does need to parse the
> contents.  It's a bit wasteful but code reuse is good.
>
> --
> 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/20160406182422.GA5843%40D25Q40BGFY13.berkeley.edu
> .
> 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/CADAJKhDgpXNqMakAWoHVnQmtOkPXpaT4RPU5q44ibt2zxvoS-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Superscripts not working in raw latex environments?
  2016-04-06 18:24               ` John MACFARLANE
       [not found]                 ` <20160406182422.GA5843-4kKid1p5UN5kRMcaKpzQXBvRwXAb8BAkh13vi7wywA4@public.gmane.org>
@ 2016-04-06 21:13                 ` Ulrike Fischer
       [not found]                   ` <ntnncn1lr2us.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Ulrike Fischer @ 2016-04-06 21:13 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Am Wed, 6 Apr 2016 11:24:22 -0700 schrieb John MACFARLANE:

>>   It seems rather wasteful since the *TeX engine will complain if it's
>>   invalid, and why would you include a LaTeX environment unless you are
>>   going to convert the document LaTeX and compile it?
> 
> We're re-using environment parsing code from the LaTeX
> reader.  And this, of course, does need to parse the
> contents.  It's a bit wasteful but code reuse is good.


I'm not sure. You are assuming that the raw latex is more or less
"normal" latex. But actually you can't know the catcode of ^ or if
the ^ is really used outside math. E.g with a suitable definition of
the d column type this is a valid input: 
\begin{tabular}{d}
2^2
\end{tabular}


-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/


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

* Re: Superscripts not working in raw latex environments?
       [not found]                   ` <ntnncn1lr2us.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
@ 2016-04-07 15:01                     ` BP Jonsson
  2016-04-07 15:19                       ` Ulrike Fischer
  0 siblings, 1 reply; 12+ messages in thread
From: BP Jonsson @ 2016-04-07 15:01 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Den 2016-04-06 kl. 23:13, skrev Ulrike Fischer:
> Am Wed, 6 Apr 2016 11:24:22 -0700 schrieb John MACFARLANE:
>
>>>    It seems rather wasteful since the *TeX engine will complain if it's
>>>    invalid, and why would you include a LaTeX environment unless you are
>>>    going to convert the document LaTeX and compile it?
>>
>> We're re-using environment parsing code from the LaTeX
>> reader.  And this, of course, does need to parse the
>> contents.  It's a bit wasteful but code reuse is good.
>
>
> I'm not sure. You are assuming that the raw latex is more or less
> "normal" latex. But actually you can't know the catcode of ^ or if
> the ^ is really used outside math. E.g with a suitable definition of
> the d column type this is a valid input:
> \begin{tabular}{d}
> 2^2
> \end{tabular}

But if you are going to take such things into account only *TeX 
can parse *TeX, no?  It is reasonable for another parser to assume 
some defaults.  There are indeed some LaTeX which pandoc parses 
wrongly even with defaults assumed -- notably square bracket 
arguments after curly bracket arguments -- but such can be worked 
around with wrapper commands, the simplest and most general being

````latex
\newcommand{\wrap}[1]{#1}
\newenvironment{wrap}{}{}
````

These 'hide' most things which the markdown reader would misparse, 
but as we now have learned the latex reader must be able to parse it.

A hack which I frequently use to be able to use Markdown inside 
environments is to define synonyms for `\begin` and `\end`:

````latex
\let\Begin\begin
\let\End\end
````

which essentially hides the environment from pandoc since it sees 
`\Begin{foo}` or `\End{foo}` as another inline command.  Provided 
that I put those hidden begin/end in their own 'paragraphs' this 
works as intended, since with those lets in place LaTeX unlike 
pandoc will see an environment.
However those let commands are misparsed by pandoc so they have to 
be wrapped:

````
\let\Begin\textbackslash{}begin \let\End\textbackslash{}end
````


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

* Re: Superscripts not working in raw latex environments?
  2016-04-07 15:01                     ` BP Jonsson
@ 2016-04-07 15:19                       ` Ulrike Fischer
       [not found]                         ` <1v8nanx5svtxm.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Ulrike Fischer @ 2016-04-07 15:19 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Am Thu, 7 Apr 2016 17:01:16 +0200 schrieb BP Jonsson:

>> I'm not sure. You are assuming that the raw latex is more or less
>> "normal" latex. But actually you can't know the catcode of ^ or if
>> the ^ is really used outside math. E.g with a suitable definition of
>> the d column type this is a valid input:
>> \begin{tabular}{d}
>> 2^2
>> \end{tabular}


> But if you are going to take such things into account only *TeX 
> can parse *TeX, no? 

Sure. But the question was about raw latex which is normally parsed
only by latex. 

-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/


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

* Re: Superscripts not working in raw latex environments?
       [not found]                         ` <1v8nanx5svtxm.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
@ 2016-04-07 18:52                           ` BP Jonsson
  2016-04-08  7:21                             ` Ulrike Fischer
  0 siblings, 1 reply; 12+ messages in thread
From: BP Jonsson @ 2016-04-07 18:52 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Den 2016-04-07 kl. 17:19, skrev Ulrike Fischer:
> Am Thu, 7 Apr 2016 17:01:16 +0200 schrieb BP Jonsson:
>
>>> I'm not sure. You are assuming that the raw latex is more or less
>>> "normal" latex. But actually you can't know the catcode of ^ or if
>>> the ^ is really used outside math. E.g with a suitable definition of
>>> the d column type this is a valid input:
>>> \begin{tabular}{d}
>>> 2^2
>>> \end{tabular}
>
>
>> But if you are going to take such things into account only *TeX
>> can parse *TeX, no?
>
> Sure. But the question was about raw latex which is normally parsed
> only by latex.
>

Right, so how *should* en environment block best be parsed to 
allow for (almost) arbitrary LaTeX redefinitions?  I guess that 
when the parser sees a `\begin{foo}` it should look for the next 
`\end{foo}` *but* keep track of any nested `\begin{...} ... 
\end{...}` lest there is an instance of the same environment 
("foo") nested inside the outer one.  I don't know off the top of 
my head if there are any standard environments which it would make 
sense to nest inside themselves, but there can always be custom 
ones where it makes sense; they may take different arguments for 
example.

/bpj


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

* Re: Superscripts not working in raw latex environments?
  2016-04-07 18:52                           ` BP Jonsson
@ 2016-04-08  7:21                             ` Ulrike Fischer
       [not found]                               ` <6hazl4u1ndmb$.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Ulrike Fischer @ 2016-04-08  7:21 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Am Thu, 7 Apr 2016 20:52:55 +0200 schrieb BP Jonsson:

>>> But if you are going to take such things into account only *TeX
>>> can parse *TeX, no?
>>
>> Sure. But the question was about raw latex which is normally parsed
>> only by latex.
>>
> 
> Right, so how *should* en environment block best be parsed to 
> allow for (almost) arbitrary LaTeX redefinitions?  

The original question was if pandoc should validate the content of
an raw latex and e.g. choke on 2^2 that is not in math. "Arbitrary"
redefinitions are a long way away. 

> I guess that 
> when the parser sees a `\begin{foo}` it should look for the next 
> `\end{foo}` *but* keep track of any nested `\begin{...} ... 
> \end{...}` lest there is an instance of the same environment 
> ("foo") nested inside the outer one.  I don't know off the top of 
> my head if there are any standard environments which it would make 
> sense to nest inside themselves,

Certainly there are. Lists like itemize e.g. It also make sense to
nest tabulars and minipage. But I would probably try to make it
easier for pandoc and put some unique dummy environment around the
whole code (could be a bit tricky if grouping is not wanted, but can
be managed). 


-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/


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

* Re: Superscripts not working in raw latex environments?
       [not found]                               ` <6hazl4u1ndmb$.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
@ 2016-04-08 11:22                                 ` BP Jonsson
  0 siblings, 0 replies; 12+ messages in thread
From: BP Jonsson @ 2016-04-08 11:22 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Den 2016-04-08 kl. 09:21, skrev Ulrike Fischer:
> Am Thu, 7 Apr 2016 20:52:55 +0200 schrieb BP Jonsson:
>
>>>> But if you are going to take such things into account only *TeX
>>>> can parse *TeX, no?
>>>
>>> Sure. But the question was about raw latex which is normally parsed
>>> only by latex.
>>>
>>
>> Right, so how *should* en environment block best be parsed to
>> allow for (almost) arbitrary LaTeX redefinitions?
>
> The original question was if pandoc should validate the content of
> an raw latex and e.g. choke on 2^2 that is not in math. "Arbitrary"
> redefinitions are a long way away.
>
>> I guess that
>> when the parser sees a `\begin{foo}` it should look for the next
>> `\end{foo}` *but* keep track of any nested `\begin{...} ...
>> \end{...}` lest there is an instance of the same environment
>> ("foo") nested inside the outer one.  I don't know off the top of
>> my head if there are any standard environments which it would make
>> sense to nest inside themselves,
>
> Certainly there are. Lists like itemize e.g. It also make sense to
> nest tabulars and minipage.

Of course. I don't know how I could forget itemize.

> But I would probably try to make it
> easier for pandoc and put some unique dummy environment around the
> whole code (could be a bit tricky if grouping is not wanted, but can
> be managed).

If you are going to hold pandoc's hand my code2raw filter can 
convert a code/codeblock with arbitrary content into a raw 
inline/block:

<https://gist.github.com/bpj/e6e53cbe679d3ec77e25>


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

end of thread, other threads:[~2016-04-08 11:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05 14:52 Superscripts not working in raw latex environments? Mohammed Haris Minai
     [not found] ` <4cf8c441-bd79-423e-8f97-806a9814724b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-04-05 16:43   ` John MACFARLANE
     [not found]     ` <20160405164343.GB14034-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
2016-04-06 12:48       ` Mohammed Haris Minai
     [not found]         ` <e808f198-ca65-472f-86ea-5e72d172a0bb-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-04-06 13:05           ` Melroch
     [not found]             ` <CADAJKhCtGJ_h_az=YR6Euq_skOcYdveETQyQi+JSTs4=Nyb+bQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-06 18:24               ` John MACFARLANE
     [not found]                 ` <20160406182422.GA5843-4kKid1p5UN5kRMcaKpzQXBvRwXAb8BAkh13vi7wywA4@public.gmane.org>
2016-04-06 18:31                   ` BPJ
2016-04-06 21:13                 ` Ulrike Fischer
     [not found]                   ` <ntnncn1lr2us.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
2016-04-07 15:01                     ` BP Jonsson
2016-04-07 15:19                       ` Ulrike Fischer
     [not found]                         ` <1v8nanx5svtxm.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
2016-04-07 18:52                           ` BP Jonsson
2016-04-08  7:21                             ` Ulrike Fischer
     [not found]                               ` <6hazl4u1ndmb$.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>
2016-04-08 11:22                                 ` 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).