From http://stefaanlippens.net/customLaTeXclassesinLyX
Sometimes, for example when writing an article for a conference, one need to use a custom LaTeX document class, recommended by the conference author guidelines. The procedure to make LyX using this custom document class is non obvious and a bit involved. It is broadly explained in the LyX manual (Part Customization, Chapter 5 Installing New Document Classes, Layouts, and Templates), but here is the short version (for teTeX on Linux or related systems, I don't know about Windows):
Get the LaTeX document class file, e.g. funkyarticle.cls.
Put this class file where LaTeX could find it. I use for example the directory ~/texmf/tex/latex/ in my own home directory (it has to be precisely the ~/texmf/tex/latex/ directory structure, otherwise it does not work). That way I don't have to mess with my system (for example in directories as /usr/share/texmf/tex/latex/) as administrator. This pages is more elaborate on installing custom LaTeX stuff
Run texhash from the command line. This updates (La)TeX's database (it creates ls-R files, e.g. look at ~/texmf/ls-R).
Make a LyX layout file matching the custom LaTeX class file, e.g. funkyarticle.layout. Put it where LyX can find it, e.g. in ~/.lyx/layouts/.
The LyX layout file declares how LyX has to format your text (LyX does not use the LaTeX layout system and settings). A very minimal LyX layout file could be this: ((((
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[funkyarticle]{article (funky)}
# Input general definitions
Input stdclass.inc
)))) just copy the materials within ((( and )))
For conference articles I use for example something like
(((
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[funkyarticle]{article (funky)}
# Input general definitions
Input stdclass.inc
MaxCounter Counter_Section
Style Section
Align Center
Font
Shape SmallCaps
EndFont
End
)))
You can find more elaborate examples to base your layout file on in your global LyX layout directory (/usr/share/lyx/layouts/ in my case, search for *.layout files).
The second line of the layout file is very important and has to be tailored to your particular case: in \DeclareLaTeXClass[foo]{bar} the foo refers to the LaTeX class file foo.cls and bar is how this class will be called in the LyX interface.
Start LyX and choose "Edit" > "Reconfigure". Close Lyx.
Restart LyX. Under "Layout" > "Document" > "Layout" > "Document class" the newly created LaTeX/LyX class should now be selectable (as "article (funky)" in our example)
No comments:
Post a Comment