希腊字母pi在gnuplot不渲染

问题描述 投票:0回答:1

我在Emacs orgmode文件中有这个代码:

#+begin_src gnuplot :exports results :file images/sinecosine.png
reset
set terminal png  size 360, 360 enhanced
# Line styles
set border linewidth 1
set style line 1 linecolor rgb '#0060ad' linetype 1 linewidth 1  # blue
set style line 2 linecolor rgb '#dd181f' linetype 1 linewidth 1  # red
# Legend
set key at 6.1,1.3
# Axes label 
set xlabel 'x'
set ylabel 'y'

set xzeroaxis linetype 2 linewidth 1
  set yzeroaxis linetype 2 linewidth 1
# Axis ranges
set xrange[-2*pi:2*pi]
set yrange[-1.5:1.5]
# Axis labels
set xtics ("-2{/Symbol P}" -2*pi, "-{/Symbol P}" -pi, 0, "{/Symbol P}" pi, "2{/Symbol P}" 2*pi)
set ytics 1
set tics scale 0.75


# Functions to plot
a = 0.9
f(x) = a * sin(x)
g(x) = a * cos(x)
# Plot
plot f(x) title 'sin(x)' with lines ls 1, \
     g(x) notitle with lines ls 2


#+end_src

它给出了一个没有正确pi符号的gnuplot(3.7) - 就像在thisthis帖子中一样。是的,我可以让这个eps版本工作,但不是这个HTML导出所需的png(或svg)版本。有什么新想法吗?

更新

这是我尝试过的独立代码 - 成功:

reset
set encoding utf8
set terminal svg enhanced fname 'Times New Roman' rounded dashed standalone
set output "gp-test4-output.svg"

# Line styles
set border linewidth 1
set style line 1 linecolor rgb '#0060ad' linetype 1 linewidth 1  # blue
set style line 2 linecolor rgb '#dd181f' linetype 1 linewidth 1  # red
# Legend
set key at 6.1,1.3
# Axes label 
set xlabel 'x'
set ylabel 'y'

set xzeroaxis linetype 2 linewidth 1
  set yzeroaxis linetype 2 linewidth 1
# Axis ranges
set xrange[-2*pi:2*pi]
set yrange[-1.5:1.5]
# Axis labels
set xtics ("-2Π" -2*pi, "-Π" -pi, 0, "Π" pi, "2Π" 2*pi)
set ytics 1
set tics scale 0.75


# Functions to plot
a = 0.9
f(x) = a * sin(x)
g(x) = a * cos(x)
# Plot
plot f(x) title 'sin(x)' with lines ls 1, \
     g(x) notitle with lines ls 2

我换了{/Symbol P}换了Π。从终端命令行我已经得到它工作,生产就好了。 Ubuntu repo确实安装了最新最好的gnuplot(gnuplot 5.2 patchlevel 6)。所以再次做实验,当我在组织模式代码块中获得C-c C-c

gnuplot-mode 0.7-beta (gnuplot 3.7) -- report bugs with "C-c C-u"

和相同的错误:垃圾而不是Π。 (不确定gnuplot 3.7是关于什么的。)运行上面的代码块,BTW,启动一个gnuplot REPL,它说它是最新的最大的gnuplot。但是当Emacs中的独立代码(带有gnuplot模式)被称为la“发送缓冲区到gnuplot”(Emacs gnuplot REPL)时,它会给出错误,但是当我“将文件发送到gnuplot”时,它会产生Π没有错误。完全奇怪,恕我直言。

这是我的订阅:

(setq package-archives '(("ELPA"  . "http://tromey.com/elpa/")
             ("gnu"   . "http://elpa.gnu.org/packages/")
             ("melpa" . "https://melpa.org/packages/")
             ("org"   . "https://orgmode.org/elpa/")))

这为gnuplot模式提供了两种产品:

gnuplot            20141231.2137 available  melpa      drive gnuplot from within emacs

然后这个:

gnuplot-mode       20171013.1616 installed             Major mode for editing gnuplot scripts

然后我卸载了Emacs gnuplot(20141231.2137),然后安装了gnuplot-mode(20171013.1616)。这解决了gnuplot-run-buffer问题,但是组织模式代码块现在给出了这个错误:

executing Gnuplot code block...
org-babel-execute:gnuplot: Cannot open load file: No such file or directory, gnuplot

搜索customize我只找到与gnuplot相关的四个变量,一个是Gnuplot程序,我有/usr/bin/gnuplot。我在Ubuntu 19.04中使用最新的Emacs和org-mode。我怎样才能更好地告诉org-babel在哪里可以找到Gnuplot?我怀疑这种新模式不是Emacs组织模式的预期合作伙伴;但是较旧的模式在组织模式下没有正确地执行希腊字母。

utf-8 gnuplot org-mode
1个回答
0
投票

从Adobe Symbol字体中检索字符“pi”来自PostScript世界,其中使用具有特殊编码的单独字体来处理PostScript字体编码中固有的256个字符限制。

另一方面,SVG是XML变体。它使用unicode入口点和(通常)UTF-8编码来访问它们。 SVG文件中的“pi”是字节序列0xCF 0x80(UTF-8编码)或XML预定义实体π。 gnuplot的“增强文本”模式与此无关。我不记得gnuplot 3.7中可能存在哪些限制会影响将这些作为普通文本传递到svg终端。目前的gnuplot没有这样的限制。

© www.soinside.com 2019 - 2024. All rights reserved.