Gnuplot epslatex文件输出路径问题

huangapple go评论125阅读模式
英文:

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(&quot;pwd&quot;)
 cd &#39;../..&#39;
 set output &quot;filename.tex&quot;
 plot &lt;whatever&gt;
 cd olddir

huangapple
  • 本文由 发表于 2023年8月11日 05:14:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76879342.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定