Error in print latex standalone

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in print latex standalone

Joao Rodrigues

Hi

I want to generate standalone plots with superscripts/Latex annotations in the text, but I am getting error messages.

An example from the manual (https://octave.org/doc/v4.4.0/Printing-and-Saving-Plots.html):

x = 0:0.01:3;
hf = figure ();
plot (x, erf (x));
hold on;
plot (x, x, "r");
axis ([0, 3, 0, 1]);
text (0.65, 0.6175, ['$\displaystyle\leftarrow x = {2 \over \sqrt{\pi}}'...
                     '\int_{0}^{x} e^{-t^2} dt = 0.6175$'],
      "interpreter", "latex");
xlabel ("x");
ylabel ("erf (x)");
title ("erf (x) with text annotation");
print (hf, "plot15_7.pdf", "-dpdflatexstandalone");

yields:

error: print.m: error opening file 'plot15_7.tex'
error: called from
    print>latex_standalone at line 686 column 5
    __opengl_print__ at line 176 column 5
    print at line 434 column 14

The version is GNU Octave, version 4.0.0 and the operating system is Ubuntu 16.04.5 LTS.

Any suggestion is appreciated.





Reply | Threaded
Open this post in threaded view
|

Re: Error in print latex standalone

Pantxo
Joao Rodrigues wrote

> Hi
>
> I want to generate standalone plots with superscripts/Latex annotations
> in the text, but I am getting error messages.
>
> An example from the manual
> (https://octave.org/doc/v4.4.0/Printing-and-Saving-Plots.html):
>
> x = 0:0.01:3;
> hf = figure ();
> plot (x, erf (x));
> hold on;
> plot (x, x, "r");
> axis ([0, 3, 0, 1]);
> text (0.65, 0.6175, ['$\displaystyle\leftarrow x = {2 \over
> \sqrt{\pi}}'...
>                       '\int_{0}^{x} e^{-t^2} dt = 0.6175$'],
>        "interpreter", "latex");
> xlabel ("x");
> ylabel ("erf (x)");
> title ("erf (x) with text annotation");
> print (hf, "plot15_7.pdf", "-dpdflatexstandalone");
>
> yields:
>
> error: print.m: error opening file 'plot15_7.tex'
> error: called from
>      print>latex_standalone at line 686 column 5
>      __opengl_print__ at line 176 column 5
>      print at line 434 column 14
>
> The version is GNU Octave, version 4.0.0 and the operating system is
> Ubuntu 16.04.5 LTS.
>
> Any suggestion is appreciated.

This code works for me and I can compile the generated tex file from octave
using

system "pdflatex plot15_7.tex"

Does the simple script bellow yield the same error?

clf;
plot (1:10)
print -dpdflatexstandalone toto.tex
system "pdflatex toto.tex"

Pantxo



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Error in print latex standalone

Dmitri A. Sergatskov
In reply to this post by Joao Rodrigues


On Thu, Sep 13, 2018 at 8:51 AM Joao Rodrigues <[hidden email]> wrote:

print (hf, "plot15_7.pdf", "-dpdflatexstandalone");

yields:

error: print.m: error opening file 'plot15_7.tex'
error: called from
    print>latex_standalone at line 686 column 5
    __opengl_print__ at line 176 column 5
    print at line 434 column 14

The version is GNU Octave, version 4.0.0 and the operating system is Ubuntu 16.04.5 LTS.

Any suggestion is appreciated.


It looks to me it is a file write permission problem.

Make sure you have write permission to the working directory, and if this directory has
the plot15_7.tex file already you have write permission to it as well.

Dmitri.
--


 


Reply | Threaded
Open this post in threaded view
|

Re: Error in print latex standalone

Joao Rodrigues



On 13-09-18 21:06, Dmitri A. Sergatskov wrote:


On Thu, Sep 13, 2018 at 8:51 AM Joao Rodrigues <[hidden email]> wrote:

print (hf, "plot15_7.pdf", "-dpdflatexstandalone");

yields:

error: print.m: error opening file 'plot15_7.tex'
error: called from
    print>latex_standalone at line 686 column 5
    __opengl_print__ at line 176 column 5
    print at line 434 column 14

The version is GNU Octave, version 4.0.0 and the operating system is Ubuntu 16.04.5 LTS.

Any suggestion is appreciated.


It looks to me it is a file write permission problem.

Make sure you have write permission to the working directory, and if this directory has
the plot15_7.tex file already you have write permission to it as well.

Dmitri.
--

I want to thank Dmitri and Pantxo for their suggestions. I do have write permission for the directory and the 'toto' script did work on the original machine.

I tried running the manual example and the 'toto' simplified version in a computer with Ubuntu 18.04 and Octave 4.4 (or 4.2, perhaps) and both scripts worked fine.

I then ran them in yet another machine with Ubuntu 16.04 and Octave 4.0 and that worked fine but there it was pdflatex that yielded an error...

I will just upgrade all machines to the latest version of Octave and pdflatex.

Joao


Reply | Threaded
Open this post in threaded view
|

Re: Error in print latex standalone

Mike Miller-4
In reply to this post by Pantxo
On Thu, Sep 13, 2018 at 09:04:20 -0500, Pantxo wrote:
> Joao Rodrigues wrote
[…]
> > An example from the manual
> > (https://octave.org/doc/v4.4.0/Printing-and-Saving-Plots.html):
[…]
> > print (hf, "plot15_7.pdf", "-dpdflatexstandalone");
[…]
>
> This code works for me and I can compile the generated tex file from octave
> using
>
> system "pdflatex plot15_7.tex"

Should we change this example in the user manual to make it clear that
the output file will have a .tex file extension rather than a .pdf
extension? When I read through the example script, it looks like Octave
prints directly to a file 'plot15_7.pdf', and a user might not
understand that the following 'pdflatex' command has to be run to build
the final pdf. This would be clearer IMHO:

    print (hf, "plot15_7.tex", "-dpdflatexstandalone");
    system ("pdflatex plot15_7.tex");
    open plot15_7.pdf

What do you think?

--
mike



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error in print latex standalone

tmacchant
In reply to this post by Joao Rodrigues

----- Original Message -----

>From: Joao Rodrigues <[hidden email]>
>To: [hidden email]
>Date: 2018/9/14, Fri 05:55
>Subject: Re: Error in print latex standalone
>
>
>
>
>
>On 13-09-18 21:06, Dmitri A. Sergatskov wrote:
>
>
>>
>>
>>On Thu, Sep 13, 2018 at 8:51 AM Joao Rodrigues <[hidden email]> wrote:
>>
>>
>>>
>>>print (hf, "plot15_7.pdf", "-dpdflatexstandalone");
>>>yields:
>>>error: print.m: error opening file 'plot15_7.tex'
>>>error: called from
>>>    print>latex_standalone at line 686 column 5
>>>    __opengl_print__ at line 176 column 5
>>>    print at line 434 column 14
>>>
>>>The version is GNU Octave, version 4.0.0 and the operating system is Ubuntu 16.04.5 LTS.
>>>
>>>Any suggestion is appreciated.
>>>
>>>
>>>
>>It looks to me it is a file write permission problem.
>>
>>
>>Make sure you have write permission to the working directory, and if this directory has
>>the plot15_7.tex file already you have write permission to it as well.
>>
>>
>>
>>Dmitri.
>>--
>>
>I want to thank Dmitri and Pantxo for their suggestions. I do have
    write permission for the directory and the 'toto' script did work on
    the original machine.
>
>I tried running the manual example and the 'toto' simplified version
    in a computer with Ubuntu 18.04 and Octave 4.4 (or 4.2, perhaps) and
    both scripts worked fine.
>
>I then ran them in yet another machine with Ubuntu 16.04 and Octave
    4.0 and that worked fine but there it was pdflatex that yielded an
    error...
>
>I will just upgrade all machines to the latest version of Octave and
    pdflatex.
>
>Joao

For Ubuntu 16.04 (for almost all linux distro), easiest way to install the latest octave is to use flatpak.

Instruction is here.

http://ubuntuhandbook.org/index.php/2018/07/install-latest-gnu-octave-4-4-ubuntu-18-04/ 


The above is for 18.04. But for 16.04, as written the above, you can install flatpak using ppa.
https://launchpad.net/~alexlarsson/+archive/ubuntu/flatpak


HTH

Tatsuro