public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Markdown to LaTeX: unwanted newlines around LaTeX environment
@ 2017-10-03 16:51 'SBJ' via pandoc-discuss
       [not found] ` <8729b9a5-1aff-4d3a-a17f-06d8a63beefa-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: 'SBJ' via pandoc-discuss @ 2017-10-03 16:51 UTC (permalink / raw)
  To: pandoc-discuss


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

It appears that the Markdown reader, as a rule, treats any unknown 
environment as block-level content (rather than inline). While this seems 
to be the desired behaviour, it has side effects when the output format is 
(newline-sensitive) LaTeX. This was previously reported here:

   - https://github.com/jgm/pandoc/issues/3309#issuecomment-284679731
   - 
   https://groups.google.com/forum/#!searchin/pandoc-discuss/latex$20environment|sort:relevance/pandoc-discuss/P3fV_0jw9-U/DUpSrWYxaAkJ
   
This affects users wanting to create LaTeX documents in a convenient 
fashion by first writing a Markdown file containing occasional LaTeX 
environments, then converting to LaTeX and feeding the resulting LaTeX into 
a pdflatex workflow. The extra newlines produced in this process affect the 
LaTeX parsing, leading to unwanted (and inconsistent) vertical space in the 
final document (see simple example below).

Is there a way to make Pandoc omit the newlines?

$ cat test.md
Testing environment
\begin{equation}
    i^2=-1
\end{equation}
for whitespace.
$ pandoc -f markdown -t latex -o test.tex test.md
$ cat test.tex
Testing environment

\begin{equation}
    i^2=-1
\end{equation}

for whitespace.
$ pandoc --version
pandoc 1.19.2.4
Compiled with pandoc-types 1.17.0.5, texmath 0.9.4.2, skylighting 0.1.1.5
[...]

-- 
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/8729b9a5-1aff-4d3a-a17f-06d8a63beefa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Markdown to LaTeX: unwanted newlines around LaTeX environment
       [not found] ` <8729b9a5-1aff-4d3a-a17f-06d8a63beefa-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-10-03 20:43   ` John MACFARLANE
  2017-10-04 12:35     ` 'SBJ' via pandoc-discuss
  0 siblings, 1 reply; 4+ messages in thread
From: John MACFARLANE @ 2017-10-03 20:43 UTC (permalink / raw)
  To: 'SBJ' via pandoc-discuss

The dev version of pandoc will not give you a blank line
in this case -- it knows that equation environments can
occur inline.

+++ 'SBJ' via pandoc-discuss [Oct 03 17 09:51 ]:
>   It appears that the Markdown reader, as a rule, treats any unknown
>   environment as block-level content (rather than inline). While this
>   seems to be the desired behaviour, it has side effects when the output
>   format is (newline-sensitive) LaTeX. This was previously reported here:
>     * [1]https://github.com/jgm/pandoc/issues/3309#issuecomment-284679731
>     * [2]https://groups.google.com/forum/#!searchin/pandoc-discuss/latex$
>       20environment|sort:relevance/pandoc-discuss/P3fV_0jw9-U/DUpSrWYxaAk
>       J
>
>   This affects users wanting to create LaTeX documents in a convenient
>   fashion by first writing a Markdown file containing occasional LaTeX
>   environments, then converting to LaTeX and feeding the resulting LaTeX
>   into a pdflatex workflow. The extra newlines produced in this process
>   affect the LaTeX parsing, leading to unwanted (and inconsistent)
>   vertical space in the final document (see simple example below).
>   Is there a way to make Pandoc omit the newlines?
>   $ cat test.md
>   Testing environment
>   \begin{equation}
>       i^2=-1
>   \end{equation}
>   for whitespace.
>   $ pandoc -f markdown -t latex -o test.tex test.md
>   $ cat test.tex
>   Testing environment
>   \begin{equation}
>       i^2=-1
>   \end{equation}
>   for whitespace.
>   $ pandoc --version
>   pandoc 1.19.2.4
>   Compiled with pandoc-types 1.17.0.5, texmath 0.9.4.2, skylighting
>   0.1.1.5
>   [...]
>
>   --
>   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 [3]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [4]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [5]https://groups.google.com/d/msgid/pandoc-discuss/8729b9a5-1aff-4d3a-
>   a17f-06d8a63beefa%40googlegroups.com.
>   For more options, visit [6]https://groups.google.com/d/optout.
>
>References
>
>   1. https://github.com/jgm/pandoc/issues/3309#issuecomment-284679731
>   2. https://groups.google.com/forum/#!searchin/pandoc-discuss/latex$20environment|sort:relevance/pandoc-discuss/P3fV_0jw9-U/DUpSrWYxaAkJ
>   3. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   4. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   5. https://groups.google.com/d/msgid/pandoc-discuss/8729b9a5-1aff-4d3a-a17f-06d8a63beefa-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   6. https://groups.google.com/d/optout


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

* Re: Markdown to LaTeX: unwanted newlines around LaTeX environment
  2017-10-03 20:43   ` John MACFARLANE
@ 2017-10-04 12:35     ` 'SBJ' via pandoc-discuss
       [not found]       ` <bdbfaa4e-8889-4eec-9831-9901eb39e20f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: 'SBJ' via pandoc-discuss @ 2017-10-04 12:35 UTC (permalink / raw)
  To: pandoc-discuss


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

Many thanks!

I can confirm that Pandoc 2.0 (dev) renders this without the additional 
newlines, as shown below. Note, however, that there are now *two* 
linebreaks fewer before and after the environment, respectively (compared 
to the old output), so that the entire environment is now inlined with the 
rest of the LaTeX source. pdflatex does not seem to take issue with this 
and renders it correctly, but I wanted to point it out nevertheless. Note 
also: inserting an extra newline before and after in the Markdown source 
would result in *two* extra linebreaks before and after, i.e. the old 
(undesired) behaviour.

Also, thank you for developing Pandoc. Besides being conceptually 
interesting, I find it incredibly useful for my day-to-day work.

Testing environment \begin{align}
    i^2&=-1\\
    x &= 0
\end{align} for whitespace.


On Tuesday, 3 October 2017 22:43:32 UTC+2, John MacFarlane wrote:
>
> The dev version of pandoc will not give you a blank line 
> in this case -- it knows that equation environments can 
> occur inline. 
>

-- 
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/bdbfaa4e-8889-4eec-9831-9901eb39e20f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Markdown to LaTeX: unwanted newlines around LaTeX environment
       [not found]       ` <bdbfaa4e-8889-4eec-9831-9901eb39e20f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-10-04 17:24         ` John MACFARLANE
  0 siblings, 0 replies; 4+ messages in thread
From: John MACFARLANE @ 2017-10-04 17:24 UTC (permalink / raw)
  To: 'SBJ' via pandoc-discuss

+++ 'SBJ' via pandoc-discuss [Oct 04 17 05:35 ]:
>   I can confirm that Pandoc 2.0 (dev) renders this without the additional
>   newlines, as shown below. Note, however, that there are now two
>   linebreaks fewer before and after the environment, respectively
>   (compared to the old output), so that the entire environment is now
>   inlined with the rest of the LaTeX source. pdflatex does not seem to
>   take issue with this and renders it correctly, but I wanted to point it
>   out nevertheless.

Yes, I'm aware of this, but it's not a problem; the latex is valid.

>   Also, thank you for developing Pandoc. Besides being conceptually
>   interesting, I find it incredibly useful for my day-to-day work.

You're welcome!


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

end of thread, other threads:[~2017-10-04 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 16:51 Markdown to LaTeX: unwanted newlines around LaTeX environment 'SBJ' via pandoc-discuss
     [not found] ` <8729b9a5-1aff-4d3a-a17f-06d8a63beefa-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-10-03 20:43   ` John MACFARLANE
2017-10-04 12:35     ` 'SBJ' via pandoc-discuss
     [not found]       ` <bdbfaa4e-8889-4eec-9831-9901eb39e20f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-10-04 17:24         ` 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).