[OS X TeX] Can You Find The Class?

Martin Costabel costabel at wanadoo.fr
Mon Jun 20 03:02:14 EDT 2005


Herbert Schulz wrote:
[]
> I actually hoping I can find something to use within a .sty file. I  
> felt it would be nice to have the adapted pdftricks package generate  
> figure files that use the same class as the original source file.  Then 
> I'd change the pdftricks to use keyval options and allow the  user to 
> change that behavior with something like docclass=..... from  the 
> default. It would also allow me to grab more document point  sizes, etc. 

The following simple solution gives you the name of the documentclass in 
\firstClass:

  \def\firstFile#1.cls#2\@nil{#1}
  \edef\firstClass{\expandafter\firstFile\@filelist\@nil}

It works in the standard situation where \documentclass is the first 
command in the document. It just extracts anything before ".cls" in the 
filelist. If you want to cover the case where someone uses \input before 
\documentclass, you can add the following line after the two lines 
above. It just throws away all other file names before the class.

  \@for\@Filename:=\firstClass\do{\global\let\Classname\@Filename}}

The name of the class is now in \Classname.

-- 
Martin

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list