help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: escaping backslash when printing a plot using -dpslatex


From: Josua Stingelin
Subject: Re: escaping backslash when printing a plot using -dpslatex
Date: Thu, 2 Apr 2020 22:12:12 +0200

On Thu, Apr 02, 2020 at 01:15:12PM +0200, Josua Stingelin wrote:
> Dear Octave developers,
> 
> Thank you very much for your amazing work on GNU Octave! I'm using it for most
> tasks the university expects me to do in MATLAB.
> 
> I've noticed that printing plots for further use in latex using the 
> '-dpslatex'
> option
> 
>     print (fig, file, '-pslatex')
> 
> requires escaping backslashes in labels
> 
>     xlabel ("$t [\\si{ms}]$");
> 
> is this expected behavior?
> 
> I don't think it's entirely clear from the documentation [1]
> 
> > The text that is written to the LaTeX file contains the strings exactly as
> > they were specified in the plot. If any special characters of the TeX mode
> > interpreter were used, the file must be edited before LaTeX processing.
> > Specifically, the special characters must be enclosed with dollar signs ($ …
> > $), and other characters that are recognized by LaTeX may also need editing
> > (.e.g., braces). The ‘pdflatex’ device, and any of the ‘standalone’ formats,
> > are not available with the Gnuplot toolkit.
> 
> [1]: https://octave.org/doc/v4.2.0/Printing-and-Saving-Plots.html
> 


Actually string behavior is well documented [2] I was just looking in the wrong
place.

When using double quotes the backslash is used as an escape character and thus
needs to be escaped itself.

When using single quotes one can use the backslash as is. However it is not
recommended to use the single quote because it's also used for the transpose
operator.

[2] https://octave.org/doc/v5.2.0/Strings.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]