WinEdtHow do I add a new document class?

Information and discussion about WinEdt, a commercial integrated LaTeX environment for Windows
Post Reply
inbal
Posts: 5
Joined: Thu Sep 06, 2007 6:27 pm

How do I add a new document class?

Post by inbal »

I downloaded a template of a journal (PNAS) but when I try to compile it the document class is unknown. Which files are missing and where should I copy them to?
Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

How do I add a new document class?

Post by Stefan Kottwitz »

Hi inbal!

Download the corresponding document class file, it should be pnastwo.cls. You may find it here, click on Class.
Put the file into the TeX directory structure and run texhash or mktexlsr or click the Refresh FNDB button in MiKTeX options if you use MiKTeX. Or put pnastwo.cls into the same directory like your template or main tex file.

Stefan
LaTeX.org admin
inbal
Posts: 5
Joined: Thu Sep 06, 2007 6:27 pm

Re: How do I add a new document class?

Post by inbal »

I had the cls file in the same directory and it didn't work. Well, closing and re-opening WinEdt helped :)
I now have a problem with \maketitle, I get the message "missing number, treated as zero". When I try to compile the sample document, I get error messages about the fonts. Obviously something is missing.
I don't even know which directories are used, there are the WinEdt directories and the MikTex directories and I'm missing some basic knowledge about the structure and the way they function together.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Re: How do I add a new document class?

Post by Stefan Kottwitz »

Hi inbal!

Beside just forgetting to give TeX an number ;) that error may have a cause that's not so obvious. For instance some examples of the old LaTeX Companion need loading the calc package. Give it a try, write \usepackage{calc} or show us that example.
Concerning \maketitle the cause may be inside the arguments of \author, \title, .. show us one small example too that gives the error message.

Stefan
LaTeX.org admin
inbal
Posts: 5
Joined: Thu Sep 06, 2007 6:27 pm

Re: How do I add a new document class?

Post by inbal »

When I use the PNAS sample file I get the error message:
! Font \footnotefont=hv at 6.0pt not loadable: Metric (TFM) file not found.
l.163 \font\footnotefont\frutigermed at 6pt

It repeats many times, for different font names and sizes. Obviously I'm missing the fonts but I don't know where to get them from and where to put them.

When I use the PNAS template I don't get any errors but only the title page is created. If I comment the \maketitle I get the next page correctly.

Attached are the files and logs.
Thanks a lot
Inbal
Attachments
PNASTWOS.log
Sample log
(7.79 KiB) Downloaded 765 times
PNASTMPL.TEX
PNAS template
(8.24 KiB) Downloaded 844 times
PNASTWOS.TEX
PNAS two column sample
(15.54 KiB) Downloaded 972 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

How do I add a new document class?

Post by Stefan Kottwitz »

Hi inbal,

at the moment I have only Linux on my computer, no Windows, so I cannot give concrete help with the installation of certain fonts on Windows. Just generally, look at the TeX Catalogue for a package name, look with the MiKTeX package manager for this package and install it by the mpm or try to load it from CTAN. For the frutiger font there's an howto here on CTAN.

Concerning the other problem: you should get a warning about the empty thebibliography environment. Put one \bibitem line there and it may work with \maketitle and the remaining text.

Stefan
LaTeX.org admin
inbal
Posts: 5
Joined: Thu Sep 06, 2007 6:27 pm

Re: How do I add a new document class?

Post by inbal »

Ok, the template works fine. I'll handle the fonts later or just use the template.
Thanks for everything!
Inbal
rivasastroza
Posts: 1
Joined: Fri May 01, 2009 11:50 pm

How do I add a new document class?

Post by rivasastroza »

The solution is very easy.

Actually I had the same problem and found the solution in the PNAS documentation (you can download in http://www.pnas.org/site/misc/LaTex.shtml, and the select the link Instructions). Resuming you must edit the file pnastwof.sty (or pnasonef.sty if is your case) and change de font definitions (for both: times and helvetica).

The way for doing that is edit the file pnastwof.sty (or pnasonef.sty) in the lines that define the times-roman font:

Code: Select all

%% Times-Roman

%% Dvipsone Names:
\def\timesroman{tir}
\def\timesbold{tib}
\def\timesitalic{tii}
\def\timesbolditalic{tibi}


%% Karl Berry Names:
%\def\timesroman{ptmr8t}
%\def\timesbold{ptmb8t}
%\def\timesitalic{ptmri8t}
%\def\timesbolditalic{ptmbi8t}
change this lines for:

Code: Select all

%% Times-Roman

%% Dvipsone Names:
%\def\timesroman{tir}
%\def\timesbold{tib}
%\def\timesitalic{tii}
%\def\timesbolditalic{tibi}


%% Karl Berry Names:
\def\timesroman{ptmr8t}
\def\timesbold{ptmb8t}
\def\timesitalic{ptmri8t}
\def\timesbolditalic{ptmbi8t}
and then do the same for the font helvetica (who definition is few lines belows), I mean, change the lines:

Code: Select all

%% Helvetica
%------------------
%% Dvipsone
\def\helvetica{hv}
\def\helveticaoblique{hvo}
\def\helveticaboldoblique{hvbo}
\def\helveticabold{hvb}


%% Karl Berry Names:
%\def\helvetica{phvr}
%\def\helveticaoblique{phvro}
%\def\helveticaboldoblique{phvbo}
%\def\helveticabold{phvb}
for:

Code: Select all

%% Helvetica
%------------------
%% Dvipsone
%\def\helvetica{hv}
%\def\helveticaoblique{hvo}
%\def\helveticaboldoblique{hvbo}
%\def\helveticabold{hvb}


%% Karl Berry Names:
\def\helvetica{phvr}
\def\helveticaoblique{phvro}
\def\helveticaboldoblique{phvbo}
\def\helveticabold{phvb}
If this don't work you must use other font definitions (consult the PNAS file documentation).

Best regards
Marcelo Rivas Astroza

PD: sorry for my English, I'm not native English speaker.
Post Reply