MiKTeX and proTeXtWeird '.cls' file behaviour

Information and discussion about MikTeX distribution for Windows and the related proTeXt: Installing, updating, configuring
Post Reply
Pawel
Posts: 9
Joined: Fri Jul 25, 2008 9:51 am

Weird '.cls' file behaviour

Post by Pawel »

All,

I am using elsart.cls to typeset my articles. However, what annoyed me slightly was the 'Preprint submitted to Elsevier' comment on the front page. To get rid of it I edited the elsart.cls file and replaced the line that produced it with something like
Preliminary and Incomplete \hfil Current Version \@date\/%
I've recently upgraded to 2.7 so had to do the whole thing again. So, I found the elsart.cls file in
C:\Program Files\MiKTeX 2.7\tex\latex\elsevier
made the necessary changes and saved the file. Then, just to make sure everything works ok, I refreshed the file name database and formats in the MikTeX settings wizard. And so the fun began.

I compiled my '.tex' file but still got the old comment on the front page. I checked the log file which says clearly that the file used in compilation is
C:\Program Files\MiKTeX 2.7\tex\latex\elsevier
i.e. the one I modified (not trusting the '.log' file I renamed the 'elsart.cls' file and the '.tex' file stopped compiling - which provides some evidence that this is really the file being used). Ok, so I then renamed the modified file back to 'elsart.cls' and lo and behold, I'm getting the initial 'Preprint submitted to Elsevier' comment on the front page even though there is no corresponding line in the '.cls' file. I deleted all the auxiliary compilation files, and tried again. All to no avail, I can't get rid of it.

Does anyone understand what is going on? I certainly don't and would like to, so help would be much appreciated.

Thanks in advance
Pawel

ps. I could probably get the thing to work by saving the modified .cls file in my working directory. But that is kind of a lowly trick and doesn't address the question of what is happening here?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Re: Weird '.cls' file behaviour

Post by Juanjo »

I rarely work with Windows, so perhaps I'm going to say something a bit silly. Maybe elsart.cls is a protected file. You open it in your editor as a read-only file without being aware of that fact, you edit the file, but your changes are not really saved. Anyway, I find a bad practice to modify the files given in a TeX distribution. I would make a copy of elsart.cls, rename it to, say, myelsart.cls, and then modify it. Of course, in the tex file, I should write \documentclass{myelsart}.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Pawel
Posts: 9
Joined: Fri Jul 25, 2008 9:51 am

Re: Weird '.cls' file behaviour

Post by Pawel »

Thanks for your help Juanjo.

What you say might have been true. Or perhaps I was just doing something even more stupid (i.e. I didn't save the .cls file after modifying; I was pretty tired when posting). Anyway, I had another go, and everything works fine this time round.

I agree totally on it being bad practice to modify the files in a distribution (do as I say not as I do, though ;-)).

Thanks again.
Pawel
sumpygump
Posts: 6
Joined: Mon Nov 03, 2008 5:19 am

Re: Weird '.cls' file behaviour

Post by sumpygump »

It seems elsart.cls is the old version and a better version exists now -- elsarticle.cls .

See website for details:
http://www.elsevier.com/wps/find/author ... elsarticle
bjorn
Posts: 4
Joined: Tue Oct 06, 2009 3:21 pm

Weird '.cls' file behaviour

Post by bjorn »

I did this for the elsarticle.cls file, and it works fine. I commented out the two lines and just put today's date instead:

Code: Select all

% Preprint submitted to \ifx\@journal\@empty Elsevier
% \else\@journal\fi\hfill\today}%
\hfill\today}%
Thanks for the tip!
Post Reply