LaTeX rendering

Hi,

My system is a MacBook Pro (i9 processor) with macOS Mojave Version 10.14.3, I have installed Matplotlib version 3.0.2 and what
I want to do is use an external TeX renderer but I always get: FileNotFoundError: [Errno 2] No such file or directory: 'latex': ?latex?.

I get the aforementioned message, for example, trying to execute the following code:

"""
import numpy as np
import matplotlib.pyplot as plt

# Example data
t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(4 * np.pi * t) + 2

plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.plot(t, s)

plt.xlabel(r'\textbf{time} (s)')
plt.ylabel(r'\textit{voltage} (mV)',fontsize=16)
plt.title(r"\TeX\ is Number "
          r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
          fontsize=16, color='gray')
# Make room for the ridiculously large title.
plt.subplots_adjust(top=0.8)

plt.savefig('tex_demo')
plt.show()

I have installed MacTex and also MiKTek with their installers and Ghostscript with Home-brew. I use Spyder installed with Conda.
Using Mathtext everything is alright.
In which directory Matplotlib expect to find the directory ?latex??

Thank you all
Stefano

Hello.

Le 12/03/2019 ? 18:36, Stefano Gragnani a ?crit?:

I want to do is use an external TeX renderer but I always get: FileNotFoundError: [Errno 2] No such file or directory: 'latex': ?latex?.
...

I have installed MacTex and also MiKTek with their installers and Ghostscript with Home-brew. I use Spyder installed with Conda.
Using Mathtext everything is alright.
In which directory Matplotlib expect to find the directory ?latex??

I use Windows, so my answer may not be relevant, but MiKTeX installation
does not necessarily update your path,? so check that, it may be as
simple as that. What happens if you launch latex in a terminal?

(In Win10 latex.exe is where you put it, e.g.,? in
C:\MiKTeX\miktex\bin\x64\)

Good luck
Jerzy Karczmarczuk
/Caen, France/

I think Jerzy is correct, we are expecting `latex` to be on the path.

Does `latex` work at the shell in the same context as you are running
python?

Tom

···

On Tue, Mar 12, 2019 at 4:23 PM Jerzy Karczmarczuk < jerzy.karczmarczuk at unicaen.fr> wrote:

Hello.

Le 12/03/2019 ? 18:36, Stefano Gragnani a ?crit :
> I want to do is use an external TeX renderer but I always get:
FileNotFoundError: [Errno 2] No such file or directory: 'latex': ?latex?.
> ...
>
> I have installed MacTex and also MiKTek with their installers and
Ghostscript with Home-brew. I use Spyder installed with Conda.
> Using Mathtext everything is alright.
> In which directory Matplotlib expect to find the directory ?latex??

I use Windows, so my answer may not be relevant, but MiKTeX installation
does not necessarily update your path, so check that, it may be as
simple as that. What happens if you launch latex in a terminal?

(In Win10 latex.exe is where you put it, e.g., in
C:\MiKTeX\miktex\bin\x64\)

Good luck
Jerzy Karczmarczuk
/Caen, France/

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

--
Thomas Caswell
tcaswell at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20190312/c2ba25dc/attachment.html&gt;