Thank you all for your suggestions. With the additional help of Tim Arnold (SAS 
Institute; author of the StatRep package for LaTeX), here's a somewhat 
hardcoded way to move the log file on a Windows 7 system with LyX 2.1.1: 

1) Select Preferences > File Handling > File Formats and then choose a format 
of PDF (pdflatex)
2) In the Copier field, enter 
      
     python "C:\Program Files (x86)\LyX 2.1"\\Resources\\scripts\\ext_copy.py 
-e log -t. $$i c:\\myfolder

   where myfolder would be the location where your LyX file is located 
3) Select Save
4) Reconfigure (Select Tools > Reconfigure) and exit LyX
5) Re-open the LyX file and select File > Export > PDF (pdflatex)

This works but it is not necessarily idea. Does anyone have ideas for 
improvement? For example, is there a way to get around hard coding the path to 
ext_copy.py or myfolder? Also, is there a way to do this by selecting the 
document viewer icon on the View/Update toolbar (equivalent to Document > View 
[PDF (pdflatex)] or Ctrl-R) rather than File > Export > PDF (pdflatex)?

The main reason again for my original question is to actually do this moving 
with .sas files that are created automatically by the StatRep package when a 
LyX/LaTeX file is compiled. Not everyone necessarily knows what a SAS file is 
or has access to SAS to run a SAS file, so that's why I chose to phrase the 
question in terms of the LaTeX log file. I have not tried yet the previous 
suggestion of using the LyX Converter to automatically run these SAS files. The 
potential for doing it is very interesting and would be a nice addition to the 
reproducibility of research area, like knitr is for R programs. 

Thanks,

Chris

-----Original Message-----
From: Bert Lloyd [mailto:bert.lloyd...@gmail.com] 
Sent: Tuesday, April 26, 2016 9:15 AM
To: lyx-users@lists.lyx.org
Cc: Christopher Bilder <bil...@unl.edu>; Richard Heck <rgh...@lyx.org>
Subject: Re: log file location - move from temporary directory to .lyx file 
location

Chris, I've faced a somewhat similar situation in the past and I handled it by 
writing a script to do the following

1. export lyx to tex (in cygwin, lyx -e tex mylyxfile.lyx) 2. Use latex or 
pdflatex to process the resulting mylyxfile.tex 3. now the ancillary files (in 
your case, .log) should be created in the same directory, so you can do your 
task 4. clean up the ancillary files using rm

I am really terrible at writing scripts so I'll allow someone more adept to 
code up an example, but this is the basic idea and it works for me, albeit in a 
fairly hacky way.

Hope this helps and good luck,
BL

On Fri, Apr 22, 2016 at 2:21 PM, Richard Heck <rgh...@lyx.org> wrote:
> On 04/22/2016 12:36 PM, Christopher Bilder wrote:
>
> Hello, I would like to have the LaTeX .log file be automatically put 
> into the folder where I have my .lyx file once the LyX file is 
> compiled. This behavior would be similar to what occurs with LaTeX 
> already when compiling a .tex file. Currently, the .log file is put 
> into a temporary directory by LyX. I understand how to change the path 
> for the temporary directory (Preferences > Paths) which sort of works, 
> but I would also like to remove the set of randomly generated folders 
> that come with it, like “lyx_tmpdir.WrDLwXBld464\lyx_tmpbuf2”, before I can 
> get to my .log file.
>
>
>
> I understand how to see the .log file from within LyX itself (Document 
> > LaTeX Log), so this request my seem odd! The real reason that I want 
> to be able to better control this LyX behavior is because I am using a 
> LaTeX package (StatRep – SAS’s “equivalent” to knitr for R) which 
> generates some additional files (SAS program) that I need to easily access.
>
>
> This should be possible by creating a specialized "copier". See 
> section 3.2 of the Customization manual for information on how to do 
> this. There's a very simple example there, but you can also have a 
> look at the ext_copy.py file, which is mostly used as a copier for html files.
>
> I don't totally understand how StatRep works or what kinds of files it 
> generates where, but you if it is putting them in the temporary 
> directory, you should be able to define a copier to extract them, too. 
> Alternatively, if it's something you are running by hand after export, 
> you should be able to define a "Converter" that will run the SAS 
> program for you, in the temporary directory. This is how kntir works 
> in LyX, I think. See section
> 3.3 of the Customization manual for info on that.
>
> Richard
>

Reply via email to