jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.88k stars 3.34k forks source link

Unexpected end of input when converting Latex #443

Closed devn closed 12 years ago

devn commented 12 years ago

I am trying to convert https://github.com/fogus/clojure-cheatsheets/blob/master/src/cljs-cheatsheet.tex (latex) to markdown.

I receive the following error:

clojure-cheatsheets/src/master ☣(solo)> pandoc -o cheatsheet.markdown cljs-cheatsheet.tex
pandoc: 
Error:
"source" (line 244, column 1):
unexpected end of input
expecting "\\"

I am running OSX 10.7.3. pandoc --version reports:

pandoc 1.9.1.1
Compiled with citeproc-hs 0.3.4, texmath 0.6.0.3, highlighting-kate 0.5.0.2.
Syntax highlighting is supported for the following languages:
    Actionscript, Ada, Alert, Alert_indent, Apache, Asn1, Asp, Awk, Bash,
    Bibtex, Boo, C, Changelog, Clojure, Cmake, Coffeescript, Coldfusion,
    Commonlisp, Cpp, Cs, Css, D, Diff, Djangotemplate, Doxygen, Dtd, Eiffel,
    Email, Erlang, Fortran, Fsharp, Gnuassembler, Go, Haskell, Haxe, Html, Ini,
    Java, Javadoc, Javascript, Json, Jsp, Latex, Lex, LiterateHaskell, Lua,
    Makefile, Mandoc, Matlab, Maxima, Metafont, Mips, Modula2, Modula3,
    Monobasic, Nasm, Noweb, Objectivec, Objectivecpp, Ocaml, Octave, Pascal,
    Perl, Php, Pike, Postscript, Prolog, Python, R, Relaxngcompact, Rhtml, Ruby,
    Scala, Scheme, Sci, Sed, Sgml, Sql, SqlMysql, SqlPostgresql, Tcl, Texinfo,
    Verilog, Vhdl, Xml, Xorg, Xslt, Xul, Yacc, Yaml
Copyright (C) 2006-2012 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.
jgm commented 12 years ago

This bit seems to cause the problem:

\begin{lstlisting}[label=ns,caption=Example Namespace Declaration](ns my-cool-lib %28:require [some-lib :as lib]%29 %28:use [another-lib :only %28a-func%29]%29 %28:require-macros [my.macros :as macs]%29 %28:use-macros [mo.macs :only %28my-mac%29]%29) \end{lstlisting}

+++ Devin Walters [Mar 10 12 11:04 ]:

I am trying to convert https://github.com/fogus/clojure-cheatsheets/blob/master/src/cljs-cheatsheet.tex (latex) to markdown.

I receive the following error:

clojure-cheatsheets/src/master ☣(solo)> pandoc -o cheatsheet.markdown cljs-cheatsheet.tex
pandoc: 
Error:
"source" (line 244, column 1):
unexpected end of input
expecting "\\"

I am running OSX 10.7.3. pandoc --version reports:

pandoc 1.9.1.1
Compiled with citeproc-hs 0.3.4, texmath 0.6.0.3, highlighting-kate 0.5.0.2.
Syntax highlighting is supported for the following languages:
    Actionscript, Ada, Alert, Alert_indent, Apache, Asn1, Asp, Awk, Bash,
    Bibtex, Boo, C, Changelog, Clojure, Cmake, Coffeescript, Coldfusion,
    Commonlisp, Cpp, Cs, Css, D, Diff, Djangotemplate, Doxygen, Dtd, Eiffel,
    Email, Erlang, Fortran, Fsharp, Gnuassembler, Go, Haskell, Haxe, Html, Ini,
    Java, Javadoc, Javascript, Json, Jsp, Latex, Lex, LiterateHaskell, Lua,
    Makefile, Mandoc, Matlab, Maxima, Metafont, Mips, Modula2, Modula3,
    Monobasic, Nasm, Noweb, Objectivec, Objectivecpp, Ocaml, Octave, Pascal,
    Perl, Php, Pike, Postscript, Prolog, Python, R, Relaxngcompact, Rhtml, Ruby,
    Scala, Scheme, Sci, Sed, Sgml, Sql, SqlMysql, SqlPostgresql, Tcl, Texinfo,
    Verilog, Vhdl, Xml, Xorg, Xslt, Xul, Yacc, Yaml
Copyright (C) 2006-2012 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.

Reply to this email directly or view it on GitHub: https://github.com/jgm/pandoc/issues/443

jgm commented 12 years ago

I found the bug (a typo in the source that prevented pandoc from correctly parsing lstlisting environments).

Unfortunately, pandoc won't be much help with this document. It has only limited support for LaTeX tables and does not yet support the tabularx environment. ALso, currently it applies LaTeX macros only in math.

devn commented 12 years ago

Without knowing a ton of Haskell (but knowing a bit about parsec), do you have a guess at whether this is a few hours of work, or a couple of days, a week to support tabularx?

What about handling other latex macros outside of math?

Thanks,

On Saturday, March 10, 2012 at 2:35 PM, John MacFarlane wrote:

I found the bug (a typo in the source that prevented pandoc from correctly parsing lstlisting environments).

Unfortunately, pandoc won't be much help with this document. It has only limited support for LaTeX tables and does not yet support the tabularx environment. ALso, currently it applies LaTeX macros only in math.


Reply to this email directly or view it on GitHub: https://github.com/jgm/pandoc/issues/443#issuecomment-4434133

jgm commented 12 years ago

+++ Devin Walters [Mar 10 12 14:45 ]:

Without knowing a ton of Haskell (but knowing a bit about parsec), do you have a guess at whether this is a few hours of work, or a couple of days, a week to support tabularx?

To provide minimal support, so that tabularx is recognized as a table, and treated 'X' just like 'l', would be ten minutes.

To provide better support for the 'X', one would have to deal with column widths, and that's a much more complicated ball of wax.

What about handling other latex macros outside of math?

Right now I use the latex macro handling code from texmath. It's possible that the same functions could be used for non-math contexts, but I haven't looked into it.