Hello, Stefanos Carlström <stefanos.carlst...@gmail.com> writes:
> * ox-latex.el (org-latex--inline-image): The user can now customize the > way PGF images are included by changing the (new) variable > `org-latex-inline-pgf-command'. > > If the PGF file is stored in a subdirectory and references an external > image file in the same directory, LaTeX will complain about not finding > it. A workaround could be to define a function like this in the > preamble: > > \newcommand\inputpgf[2]{{ > \let\pgfimageWithoutPath\pgfimage > \renewcommand{\pgfimage}[2][]{\pgfimageWithoutPath[##1]{#1/##2}} > \input{#1/#2} > }} > > and customizing `org-latex-inline-pgf-command' to hold this function: > > (lambda (path) > (let ((dir-name (substring (file-name-directory path) 0 -1)) > (file-name (file-name-nondirectory path))) > (format "\\inputpgf{%s}{%s}" dir-name file-name))) > > This way, LaTeX will be able to find the external images. The idea came > from here: http://tex.stackexchange.com/a/282110/9742 Thank you for your patch. However, you can easily achieve the same using a filter, can't you? If a function needs to be introduced, it would be better to factor out the whole "tikz" and "pgf" handling, i.e., (progn (setq image-code (format "\\input{%s}" path)) (when (org-string-nw-p options) (setq image-code (format "\\begin{tikzpicture}[%s]\n%s\n\\end{tikzpicture}" options image-code))) (when (or (org-string-nw-p width) (org-string-nw-p height)) (setq image-code (format "\\resizebox{%s}{%s}{%s}" (if (org-string-nw-p width) width "!") (if (org-string-nw-p height) height "!") image-code)))) and have a variable holding a function to handle this such extensions, and doing the above as a default. Anyway, that's just an idea and people more knowledgeable on the subject may want to chime in. Regards, -- Nicolas Goaziou