英文:
Gnuplot epslatex files output path problem
问题
我在Gnuplot中遇到了一个问题。
当我将输出文件名设置为相对路径以将.tex
和.eps
文件保存在不同文件夹中时,相对路径也会包含在.tex
文件中的\includegraphics
命令中。
例如,如果我将输出文件设置为当前目录上面两级的文件:
set terminal epslatex color size 6, 3
# ...
set output "../../filename.tex"
# ...
\includegraphics
命令会保留该路径,即使文件已经位于上面两级,它仍会搜索该目录的额外两级,而不是在当前目录中搜索:
% ...
\put(0,0){\includegraphics{../../filename}}%
% ...
在将来的版本中修复此问题将会很好,允许分别设置输出路径和出现在\includegraphics
命令中的文件名。
英文:
I have a problem in Gnuplot.
When I set the output filename with a relative path to save the .tex
and .eps
files in a different folder, the relative path is also included in the \includegraphics
command in the .tex
file.
For example, if I set the output file to be two levels above the current directory:
set terminal epslatex color size 6, 3
# ...
set output "../../filename.tex"
# ...
The \includegraphics
command keeps that path when the file is already two levels above and searches two extra levels above of that directory instead of searching in the current directory:
% ...
\put(0,0){\includegraphics{../../filename}}%
% ...
It would be great to fix this issue in future versions, allowing to set the output path and file name (that appears in \includegraphics
command) separately.
答案1
得分: 0
工作解决方案:
不要在文件名中包含完整路径(或相对路径),而是将其临时设置为工作目录:
olddir = system("pwd")
cd '../..'
set output "filename.tex"
plot <whatever>
cd olddir
英文:
Work-around:
Instead of including the full path (or relative path) in the file name, set it temporarily as your working directory:
olddir = system("pwd")
cd '../..'
set output "filename.tex"
plot <whatever>
cd olddir
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论