LyXPassing values from a .layout to options in a .cls

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
fun_with_aluminum
Posts: 1
Joined: Wed May 12, 2010 5:34 pm

Passing values from a .layout to options in a .cls

Post by fun_with_aluminum »

Hello. I'm a longtime LyX user who has always been able to solve my own problems with Google and guesswork, but I've hit a wall. Hoping someone more experienced can help me out.

Here's the situation:

A journal has provided a LaTeX class that they "strongly recommend" using. I've written a basic .layout file to wrap said class, everything's installed where it should be, so I can pick this new style in LyX, it shows up as available, and everything seems OK.

The problem is that the provided class file seems to want to be passed arguments and it isn't passed any, so I get an empty output when I try to burn a PDF, plus a LaTeX error. I'm trying to find out what I should do about it.

The class file contains the following code, which generates the error. I can't really read LaTeX, but it basically seems to exist to create an error if a variable \journalopt is not fed the value "pss" (that variable is used nowhere else in the file):

Code: Select all

\let\journalopt\@empty
\DeclareOption{pss}{\def\journalopt{pss}}
%
%SOME STUFF OMITTED
% 
\ifx\journalopt\@empty
  \ClassError{wiley2sp}%
   {No valid journal specified in option list}%
   {There was no option given in the class option specifying\MessageBreak
    some valid journal name (just "pss" is valid by now).}
  \expandafter\stop
\else
  \edef\clofilename{w2sp-\journalopt.clo}%
  \IfFileExists{\clofilename}%
   {\AtEndOfClass{\input{\clofilename}}%
    }%
   {\ClassError{wiley2sp}%
     {Subpackage "\clofilename" not found}%
     {In the class options list you gave the option "\journalopt"\MessageBreak
      but the corresponding file "\clofilename" doesn't show up\MessageBreak
      where (La)TeX is looking for it.}}
\fi
I would like to set up my Preamble section to feed the class the string "pss" that it desires, but I'm not sure how to go about it.

The LyX help is useless on this, and the only reference I found in the (surprisingly sparse) LaTeX documentation on the web was that you would declare an option in a \usepackage{} call. However, this always seems in reference to a file with a *.sty extension, rather than a *.cls, and furthermore presumably the \DeclareLaTeXClass routine already includes the class in question?

Quite lost, and really hoping some guru can set me straight.

Cheers,
Scott

PS: In case it's any use, my entire .layout file looks like the following at present:

Code: Select all

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[wiley2sp]{article (wiley2sp)}

Input stdclass.inc

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Passing values from a .layout to options in a .cls

Post by frabjous »

My experience with this is virtually nonexistent, but I'd try adding something like this to the .layout file:

Code: Select all

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[wiley2sp]{article (wiley2sp)}

Input stdclass.inc

ClassOptions
        Other                pss
End
Post Reply