Conversion error in pandoc related to a line outside the source file

I am trying to convert a latex document to docx (hell, logs that do not accept latex or pdf messages) but get an error referring to a line outside the range of the original latex file (the file has 385 lines). I checked only instances of \\ (inside the table) and this seems unproblematic. The error also persists if the table is deleted. The latex source is compiled in pdf on MiKTeX.

The error occurs if I try to convert it to other formats, so this is not a problem for converting docx. It is hard to make a reproducible example, since I donโ€™t know which part of the code is causing the problem (since this refers to the line number outside the input file). Is the error message a reference to the pandoc source?

Command:

  pandoc -f latex article.tex -o article.docx 

Error message:

 pandoc.exe: Error: "source" (line 407, column 1): unexpected "\\" expecting white space, "%", new-line, "begin", letter, "*", "[", "}", "egroup", "endgroup", "{", "bgroup", "begingroup", "-", "``", "`", "'", "~", "$$", "$", "^", "_", "^^", "]", "#", "&", "\\" or " end" 

Any ideas on how to shoot shoot?

I don't know if this is suitable for Stackoverflow or http://tex.stackexchange.com , but there are more search queries for pandoc here.

Edit:

Now I found out that conversion works if the input file is moved to. /temp/input.tex and I'm really confused. Related files (.eps, .bib) were moved with it, and the files in both folders were renamed, so the old temporary files did not affect the tex conversion. There are no strange characters or spaces in the source folder. I am even more confused and annoyed. However, at least I can get the converted file.

+6
source share
1 answer

For a troubleshooting question, try putting \ end {document} in places in your document. If your problem is an element that can achieve its closing in latex but cannot be closed in pandoc, you can find an unclosed element by trimming the document in other places.

The following is not all of your error, but I was able to do a binary search and postpone a much longer error file using this idea \ end {document}.

 \documentclass{article} \usepackage{alltt} \begin{document} \begin{alltt} main <- {sprintf("x = %5.3f",3.1415926)} \end{alltt} \end{document} 
+3
source

Source: https://habr.com/ru/post/947735/


All Articles