Dave Hewitt wrote:

I copied "article.layout" from the LyX\Resources\layouts directory and renamed it "nrc1.layout", then I pasted it into my user layout directory. Following along with Customization -> Ch. 5, I altered the second line in the file this way:

#  \DeclareLaTeXClass[nrc1,nrc1.sty]{article (nrc1)}

(the nrc package comes with nrc1.cls, nrc1.sty, nrc2.cls, nrc2.sty, plus a bunch of other files including a PDF "user's guide", which probably means something to people that know LaTeX)

The PDF manual is actually quite well written, but oddly enough it gives no clue what nrc1.sty and nrc2.sty would be used for. Maybe you can use article.cls and load nrc1.sty as a package?? Anyway, you'll want to use nrc1.cls (one column) or nrc2.cls (two column). So the optional arguments (inside the brackets) above are almost surely wrong.

I also tried simply:

#  \DeclareLaTeXClass{article (nrc1)}

This is the way to go (and works for me).

I also tried adding various combinations of package names into the brackets of example 1 (as I sort of deduced the User's Guide was telling me to do), but unsurprisingly they didn't work either.

I added some Preamble code to the file on one attempt as per the UG, but that didn't help (and I really had no clue what I was doing anyway).

Probably a good idea to delete that, then.

In no attempt did I alter anything else down in the file.

Either way, YES, the document class shows up in the LyX drop-down, but when I choose it, LyX generates an error window with a red 'X' on it and a warning that says "The document could not be converted into the document class nrc1" -- I click OK and it reverts to "article" in the drop-down. This is what happened with two other classes I tried as well.

This happens when you create a new document (ctrl-N or File -> New) and then switch it to NRC1 using Document -> Settings... -> Document Class?

Odd that it doesn't happen for me. I'm attaching the layout file I kludged (from article.layout), although it should exactly match your most parsimonious attempt. I don't know that it exposes all the bells and whistles of the NRC class (such as journal name), but it doesn't blow up in my face.

There's one bit of funkiness I came across. It shouldn't cause LyX to revert to article, but it will cause a minor headache trying to get output. By default, LyX adds \usepackage[T1]{fontenc} to every document. According to the NRC manual, this is a bozo no-no. So you need to go to Tools -> Preferences... -> Outputs -> LaTeX and change "TeX encoding" from "T1" to "default". At this point, you have two choices. If all you're ever going to use is the NRC classes, click Save. That gets rid of the encoding line in every LyX document. If you plan to use other classes, though, you're probably going to want to click Apply but not Save. That applies it only to the current session. Unfortunately, that also means you have to remember to do this every time you futz with an NRC document. (Maybe Richard or somebody knows a way to make this document-specific, or to slip it into the layout file. I don't.)

One last thing. There are some options for each of the NRC packages, such as 'leqno' for NRC1 (which I assume moves equations numbers from the right margin to the left). If you want to specify any of those for a document, just go to Document -> Settings... -> Document Class and stuff the options, separated by commas, into the aptly named Options field. No need to mess with the layout file.

Let us know if the attached layout file blows up on you.

/Paul
#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass{article (NRC)}
# Article textclass definition file. Taken from initial LyX source code
# Author : Matthias Ettrich <[EMAIL PROTECTED]>
# Transposed by Pascal André <[EMAIL PROTECTED]>
# Heavily modifed and enhanced by serveral developers.

Format 4
Input stdclass.inc

SecNumDepth             3
TocDepth                3

NoStyle Chapter
NoStyle Chapter*


Style Part
        Align                 Left
        AlignPossible         Left
        TopSep                2
        BottomSep             1.5
        Font
          Size                Larger
        EndFont
End


Style Part*
        Align                 Left
        AlignPossible         Left
        TopSep                2
        BottomSep             1.5
        Font
          Size                Larger
        EndFont
End

Reply via email to