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.
sab hoque
  • 2,627
  • I get no error. Did you run LaTeX with -shell-escape? – egreg Jan 07 '19 at 11:56
  • I'm curious, what part of this code needs gnuplot (I'm guessing it is hidden somewhere) – daleif Jan 07 '19 at 12:00
  • yes the wave plot part – sab hoque Jan 07 '19 at 12:05
  • Oh, \addplot3 function is an alias for \addplot gnuplot ... that explains it. – daleif Jan 07 '19 at 12:10
  • 1
    If your on windows try my mwe here https://tex.stackexchange.com/questions/456297/problem-with-contour-plots I will show some basic checks in a rudimentary Results.txt file –  Jan 07 '19 at 12:46
  • yep sorry, I ran it and got this INFO: Could not find files for the given pattern(s). I am not sure what this means I also got: Error: Command crashed: pdflatex -shell-escape -synctex=1 -interaction=nonstopmode "diagram".tex – sab hoque Jan 07 '19 at 12:52
  • There are no spaces in the file directory so I am unsure what might be the cause of that crash – sab hoque Jan 07 '19 at 12:54
  • Very interesting there is no diagram it is just a check if gnuplot responds to a "show version long" query which confirms its on path then in case its not, it looks at local default paths hence the "could not find" tend to show gnuplot is not clearly available did you get a version feedback in the results .txt ? also I see "one drive" in your image (that's a potential reason for file passing to bork) –  Jan 07 '19 at 13:24
  • Yes I got version feedback, my gunplot directory is under C:\gnuplot – sab hoque Jan 07 '19 at 13:25
  • G N U P L O T Version 5.2 patchlevel 6 last modified 2019-01-01 Copyright (C) 1986-1993, 1998, 2004, 2007-2018 Thomas Williams, Colin Kelley and many others gnuplot home: http://www.gnuplot.info faq, bugs, etc: type "help FAQ" immediate help: type "help" (plot window: hit 'h') Compile options: +READLINE -LIBREADLINE +HISTORY -BACKWARDS – sab hoque Jan 07 '19 at 13:27
  • 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) –  Jan 07 '19 at 14:18
  • Thank you so much that was indeed the issue. I removed the line \usepackage[garamond]{mathdesign} and it works perfectly – sab hoque Jan 07 '19 at 14:21

1 Answers1

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)

Martin Scharrer
  • 262,582