Re: using a .cls file in the document directory (Windows)

2014-07-18 Thread aparsloe


On 19/07/2014 9:51 a.m., Ross Boylan wrote:
My document use the nih class and layout (the latter from Rob Oakes) 
and is based on the template provided with the nih for LyX zipfile. 
nih.cls and nih.layout are in the same directory as the document. 
Windows 7.  LyX Version 2.0.6.  MikTeX 2.9.


Producing pdfs (via pdflatex) works fine on linux and MacOS, but not 
Windows.  The problem is that on Windows 
c:\MikTeX\tex\latex\nih\nih.cls is used instead of the version in the 
document directory.  That version includes a bunch of stuff which is 
in the document preamble, and so "already defined" errors occur.  Some 
of it really needs to be in the preamble since it consists of stuff 
that vary with each document.  The nih.cls in the document directory 
does not contain the preamble stuff.


Is there a way to use the nih.cls in the document directory?

The LyX customization manual, section 5.1, has instructions for 
installing a local copy.  This seems rather involved and will not 
reflect changes to the nih.cls in my document directory.  I'm probably 
not going to change it, but I'd rather not set things up in such a 
fragile way.


I tried to use a local layout in the Document Settings | Document 
Class, but this didn't change the nih.cls that was used.


Thanks.
Ross Boylan

P.S. I could change the commands in the preamble to \renewcommand, but 
then things would stop working under the other OS's, since the command 
is not previously defined for them.  Also, \newcommands are not the 
only thing in the preamble, and I'm not sure if duplicating the other 
stuff is OK.


Have you looked at the Settings option for MiKTeX? (I always "Run as 
administrator".)  Under the Roots tab you can specify your own texmf 
tree to search, and the order in the list determines the order in which 
files are searched. I'm not sure that just including your document 
directory among the Roots will necessarily work. MiKTeX insists on a 
certain amount of directory structure (like the main installation). 
Alternatively, if you don't want to set up your own texmf tree, it seems 
from my installation that MiKTeX searches in the order


C:\Users\\AppData\Roaming\MiKTeX\2.9
C:\Users\\AppData\Local\MiKTeX\2.9

C:\Program Files (x86)\MiKTeX 2.9
C:\ProgramData\MiKTeX\2.9

so putting your modified nih.cls in the first directory listed above 
should do the trick. (I've never done this, but I have got a personal 
texmf tree, which is searched before the main MiKTeX installation.) You 
will need to Refresh FNDB on the General tab of the Settings dialog for 
MiKTeX to find the newly placed file.


Andrew



using a .cls file in the document directory (Windows)

2014-07-18 Thread Ross Boylan
My document use the nih class and layout (the latter from Rob Oakes) and 
is based on the template provided with the nih for LyX zipfile. nih.cls 
and nih.layout are in the same directory as the document. Windows 7.  
LyX Version 2.0.6.  MikTeX 2.9.


Producing pdfs (via pdflatex) works fine on linux and MacOS, but not 
Windows.  The problem is that on Windows c:\MikTeX\tex\latex\nih\nih.cls 
is used instead of the version in the document directory.  That version 
includes a bunch of stuff which is in the document preamble, and so 
"already defined" errors occur.  Some of it really needs to be in the 
preamble since it consists of stuff that vary with each document.  The 
nih.cls in the document directory does not contain the preamble stuff.


Is there a way to use the nih.cls in the document directory?

The LyX customization manual, section 5.1, has instructions for 
installing a local copy.  This seems rather involved and will not 
reflect changes to the nih.cls in my document directory.  I'm probably 
not going to change it, but I'd rather not set things up in such a 
fragile way.


I tried to use a local layout in the Document Settings | Document Class, 
but this didn't change the nih.cls that was used.


Thanks.
Ross Boylan

P.S. I could change the commands in the preamble to \renewcommand, but 
then things would stop working under the other OS's, since the command 
is not previously defined for them.  Also, \newcommands are not the only 
thing in the preamble, and I'm not sure if duplicating the other stuff 
is OK.