LyXLyx fails with cannot find .sty file, should be using a .cls

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
hedgeboar
Posts: 2
Joined: Mon Sep 06, 2010 3:28 am

Lyx fails with cannot find .sty file, should be using a .cls

Post by hedgeboar »

I've added a .cls file called mechthesis.cls to my MiKTeX istallation (at least I think I have), and created a .layout file for LyX. This works fine on my office PC, running LyX 1.6.7 on windows XP x64. However, when I try this on my laptop running Windows 7 I get the message:
"LaTeX Error: File 'mechthesis.sty' not found."
So it seems it's looking for a .sty instaed of the .cls I've supplied. I've also tried this on another machine running kubuntu lucid with the same results....

I've tried putting mechthesis.cls in C:\Program Files (x86)\MiKTeX 2.8\tex\latex\base as well as a folder in a directory I have added to MiKTeX using the settings GUI. I have updated the FNDB many times, and done 'reconfigure' in LyX many times.

Any Ideas? How can I check to see if mechtheis.cls is recognised by MiKTex? my mechthesis.layout is below.

Code: Select all

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[mechthesis,book]{mechthesis}
# Book textclass definition file. Taken from initial LyX source code
# Author : Matthias Ettrich <ettrich@informatik.uni-tuebingen.de>
# Transposed by Pascal André
# Heavily modifed and enhanced by serveral developers.

Preamble
   \usepackage{mechthesis}
EndPreamble

Format 11

Input stdclass.inc
Input numreport.inc


Sides           2
PageStyle       Headings


NoStyle Abstract


Style Bibliography
	TopSep                4
	LabelString           "Bibliography"
	LabelFont
	  Series              Bold
	  Size                Huge
	EndFont
End

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Lyx fails with cannot find .sty file, should be using a .cls

Post by frabjous »

I really have no experience with creating LyX layout files, but \usepackage{xxx} is only used in LaTeX for loading packages (i.e., .sty files), not for document classes. Document classes are chosen with the \documentclass command; in your case, \documentclass{mechthesis}. So if mechthesis is a .cls file, not a .sty file, then it makes no sense to have this part:

Code: Select all

Preamble
   \usepackage{mechthesis}
EndPreamble
in your .layout file. I'd start just by removing that. If that doesn't do it, I'm not sure I can be of much help, though a quick look at this page also makes me think that perhaps you shouldn't have ",book" in the line:

Code: Select all

#  \DeclareLaTeXClass[mechthesis,book]{mechthesis}
but I'm not sure about that.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Lyx fails with cannot find .sty file, should be using a .cls

Post by meho_r »

I wouldn't go into technical part, but just a general reminder: when you manually add anything new to your LaTeX installation, don't forget to refresh the database:

Code: Select all

texhash
Apart from that, you may have to reconfigure LyX too: Tools > Reconfigure.
hedgeboar
Posts: 2
Joined: Mon Sep 06, 2010 3:28 am

Lyx fails with cannot find .sty file, should be using a .cls

Post by hedgeboar »

Thanks frabjous, removing the \usepackage did fix that problem..... Although that seems odd as it works fine on my office PC like that.
However, now it is giving font errors for greek characters in the text -- it's fine if I put them in as an inline formula, but if they are directly in the text it fails and gives this message:

Code: Select all

Errors:
Font LGR/cmr/m/n/10.95=grmn1095 at 10.95pt not loadable: Metric (TFM) file no

Description:
 ...y an elevation angle, $\Phi$\textgreek{F}
                                                  ,
I wasn't able to read the size data for this font,
so I will ignore the font specification.
[Wizards can fix TFM files using TFtoPL/PLtoTF.]
You might try inserting a different font spec;
e.g., type `I\font<same font id>=<substitute font name>'.
Post Reply