0

I am trying to recreate this TikZ picture I saw https://tex.stackexchange.com/a/212936 (specifically the last image)

However upon compiling I get a message saying that the process exited ith errors but there is no information in the log file (see attached screenshot)

enter image description here

enter image description here

I am not sure why this error as occurs as I can render both examples from: enter link description here

My code I am trying to render:

% !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}

Upon inspection of the log file I found this near runsystem

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.
  • I get no error. Did you run LaTeX with -shell-escape? – egreg Jan 7 at 11:56
  • I'm curious, what part of this code needs gnuplot (I'm guessing it is hidden somewhere) – daleif Jan 7 at 12:00
  • yes the wave plot part – sab hoque Jan 7 at 12:05
  • 1
    If your on windows try my mwe here tex.stackexchange.com/questions/456297/… I will show some basic checks in a rudimentary Results.txt file – user170109 Jan 7 at 12:46
  • 1
    Ok I updated gnuplot to 5.3 (todays version) and get several warning etc but not from gnuplot the issue in my case seems to be font related as I have had problems with garamond in the past (I probably need to clear out a local file) so if I change Garamond to the one I have available [ebgaramond] it compiles for me (with an acceptable pair of font warnings) – user170109 Jan 7 at 14:18
2

This appears to be a font issue as {mathdesign} requires at least three specific fonts to be available, however only one at a time so if you cut and paste these uncomment your one of choice

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

Used with the fontenc package \usepackage[T1]{fontenc}

The font names may be abbreviated i.e

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

ensure your font mapping is updated via TeX Live manager or MiKTeX-console. Having personally had problems with Garamond in the past it works in my case if I change it to

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

If that does not work consider reloading the mathdesign package (or simply commenting it out)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.