Mercurial > octave-nkf
comparison scripts/plot/util/private/__opengl_print__.m @ 20479:ab2c5e84954a
Allow relative paths when printing with -dpdflatex (bug #45601).
* __opengl_print__.m, __gnuplot_print__.m: When processing *latex devices, use
fileparts() and fullfile() to determine names and extensions rather than
searching for a '.' which is confused by relative paths.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 14 Aug 2015 14:26:31 -0700 |
parents | 6645488466c7 |
children |
comparison
equal
deleted
inserted
replaced
20478:610c74748518 | 20479:ab2c5e84954a |
---|---|
46 case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ... | 46 case {"epslatex", "pslatex", "pdflatex", "epslatexstandalone", ... |
47 "pslatexstandalone", "pdflatexstandalone"} | 47 "pslatexstandalone", "pdflatexstandalone"} |
48 ## format GL2PS_TEX | 48 ## format GL2PS_TEX |
49 n = find (opts.devopt == "l", 1); | 49 n = find (opts.devopt == "l", 1); |
50 suffix = opts.devopt(1:n-1); | 50 suffix = opts.devopt(1:n-1); |
51 dot = find (opts.name == ".", 1, "last"); | 51 [ndir, name, ext] = fileparts (opts.name); |
52 if ((! isempty (dot)) | 52 if (isempty (ext)) |
53 && any (strcmpi (opts.name(dot:end), ... | 53 ext = "tex"; |
54 {strcat(".", suffix), ".tex", "."}))) | 54 else |
55 name = opts.name(1:dot-1); | 55 ext = ext(2:end); # remove leading '.' |
56 if (dot < numel (opts.name) | 56 endif |
57 && any (strcmpi (opts.name(dot+1:end), {"eps", "ps", "pdf"}))) | 57 if (any (strcmpi (ext, {suffix, "tex"}))) |
58 ## If user provides eps/ps/pdf suffix, use it. | 58 name = fullfile (ndir, name); |
59 suffix = opts.name(dot+1:end); | 59 if (any (strcmpi (ext, {"eps", "ps", "pdf"}))) |
60 suffix = ext; # If user provides eps/ps/pdf suffix, use it. | |
60 endif | 61 endif |
61 else | 62 else |
62 error ("print:invalid-suffix", | 63 error ("print:invalid-suffix", |
63 "invalid suffix '%s' for device '%s'.", | 64 "invalid suffix '%s' for device '%s'.", |
64 opts.name(dot:end), lower (opts.devopt)); | 65 ext, lower (opts.devopt)); |
65 endif | 66 endif |
66 gl2ps_device = {sprintf("%snotxt", lower (suffix))}; | 67 gl2ps_device = {sprintf("%snotxt", lower (suffix))}; |
67 gl2ps_device{2} = "tex"; | 68 gl2ps_device{2} = "tex"; |
68 if (dos_shell) | 69 if (dos_shell) |
69 ## FIXME: this will only work on MinGW with the MSYS shell | 70 ## FIXME: this will only work on MinGW with the MSYS shell |