Gnuplot 错误,没有任何日志

Gnuplot 错误,没有任何日志

我正在尝试重新创建我看到的这张 TikZ 图片https://tex.stackexchange.com/a/212936(特别是最后一张图片)

然而,在编译时我收到一条消息,说该进程因错误退出,但日志文件中没有任何信息(参见所附的屏幕截图)

在此处输入图片描述

在此处输入图片描述

我不确定为什么会发生此错误,因为我可以从以下两个示例中呈现:在此处输入链接描述

我正在尝试呈现的代码:

% !TeX encoding = utf8
\documentclass[
   11pt,cmyk,
   multi={tikzpicture},
   border=10mm,
]{standalone}


% General packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\usepackage[garamond]{mathdesign}
\usepackage{mathtools}

% Colors
\usepackage{xcolor}
   \definecolor{spot}{cmyk}{1,0.20,0,0}
   \colorlet{gray}{black!60}
   \colorlet{wave}{spot}

% Load TikZ and libraries
\usepackage{tikz}
\usetikzlibrary{calc,positioning,decorations.pathmorphing,%
   arrows.meta,backgrounds}
% Define TikZ styles etc.
\tikzset{
   every plot/.style={
      prefix=plots/,
      samples=200,
   },
   every node/.style={
      font=\footnotesize,
   },
   line width=1pt,
   shorten/.style={
      shorten >=#1,
      shorten <=#1,
   },
   >=Triangle[],
   axis/.style={-Stealth[]},
   tick/.style={
      axis,
      shorten <=-0.5\pgflinewidth,
      shorten >=-0.5\pgflinewidth,
   },
}

% Load and configure pgfplots
\usepackage{pgfplots}
   \usepgfplotslibrary{polar}
   \pgfplotsset{
      compat=1.11,
      wave axis/.style={
         view={0}{90},
         hide axis,
         colormap={custom}{color=(white) color=(wave)},
         trig format plots=rad,
         trig format=rad,
         x=1cm,
         y=1cm,
         z=0cm,
         anchor=origin,
      },
      wave plot/.style={
         samples=200,
         samples y=2,
         surf,shader=interp,
      },
      polar wave plot/.style={
         data cs=polar,
         domain=0:2*pi,
         samples y=100,
         surf,shader=interp,
      },
   }

% Macro for subfigure captions
\newcommand{\subfig}[1]{\textbf{\textsf{#1)}}~}

\begin{document}

    \begin{tikzpicture}
    % define variables
    \def\H{0.275}
    \def\S{1.8}
    \def\B{8}
    \def\T{4.5}
    \def\l{2.6}
    \def\s{0.3}
    \pgfmathsetmacro\w{atan((\S+\H/2)/\T)}
    \pgfmathsetmacro\R{sqrt(\T^2+(\S+\H/2)^2)}
    %% wave parameters
    \pgfmathsetmacro\wL{6.5*\H}
    \pgfmathsetmacro\wA{\H/2}
    \pgfmathsetmacro\D{10*\wL}
    % plane wave
    \begin{axis}[wave axis]
    \addplot3[wave plot,domain=-\B:0.05,domain y=-\wA:\wA] {abs(sin(pi/\wL * x))};
    %      \addplot[domain=-\D:0,samples=200] function {abs(cos(pi/\wL * x))};
    \end{axis}
    % radial wave
    \begin{scope}
    %      \clip (0,-\H/2-\S) -- (-\w:\R) arc [start angle=-\w, end angle=\w, radius=\R]
    %         -- (0,\H/2+\S) -- cycle;
    \clip (0,-\H/2-\S) rectangle (\T,\H/2+\S);
    \begin{axis}[wave axis]
    \addplot3[polar wave plot,domain y=0:2*\T] function {abs(sin(pi/\wL * y))*exp(-0.2*y)};
    %         \addplot[domain=0:2*\T,samples=200] function {abs(cos(pi/\wL * x))*exp(-0.2*x)};
    \end{axis}
    \end{scope}
    % tube
    \draw [ultra thick] (-\B,\H/2) -| (0,\H/2+\S);
    \draw [ultra thick] (-\B,-\H/2) -| (0,-\H/2-\S);
    % axis
    \draw [axis] (-\B,0) -- ($(\T,0)-(0.25,0)$) node [below left] {$x$};
    \draw [tick,|-] (0,0) node [below right=2pt and 2.5pt,inner sep=0pt] {$0$} -- (1,0);
    \draw [axis] (0,0) -- (25:2.5) node [below] {$\vec{r}$};
    % captions
    \draw (-2.5*\wL,0.25*\H) -- ++(65:.6) node [above] {$\psi_\text{i}$};
    \draw (60:\wL/1.9) -- ++(180:1.1) node [left] {$\psi_\text{a}$};
    \node at (0,-\H/2) [below left, align=right] {cross sectional\\area $A$};
    \end{tikzpicture}
\end{document}

检查日志文件后,我在运行系统附近发现了这个

Package pgfplots info on input line 98: Overriding colorspace to cmyk due to xc
olor configuration.
Package pgfplots info on input line 107: Overriding colorspace to cmyk due to x
color configuration.
\openout3 = `diagram.pgf-plot.gnuplot'.

runsystem(gnuplot diagram.pgf-plot.gnuplot)...executed.

PGFPlots: reading {diagram.pgf-plot.table}
LaTeX Font Info:    Try loading font information for OT1+mdugm on input line 11
6.

答案1

这似乎是一个字体问题,因为 {mathdesign} 至少需要三种特定字体可用,但一次只能使用一种,因此如果您剪切并粘贴这些字体,请取消注释您的选择

%\usepackage[adobe-utopia]{mathdesign}  
%\usepackage[bitstream-charter]{mathdesign}  
%\usepackage[urw-garamond]{mathdesign}  

与 fontenc 包一起使用 \usepackage[T1]{fontenc}

字体名称可以缩写,即

%\usepackage[utopia]{mathdesign}  
%\usepackage[charter]{mathdesign}  
%\usepackage[garamond]{mathdesign}  

确保字体映射已通过 TeX Live 管理器或 MiKTeX 控制台更新。我个人过去曾遇到过 Garamond 问题,如果我将其更改为

\usepackage[T1]{fontenc}    
\usepackage[charter]{mathdesign}

如果这不起作用,请考虑重新加载 mathdesign 包(或简单地将其注释掉)

相关内容