-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use \includegraphics instead of \pgfimage #205
Comments
You could include |
Could you please explain this workaround more in detail. I have added my latex code in the first post. A workaround with the TEXINPUT variable seems to work but is user-unfriendly as I would have to do it for every graphic. |
What do you mean by "as I would have to do it for every graphic"? The
BTW, to make you example reproducible it would be nice if you could supply some simple R code that uses |
Some graphics I produce have several png files and I want to have them in separate folders. Furthermore, depending on my latex main file the graphics folder is labeled different. Therefore, I prefer a different solution. Edit: It seems that I can limit my problem to a countable number of cases. Thus, I build a small wrapper for the |
I have now created my own example. R code for producing the image: library(tikzDevice)
tikz("image.tex", width = 5)
plot(c(100, 150), c(300, 350), type = "n", xlab = "", ylab = "")
image <- as.raster(matrix(rep(c(rep(0:1, 4), rep(1:0, 4)), each = 3), ncol = 6, nrow = 4))
rasterImage(image, 100, 300, 150, 350, interpolate = FALSE)
dev.off() The resulting files \documentclass{article}
\usepackage{graphicx}
\graphicspath{{./tikz/}}
\usepackage{tikz}
% \let\pgfimage=\includegraphics % un-comment to make it work
\begin{document}
\input{tikz/image.tex}
\end{document} This reproduces the issue since For you this requires specifying all the image sub-directories using |
This would be a very helpful change to tikzDevice. Setting TEXINPUT works but is a real pain if you need to collaborate with others. |
For some reason, \graphicspath{{./tikz/}} does not work using \graphicspath{{tikz/}} does. |
I have tried to include a tex file from the tikz output in my latex document. Since I did not put it in my main folder but in a subfolder, I always get confusing error messages. If I add the folder path like \pgfimage{path/tikz.tex} before the file name in the \pgfimage command, I can fix the error messages. So it would be pretty good to add an option to add an optional path for the filenames.
If there is any misbehavior on my part, I would ask for instructions to get a runnable latex file . Thanks a lot
M(N)WE: The problem is the subfolder "./images/". The plot_1.tex contains the critical command "\pgfimage{plot_1_ras1}"
latex file:
`\documentclass[10pt]{article}
\usepackage[pdftex]{graphicx}
\graphicspath{{./images/}}
\usepackage{tikz}
\begin{document}
\begin{figure}
\input{./images/plot_1.tex}
\caption{Sample output from tikzDevice}
\label{plot:test}
\end{figure}
\end{document}`
r file:
tikz(file = ".\\images\\plot_1.tex", width = 10, height = 5) ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density)) dev.off()
The text was updated successfully, but these errors were encountered: