Re: Specifying a path prefix in a LaTeX macro
On 09/05/2013 1:11 PM, Stephen Brooking wrote: I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `path/testreq1.tex' error. Just to add a bit more information, if I try this from a Windows command prompt I get the same error. kpsewhich tells me that TEXMFOUTPUT is set to what I think it is set to: kpsewhich --var-value=TEXMFOUTPUT C:\docs ! I can't write on file `C:\docs\testreq1.tex' If I remove the path setting from my test.tex file so I basically have this: \newwrite\tempfile \immediate\openout\tempfile=testreq1.tex \immediate\write\tempfile{Some text} \immediate\closeout\tempfile \input{C:/docs/testreq1.tex} and set the -output-directory command line option to pdflatex: pdflatex -output-directory C:\docs test.tex It all works, so I know that I can write files to that directory. (Setting the -output-directory like this though with LyX has the downside that LyX then can't find the output PDF file as it isn't in the temp directory that it expects.) Also to note, it also works if I set -output-directory to %TEXMFOUTPUT%. So, any clues as to why this doesn't work when just relying on the TEXMFOUTPUT variable, without setting -output-directory? Thanks and regards, Steve I think you need to set openout_any accordingly. In any case, first make sure this works with latex from the command line, only then should you try to do the same from within LyX. Cheers, Julien
Re: Specifying a path prefix in a LaTeX macro
On 09/05/2013 1:11 PM, Stephen Brooking wrote: I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `path/testreq1.tex' error. Just to add a bit more information, if I try this from a Windows command prompt I get the same error. kpsewhich tells me that TEXMFOUTPUT is set to what I think it is set to: kpsewhich --var-value=TEXMFOUTPUT C:\docs ! I can't write on file `C:\docs\testreq1.tex' If I remove the path setting from my test.tex file so I basically have this: \newwrite\tempfile \immediate\openout\tempfile=testreq1.tex \immediate\write\tempfile{Some text} \immediate\closeout\tempfile \input{C:/docs/testreq1.tex} and set the -output-directory command line option to pdflatex: pdflatex -output-directory C:\docs test.tex It all works, so I know that I can write files to that directory. (Setting the -output-directory like this though with LyX has the downside that LyX then can't find the output PDF file as it isn't in the temp directory that it expects.) Also to note, it also works if I set -output-directory to %TEXMFOUTPUT%. So, any clues as to why this doesn't work when just relying on the TEXMFOUTPUT variable, without setting -output-directory? Thanks and regards, Steve I think you need to set openout_any accordingly. In any case, first make sure this works with latex from the command line, only then should you try to do the same from within LyX. Cheers, Julien
Re: Specifying a path prefix in a LaTeX macro
On 09/05/2013 1:11 PM, Stephen Brooking wrote: I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `/testreq1.tex' error. Just to add a bit more information, if I try this from a Windows command prompt I get the same error. kpsewhich tells me that TEXMFOUTPUT is set to what I think it is set to: kpsewhich --var-value=TEXMFOUTPUT C:\docs ! I can't write on file `C:\docs\testreq1.tex' If I remove the path setting from my test.tex file so I basically have this: \newwrite\tempfile \immediate\openout\tempfile=testreq1.tex \immediate\write\tempfile{Some text} \immediate\closeout\tempfile \input{C:/docs/testreq1.tex} and set the -output-directory command line option to pdflatex: pdflatex -output-directory C:\docs test.tex It all works, so I know that I can write files to that directory. (Setting the -output-directory like this though with LyX has the downside that LyX then can't find the output PDF file as it isn't in the temp directory that it expects.) Also to note, it also works if I set -output-directory to %TEXMFOUTPUT%. So, any clues as to why this doesn't work when just relying on the TEXMFOUTPUT variable, without setting -output-directory? Thanks and regards, Steve I think you need to set openout_any accordingly. In any case, first make sure this works with latex from the command line, only then should you try to do the same from within LyX. Cheers, Julien
Re: Specifying a path prefix in a LaTeX macro
\filepath{c:/docs/} Have you tried it with Windows-style path names? So I changed this to define a \dirsep macro which gives me a backslash. Using \textbackslash (and I think escaping the backslash) seemed to insert a \T1 macro that is undefined. However, with my \dirsep, I still get the same error. I've tried this with a very basic document using pdflatex under unix, and I got the same problem, albeit with a different outcome: (./test.aux) [1{/usr/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]pdflatex: Not writing to path/testreq1.tex (openout_any = p). ! I can't write on file `path/testreq1.tex'. to be read again \immediate l.26 \reqbody{Put some text in the file} Please type another output file name: (path/testreq1.tex) [1] (./test.aux) )/usr/share/texmf/fo nts/type1/bluesky/cm/cmmi12.pfb/usr/share/texmf/fonts/type1/bluesky/cm/cmbx12 .pfb/usr/share/texmf/fonts/type1/bluesky/cm/cmr12.pfb/usr/share/texmf/fonts /type1/bluesky/cm/cmr17.pfb Output written on test.pdf (2 pages, 20839 bytes). Transcript written on test.log. So at the 'Please type another output file name:' prompt I just hit enter, and the write to the original filename was successful. So this appears to be a security thing; latex is preventing a write to arbitrary files. But just confirming at the prompt that you want to write that file is enough? So in my Unix setup I set the TEXMFOUTPUT environment variable to path, and the write now seems to go ahead without any complaint, and without presenting a prompt for a new filename. I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `path/testreq1.tex' error. Any thoughts? Many thanks, Steve
Re: Specifying a path prefix in a LaTeX macro
I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `path/testreq1.tex' error. Just to add a bit more information, if I try this from a Windows command prompt I get the same error. kpsewhich tells me that TEXMFOUTPUT is set to what I think it is set to: kpsewhich --var-value=TEXMFOUTPUT C:\docs ! I can't write on file `C:\docs\testreq1.tex' If I remove the path setting from my test.tex file so I basically have this: \newwrite\tempfile \immediate\openout\tempfile=testreq1.tex \immediate\write\tempfile{Some text} \immediate\closeout\tempfile \input{C:/docs/testreq1.tex} and set the -output-directory command line option to pdflatex: pdflatex -output-directory C:\docs test.tex It all works, so I know that I can write files to that directory. (Setting the -output-directory like this though with LyX has the downside that LyX then can't find the output PDF file as it isn't in the temp directory that it expects.) Also to note, it also works if I set -output-directory to %TEXMFOUTPUT%. So, any clues as to why this doesn't work when just relying on the TEXMFOUTPUT variable, without setting -output-directory? Thanks and regards, Steve
Re: Specifying a path prefix in a LaTeX macro
\filepath{c:/docs/} Have you tried it with Windows-style path names? So I changed this to define a \dirsep macro which gives me a backslash. Using \textbackslash (and I think escaping the backslash) seemed to insert a \T1 macro that is undefined. However, with my \dirsep, I still get the same error. I've tried this with a very basic document using pdflatex under unix, and I got the same problem, albeit with a different outcome: (./test.aux) [1{/usr/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]pdflatex: Not writing to path/testreq1.tex (openout_any = p). ! I can't write on file `path/testreq1.tex'. to be read again \immediate l.26 \reqbody{Put some text in the file} Please type another output file name: (path/testreq1.tex) [1] (./test.aux) )/usr/share/texmf/fo nts/type1/bluesky/cm/cmmi12.pfb/usr/share/texmf/fonts/type1/bluesky/cm/cmbx12 .pfb/usr/share/texmf/fonts/type1/bluesky/cm/cmr12.pfb/usr/share/texmf/fonts /type1/bluesky/cm/cmr17.pfb Output written on test.pdf (2 pages, 20839 bytes). Transcript written on test.log. So at the 'Please type another output file name:' prompt I just hit enter, and the write to the original filename was successful. So this appears to be a security thing; latex is preventing a write to arbitrary files. But just confirming at the prompt that you want to write that file is enough? So in my Unix setup I set the TEXMFOUTPUT environment variable to path, and the write now seems to go ahead without any complaint, and without presenting a prompt for a new filename. I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `path/testreq1.tex' error. Any thoughts? Many thanks, Steve
Re: Specifying a path prefix in a LaTeX macro
I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `path/testreq1.tex' error. Just to add a bit more information, if I try this from a Windows command prompt I get the same error. kpsewhich tells me that TEXMFOUTPUT is set to what I think it is set to: kpsewhich --var-value=TEXMFOUTPUT C:\docs ! I can't write on file `C:\docs\testreq1.tex' If I remove the path setting from my test.tex file so I basically have this: \newwrite\tempfile \immediate\openout\tempfile=testreq1.tex \immediate\write\tempfile{Some text} \immediate\closeout\tempfile \input{C:/docs/testreq1.tex} and set the -output-directory command line option to pdflatex: pdflatex -output-directory C:\docs test.tex It all works, so I know that I can write files to that directory. (Setting the -output-directory like this though with LyX has the downside that LyX then can't find the output PDF file as it isn't in the temp directory that it expects.) Also to note, it also works if I set -output-directory to %TEXMFOUTPUT%. So, any clues as to why this doesn't work when just relying on the TEXMFOUTPUT variable, without setting -output-directory? Thanks and regards, Steve
Re: Specifying a path prefix in a LaTeX macro
> > \filepath{c:/docs/} > > Have you tried it with Windows-style path names? So I changed this to define a \dirsep macro which gives me a backslash. Using \textbackslash (and I think escaping the backslash) seemed to insert a \T1 macro that is undefined. However, with my \dirsep, I still get the same error. I've tried this with a very basic document using pdflatex under unix, and I got the same problem, albeit with a different outcome: (./test.aux) [1{/usr/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]pdflatex: Not writing to /testreq1.tex (openout_any = p). ! I can't write on file `/testreq1.tex'. \immediate l.26 \reqbody{Put some text in the file} Please type another output file name: (/testreq1.tex) [1] (./test.aux) ) Output written on test.pdf (2 pages, 20839 bytes). Transcript written on test.log. So at the 'Please type another output file name:' prompt I just hit enter, and the write to the original filename was successful. So this appears to be a security thing; latex is preventing a write to arbitrary files. But just confirming at the prompt that you want to write that file is enough? So in my Unix setup I set the TEXMFOUTPUT environment variable to , and the write now seems to go ahead without any complaint, and without presenting a prompt for a new filename. I've tried the same under Windows (I need this to work with LyX under Windows), setting an environment variable to point to a path (and reconfiguring and restarting LyX just in case), and specifying that path as my \filepath, but I still get the same 'I can't write on file `/testreq1.tex' error. Any thoughts? Many thanks, Steve
Re: Specifying a path prefix in a LaTeX macro
> I've tried the same under Windows (I need this to work with LyX under > Windows), setting an environment variable to point to a path (and > reconfiguring and restarting LyX just in case), and specifying that path as > my \filepath, but I still get the same 'I can't write on file > `/testreq1.tex' error. Just to add a bit more information, if I try this from a Windows command prompt I get the same error. kpsewhich tells me that TEXMFOUTPUT is set to what I think it is set to: > kpsewhich --var-value=TEXMFOUTPUT C:\docs ! I can't write on file `C:\docs\testreq1.tex' If I remove the path setting from my test.tex file so I basically have this: \newwrite\tempfile \immediate\openout\tempfile=testreq1.tex \immediate\write\tempfile{Some text} \immediate\closeout\tempfile \input{C:/docs/testreq1.tex} and set the -output-directory command line option to pdflatex: > pdflatex -output-directory C:\docs test.tex It all works, so I know that I can write files to that directory. (Setting the -output-directory like this though with LyX has the downside that LyX then can't find the output PDF file as it isn't in the temp directory that it expects.) Also to note, it also works if I set -output-directory to %TEXMFOUTPUT%. So, any clues as to why this doesn't work when just relying on the TEXMFOUTPUT variable, without setting -output-directory? Thanks and regards, Steve
Specifying a path prefix in a LaTeX macro
Hi, I'm using LyX 2.0.5.1 on a Windows 7 machine. I am trying to put together a LyX framework that will allow me to enter some text, set it to a particular Style, and for the text marked by that Style to be written to a file. The filename and path to be specified by other macros. The file created would then be included in my document. (In the interest of brevity I won't go into why I would like to do this.) With the implementation detailed below, I get an error when I generate the PDF document: ! I can't write on file `c:/docs/test.tex'. I have verified that I can generally create files in the c:/docs directory, so I don't think it's a permissions or existence issue. I wonder if it's to do with Windows-style path names? So for example I have this in my document (this is the source that LyX shows for the text I've entered with Styles): \filepath{c:/docs/} \filename{test} \filebody{This is the text that should be put into the file} I've defined this in my document class: \newcommand\filename[1]{\renewcommand\filename{#1}} \newcommand\filepath[1]{\renewcommand\filepath{#1}} \newcommand\filebody[1]{ \newwrite\tempfile \immediate\openout\tempfile=\filepath\filename \immediate\write\tempfile{\filename: #1} \immediate\closeout\tempfile \input{\filepath\filename} } And in my layout file I have: Style FileName LatexType Command LatexName filename End Style FileBody LatexType Command LatexName filebody End Style FilePath LatexType Command LatexName filepath End Any thoughts about what's going on would be gratefully received. Thanks in advance, Steve
Re: Specifying a path prefix in a LaTeX macro
On 05/08/2013 10:26 AM, Stephen Brooking wrote: Hi, I'm using LyX 2.0.5.1 on a Windows 7 machine. I am trying to put together a LyX framework that will allow me to enter some text, set it to a particular Style, and for the text marked by that Style to be written to a file. The filename and path to be specified by other macros. The file created would then be included in my document. (In the interest of brevity I won't go into why I would like to do this.) With the implementation detailed below, I get an error when I generate the PDF document: ! I can't write on file `c:/docs/test.tex'. I have verified that I can generally create files in the c:/docs directory, so I don't think it's a permissions or existence issue. I wonder if it's to do with Windows-style path names? So for example I have this in my document (this is the source that LyX shows for the text I've entered with Styles): \filepath{c:/docs/} Have you tried it with Windows-style path names? rh
Re: Specifying a path prefix in a LaTeX macro
\filepath{c:/docs/} Have you tried it with Windows-style path names? Hi Richard, I have, but I'm not sure I've tried it in the correct way. \filepath{c:\docs\} The above would be looking for the macro \docs ? How should I express the Windows-style path names? Thanks and regards, Steve
Re: Specifying a path prefix in a LaTeX macro
On 05/08/2013 01:05 PM, Stephen Brooking wrote: \filepath{c:/docs/} Have you tried it with Windows-style path names? Hi Richard, I have, but I'm not sure I've tried it in the correct way. \filepath{c:\docs\} The above would be looking for the macro \docs ? How should I express the Windows-style path names? You could try \textbackslash, but I don't know if that will work. Alternatively, you could modify the script you have to replace / with \ in the pathname. Richard
Re: Specifying a path prefix in a LaTeX macro
What about escaping the backslashes? Paul
Specifying a path prefix in a LaTeX macro
Hi, I'm using LyX 2.0.5.1 on a Windows 7 machine. I am trying to put together a LyX framework that will allow me to enter some text, set it to a particular Style, and for the text marked by that Style to be written to a file. The filename and path to be specified by other macros. The file created would then be included in my document. (In the interest of brevity I won't go into why I would like to do this.) With the implementation detailed below, I get an error when I generate the PDF document: ! I can't write on file `c:/docs/test.tex'. I have verified that I can generally create files in the c:/docs directory, so I don't think it's a permissions or existence issue. I wonder if it's to do with Windows-style path names? So for example I have this in my document (this is the source that LyX shows for the text I've entered with Styles): \filepath{c:/docs/} \filename{test} \filebody{This is the text that should be put into the file} I've defined this in my document class: \newcommand\filename[1]{\renewcommand\filename{#1}} \newcommand\filepath[1]{\renewcommand\filepath{#1}} \newcommand\filebody[1]{ \newwrite\tempfile \immediate\openout\tempfile=\filepath\filename \immediate\write\tempfile{\filename: #1} \immediate\closeout\tempfile \input{\filepath\filename} } And in my layout file I have: Style FileName LatexType Command LatexName filename End Style FileBody LatexType Command LatexName filebody End Style FilePath LatexType Command LatexName filepath End Any thoughts about what's going on would be gratefully received. Thanks in advance, Steve
Re: Specifying a path prefix in a LaTeX macro
On 05/08/2013 10:26 AM, Stephen Brooking wrote: Hi, I'm using LyX 2.0.5.1 on a Windows 7 machine. I am trying to put together a LyX framework that will allow me to enter some text, set it to a particular Style, and for the text marked by that Style to be written to a file. The filename and path to be specified by other macros. The file created would then be included in my document. (In the interest of brevity I won't go into why I would like to do this.) With the implementation detailed below, I get an error when I generate the PDF document: ! I can't write on file `c:/docs/test.tex'. I have verified that I can generally create files in the c:/docs directory, so I don't think it's a permissions or existence issue. I wonder if it's to do with Windows-style path names? So for example I have this in my document (this is the source that LyX shows for the text I've entered with Styles): \filepath{c:/docs/} Have you tried it with Windows-style path names? rh
Re: Specifying a path prefix in a LaTeX macro
\filepath{c:/docs/} Have you tried it with Windows-style path names? Hi Richard, I have, but I'm not sure I've tried it in the correct way. \filepath{c:\docs\} The above would be looking for the macro \docs ? How should I express the Windows-style path names? Thanks and regards, Steve
Re: Specifying a path prefix in a LaTeX macro
On 05/08/2013 01:05 PM, Stephen Brooking wrote: \filepath{c:/docs/} Have you tried it with Windows-style path names? Hi Richard, I have, but I'm not sure I've tried it in the correct way. \filepath{c:\docs\} The above would be looking for the macro \docs ? How should I express the Windows-style path names? You could try \textbackslash, but I don't know if that will work. Alternatively, you could modify the script you have to replace / with \ in the pathname. Richard
Re: Specifying a path prefix in a LaTeX macro
What about escaping the backslashes? Paul
Specifying a path prefix in a LaTeX macro
Hi, I'm using LyX 2.0.5.1 on a Windows 7 machine. I am trying to put together a LyX framework that will allow me to enter some text, set it to a particular Style, and for the text marked by that Style to be written to a file. The filename and path to be specified by other macros. The file created would then be included in my document. (In the interest of brevity I won't go into why I would like to do this.) With the implementation detailed below, I get an error when I generate the PDF document: ! I can't write on file `c:/docs/test.tex'. I have verified that I can generally create files in the c:/docs directory, so I don't think it's a permissions or existence issue. I wonder if it's to do with Windows-style path names? So for example I have this in my document (this is the source that LyX shows for the text I've entered with Styles): \filepath{c:/docs/} \filename{test} \filebody{This is the text that should be put into the file} I've defined this in my document class: \newcommand\filename[1]{\renewcommand\filename{#1}} \newcommand\filepath[1]{\renewcommand\filepath{#1}} \newcommand\filebody[1]{ \newwrite\tempfile \immediate\openout\tempfile=\filepath\filename \immediate\write\tempfile{\filename: #1} \immediate\closeout\tempfile \input{\filepath\filename} } And in my layout file I have: Style FileName LatexType Command LatexName filename End Style FileBody LatexType Command LatexName filebody End Style FilePath LatexType Command LatexName filepath End Any thoughts about what's going on would be gratefully received. Thanks in advance, Steve
Re: Specifying a path prefix in a LaTeX macro
On 05/08/2013 10:26 AM, Stephen Brooking wrote: Hi, I'm using LyX 2.0.5.1 on a Windows 7 machine. I am trying to put together a LyX framework that will allow me to enter some text, set it to a particular Style, and for the text marked by that Style to be written to a file. The filename and path to be specified by other macros. The file created would then be included in my document. (In the interest of brevity I won't go into why I would like to do this.) With the implementation detailed below, I get an error when I generate the PDF document: ! I can't write on file `c:/docs/test.tex'. I have verified that I can generally create files in the c:/docs directory, so I don't think it's a permissions or existence issue. I wonder if it's to do with Windows-style path names? So for example I have this in my document (this is the source that LyX shows for the text I've entered with Styles): \filepath{c:/docs/} Have you tried it with Windows-style path names? rh
Re: Specifying a path prefix in a LaTeX macro
> > \filepath{c:/docs/} > > Have you tried it with Windows-style path names? Hi Richard, I have, but I'm not sure I've tried it in the correct way. \filepath{c:\docs\} The above would be looking for the macro \docs ? How should I express the Windows-style path names? Thanks and regards, Steve
Re: Specifying a path prefix in a LaTeX macro
On 05/08/2013 01:05 PM, Stephen Brooking wrote: \filepath{c:/docs/} Have you tried it with Windows-style path names? Hi Richard, I have, but I'm not sure I've tried it in the correct way. \filepath{c:\docs\} The above would be looking for the macro \docs ? How should I express the Windows-style path names? You could try \textbackslash, but I don't know if that will work. Alternatively, you could modify the script you have to replace / with \ in the pathname. Richard
Re: Specifying a path prefix in a LaTeX macro
What about escaping the backslashes? Paul