kawabata / ox-pandoc

Another org-mode exporter via pandoc.
276 stars 46 forks source link

ox-pandoc inserts file: #8

Open stvharman opened 9 years ago

stvharman commented 9 years ago

export via pandoc inserts "file:" whenever there is a link to a file. For example

file:images/tree.jpg

This creates problems in an import to pelican and results in broken links. If this phrase is left out, then there is no problem.

When I try pandoc from command line, it does not insert "file:". Would it be possible to remove this behavior from ox-pandoc.

kawabata commented 9 years ago

Could you describe which format you tried to export? Also, could you show what line is appeared in "Message" buffer when export is done?

Something like

Running pandoc with args: (-f org -t markdown -o /Users/kawabata/test.md --parse-raw --mathjax --standalone /Users/hogehoge/test.tmp956MeQ.org)

should be appeared in "Message" buffer.

On Tue, Aug 25, 2015 at 6:39 AM, stvharman notifications@github.com wrote:

export via pandoc inserts "file:" whenever there is a link to a file. For example

file:images/tree.jpg

This creates problems in an import to pelican and results in broken links. If this phrase is left out, then there is no problem.

When I try pandoc from command line, it does not insert "file:". Would it be possible to remove this behavior from ox-pandoc.

— Reply to this email directly or view it on GitHub https://github.com/kawabata/ox-pandoc/issues/8.


川幡 太一 (KAWABATA, Taichi) E-mail: kawabata.taichi@gmail.com

stvharman commented 9 years ago

Thanks. Mine is exactly the same as you posted. The only difference is that I am exporting to html If I use ox-pandoc, I get

if I use pandoc from the command line, I get <img src="../images/figure.jpg" The second one is what I want.

sebhahn commented 9 years ago

I can confirm this error. I'm exporting from org to latex/pdf. Is there any workaround?

sebhahn commented 9 years ago

Is this problem coming from pandoc or ox-pandoc? Can we expect a fix soon?

kawabata commented 9 years ago

I could not grasp exactly what would be the problem.

The argument passwd to "pandoc" command is displayed to Messages buffer, so I think by reproducing the problem with standalone "pandoc" command with arguments, I think you could identify where the problem is.

If you execute the pandoc command by yourself and the problem is reproduced, then this is a problem of "pandoc" command.

If your desired command arguments and what "ox-pandoc" passed to "pandoc" command differ, then it may be a problem of "ox-pandoc".

In that case, please send me an ideal arguments that should be passed to "pandoc" command from "ox-pandoc", to see if it can be fixed.

Regards,

sebhahn commented 9 years ago

The error message is

l.106 \includegraphics{file:./images/test.png} pandoc: Could not find image file:./images/test.png', skipping... ! Package pdftex.def Error: File file:./images/test.png' not found.

but file: shouldn't be part of the path, guess it's coming from org-mode?

the image has been included with [[.//images/test.png]]

I'm I doing some wrong?

kawabata commented 9 years ago

I think that this part is not related to ox-pandoc. As I've test with simple file, I got the output of "\includegraphics{./test.png}" instead of "\includegraphics{file:./test.png}" where the original text is "[[./test.png]]".

Could you check the version of pandoc you are using? I'm currently using 1.13.2.

sebhahn commented 9 years ago

pandoc 1.15.1.1 org-mode 8.3.1

kawabata commented 9 years ago

I've updated to 1.15. When I convert the following text to latex format with `org-pandoc-export-to-latex',

#+TITLE: test
* head
this is [[img.png]] test.

then the output is as follows:

\begin{document}
\maketitle

\section{head}\label{head}

this is \includegraphics{img.png} test.

\end{document}

I still don't quite understand why "file:' is inserted. Could you try following command to see if it occurs without ox-pandoc?

pandoc -f org -t latex -o ~/test.tex --parse-raw --standalone ~/test.org
sebhahn commented 9 years ago

Suddenly it works and I don't know why...

Is it possible to add a caption to an image?

kawabata commented 9 years ago

something like this?

http://orgmode.org/manual/Images-and-tables.html

sebhahn commented 9 years ago

Ok, I had #+CAPTION: after the image, which didn't work.

How is it possible to cite the image: [@fig:name] doesn't seem to do the trick?

kawabata commented 9 years ago

It seems your problem concerns with the contents of org document, and that the problem is about "pandoc", but not "ox-pandoc". `ox-pandoc' is merely a wrapper of "pandoc" software, and it does not interfere with the contents (unless you specify preprocessor), including bibliographic citations.

Could you check to see if you couldn't reproduce the problem with plain "pandoc" command?

e.g.

pandoc -f org -t latex -o ~/test.tex --parse-raw --standalone ~/test.org

Regards,

sebhahn commented 9 years ago

Using the plain "pandoc" command I've found that

#+CAPTION: insert figure caption here #+NAME: fig:1 #+LABEL: fig:1 [[img.png]]

does create

\begin{figure}[htbp] \centering \includegraphics{img.png} \caption{insert figure caption here} \end{figure}

and the reference [@fig:1] gets correctly translated to fig.~\ref{fig:1} (using pandoc-citeproc), but it doesn't work because \label{fig:1} is missing in the Latex output? Where is the problem org-mode or pandoc?

edit: exporting with standard org-mode export to latex gives:

\caption{\label{fig:orgparagraph1} insert figure caption here}

still not the right label, but at least it is in the latex code

sebhahn commented 9 years ago

coming back to the real issue, which is solved now, I know where it comes from.

by adding ./ to e.g. [[./path/img.png]] this will be translated to \includegraphics{fig:./path/img.png}', whereas just using[[path/img.png]]is fine and leads to\includegraphics{path/img.png}`.

this kind of reference [[./path/img.png]] is however needed for the latex org-exporter

I think this issue can be closed.