Hello there,
This issue seems to be similar to #1450 or #942.
First of all, thanks for this wonderful tool.
Now, to my question / petition: would it be possible for pandoc to look for resources in the --data-dir location before giving up on looking for images? Is there any other configuration to set up a directory look for images?
My use case is the following: I have a file templates\default.latex in my --data-dir location. Pandoc loads the template correctly when executing via command line something like.
pandoc file.md -o file.pdf
The thing is that this template uses an image for the header. I've tried putting the image in the --data-dir folder to get pandoc to find it without any luck.
This means that I need to execute pandoc from the location the image is, which is not very confortable because the image belongs to the template, not the actual document.
Would it be possible for pandoc to tell latex to look for in the --data-dir location before deciding it doesn't find the image?
Thanks!
Why can't you specify the absolute path to your image in your template? e.g. /Users/pchtsp/.pandoc/img.jpg
You can always use an absolute path for the image in
your template.
If portability is of concern, absolute path might not work.
For Unix, $HOME/.pandoc/ or ~/.pandoc/ is portable, but it left out Windows users. But on the other hand, the / vs. \ might already eliminate the hope of portability.
By the way, does pandoc provide the environment variable $DATADIR?
Thanks. Yes, I'm including the absolute paths in the template for now.
Of course the whole idea of having a template is making it once and using
it from more than one place.
I guess it's more of a latex thing. I was searching for ways to embed the
image inside the latex file but it doesn't appear to be possible.
Could referring to environment variables work in Windows as it does in
Unix? I know that it would not work for both at the same time.
Thanks.
El 16 ene. 2017 16:00, "ickc" notifications@github.com escribió:
If portability is of concern, absolute path might not work.
For Unix, $HOME/.pandoc/ or ~/.pandoc/ is portable, but it left out Windows
users. But on the other hand, the / vs. \ might already eliminate the hope
of portability.
By the way, does pandoc provide the environment variable $DATADIR?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/jgm/pandoc/issues/3356#issuecomment-272884460, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AFNM86qAwcHbOXsZgfKrTZh29U1EP64Sks5rS4X8gaJpZM4LkfFy
.
a similar question is asked on SO at https://stackoverflow.com/q/47271344/1911863
I have a similar issue (relative paths in HTML template), therefore I wanted to ask if there is any update/solution for this?
Thanks in advance :smile:
I have the same issue:
Could not find data file /usr/share/pandoc/data/templates/
I can't even change that base path, and I can't use --template at all in my script, this doesn't help as well.
mkdir -p ~/.pandoc/templates
pandoc -D latex > ~/.pandoc/templates/default.latex
@kopax this issue is about paths referred to in templates. It sounds from your post as if you're having trouble finding templates, which is a different issue. (In any case you need to give a bit more context, like the pandoc command in which you use --template.)
Yes, I was having issue with pandoc 1.x, --data-dir . was not working (1.x is version served on debian and apt). I have upgraded to pandoc 2.7 and now the --data-dir . option work fine.
I had to switch the pdf engine from xelatex to pdflatex at the same time.
For one of the two preceding reasons, I have now two TOC being displayed.
Not really sure why, but writing my custom template didn't help, I can't remove it except if I remove the TOC from the docx itself, and still the rendering is bad.
Apparently there is a difference on how pandoc read the .docx.
See this issue: https://tex.stackexchange.com/questions/511478/toc-followed-by-another-toc-how-to-keep-just-one?noredirect=1#comment1293442_511478
What is the recommended stable version of pandoc to use?
The recommended version of pandoc to use is always the latest release in https://github.com/jgm/pandoc/releases/latest. They are by definition stable versions.
If you're unsure if a bug/feature is fixed/implemented, trying the latest nightly build is recommended: https://github.com/pandoc-extras/pandoc-nightly/releases/latest.
Also, use pandoc-discuss for questions and avoid site like stack exchange for questions about pandoc. See https://pandoc.org/help.html.
Hi, there is no .deb for nightly.
Since I have downgraded to 1.7, I have one TOC, in latest release, the TOC within the .docx is kept after the toc generated, resulting in two toc wrongly displayed.
Sorry to ask here but, I haven't found a way to detect the toc from the .docx in v2, did you guys change something?
Use pandoc-amd64-34c61fcad.zip, that's a portable Linux for amd64 platform.
I think you may have better luck getting answer on pandoc-discuss. It is a google group that requires only email (preferably gmail but I think it is not mandatory?)
Coming back to the topic more than two years after I created this issue, I've found a not-so-bad workaround.
Apparently, latex uses the environment variable TEXINPUTS as a sort ot PATH for resources. So, you can just configure an environment variable once in your system (linux, windows, wherever.) and just refer to resources relative to that path.
This link provides some explanation about how to use it:
https://tex.stackexchange.com/questions/93712/definition-of-the-texinputs-variable
For example I have the following files:
SOME_PATH_TO/templates/my_latex_template.tex
SOME_PATH_TO/templates/img/my_img.png
In my system I set the environment variable (example with Windows, although I actually just save it under the system config):
set TEXINPUTS=SOME_PATH_TO/templates/
In the template my_latex_template.tex I have something like:
%...
\includegraphics{img/my_img.png}
%...
And I call the template like so:
pandoc file.txt -t pdf --template=SOME_PATH_TO/templates/my_latex_template.tex --output=output.pdf
Good suggestion on the env var. (It perfectly solve the issue as in the title, albeit it is not a pandoc solution i.e. only works in LaTeX.)
Except possibly for documenting this in pandoc's doc, there seems nothing can/should be done in pandoc. Closing this?