jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.36k stars 3.37k forks source link

2.8.0.1 latex -> markdown (all flavors) - blockquotes inconsistent rendering #5976

Closed joshbruce closed 4 years ago

joshbruce commented 4 years ago

Sorry if duplicate.

1. The following is from the Try Pandoc page:

Screen Shot 2019-12-09 at 10 44 43 AM

The following is the command + version information from pandoc installed on macOS Catalina:

pandoc -s HomelessNotHopeless.tex --wrap=none --reference-links -t markdown -o HomelessNotHopeless.md

Screen Shot 2019-12-09 at 10 45 08 AM

2. This is the result of that same text:

Screen Shot 2019-12-09 at 10 50 31 AM

2.1 Oddly enough, the next quote in that same document rendered like this (more like a table):

Screen Shot 2019-12-09 at 10 51 47 AM

All escaped right angle brackets (">") can be ignored as I'm experimenting with the conversions to make sure they will work with for my purposes and were put there are on purpose.

jgm commented 4 years ago

I'm not sure I understand the report. Here's what I get:

% pandoc -f latex -t markdown --wrap=none --reference-links -s
\begin{quote}
Fair warning, etc.
No emotional backing, etc.
\end{quote}
^D
> Fair warning, etc. No emotional backing, etc.

That looks fine. Do you get something different?

joshbruce commented 4 years ago

Hello!

I added numbered headers.

2 and 2.1 are what I get - consistently for some reason. No markdown flavor actually works for me.

I’m not sure what other variables are at play and I don’t enough of how pandora works under the hood to be too hands-on helpful.

jgm commented 4 years ago

Well, I can't reproduce this, so unless you can give us more to work with, we'll have to close this issue. Looks like you're getting a table for some reason.

Instead of screenshots, it would be helpful if you'd include the exact content of your input (as minimal as possible), as text.

joshbruce commented 4 years ago

Sure thing, sorry, was in a rush...

macOS: 10.15.1

pandoc:

pandoc 2.8.0.1
Compiled with pandoc-types 1.20, texmath 0.12, skylighting 0.8.3

File output is from https://www.authorea.com/ exported as Latex - .tex - file with the following contents (I don't know raw Latex):

\documentclass[10pt]{article}

\usepackage{fullpage}
\usepackage{setspace}
\usepackage{parskip}
\usepackage{titlesec}
\usepackage[section]{placeins}
\usepackage{xcolor}
\usepackage{breakcites}
\usepackage{lineno}

\PassOptionsToPackage{hyphens}{url}
\usepackage[colorlinks = true,
            linkcolor = blue,
            urlcolor  = blue,
            citecolor = blue,
            anchorcolor = blue]{hyperref}
\usepackage{etoolbox}
\makeatletter
\patchcmd\@combinedblfloats{\box\@outputbox}{\unvbox\@outputbox}{}{%
  \errmessage{\noexpand\@combinedblfloats could not be patched}%
}%
\makeatother

\usepackage{natbib}

\renewenvironment{abstract}
  {{\bfseries\noindent{\abstractname}\par\nobreak}\footnotesize}
  {\bigskip}

\renewenvironment{quote}
  {\begin{tabular}{|p{13cm}}}
  {\end{tabular}}

\titlespacing{\section}{0pt}{*3}{*1}
\titlespacing{\subsection}{0pt}{*2}{*0.5}
\titlespacing{\subsubsection}{0pt}{*1.5}{0pt}

\usepackage{authblk}

\usepackage{graphicx}
\usepackage[space]{grffile}
\usepackage{latexsym}
\usepackage{textcomp}
\usepackage{longtable}
\usepackage{tabulary}
\usepackage{booktabs,array,multirow}
\usepackage{amsfonts,amsmath,amssymb}
\providecommand\citet{\cite}
\providecommand\citep{\cite}
\providecommand\citealt{\cite}
% You can conditionalize code for latexml or normal latex using this.
\newif\iflatexml\latexmlfalse
\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}%

\AtBeginDocument{\DeclareGraphicsExtensions{.pdf,.PDF,.eps,.EPS,.png,.PNG,.tif,.TIF,.jpg,.JPG,.jpeg,.JPEG}}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{float}

\begin{document}

\title{Title}

\author[1]{Josh Bruce}%
\affil[1]{Affiliation not available}%

\vspace{-1em}

  \date{\today}

\begingroup
\let\center\flushleft
\let\endcenter\endflushleft
\maketitle
\endgroup

\begin{quote}
Type something here.
\end{quote}

\selectlanguage{english}
\FloatBarrier
\end{document}

Terminal command run:

pandoc -s pandoc-test.tex --wrap=none --reference-links -t markdown -o pandoc-test.md

Output generated:

---
author:
- Josh Bruce
title: Title
---

  ----------------------
  Type something here.
  ----------------------

See also the attached.

Note: If there are two block quotes, all others but the first render as a table.

pandoc-test.zip

jgm commented 4 years ago

Notice that the preamble contains

\renewenvironment{quote}
  {\begin{tabular}{|p{13cm}}}
  {\end{tabular}}

What this does is redefine the quote environment so that it produces a table. And that's why pandoc is giving you a table as output -- correctly!

joshbruce commented 4 years ago

Sweet!

Thanks, removing that setting made it so, which means I can do it programmatically as well. (Also gonna reach out to Authorea and ask why that's a thing.)