For writing with LaTeX I prefer using LyX because it hides the ugliness of LaTeX source code behind a pseudo-WYSIWYG frontend (the developers call it WYSIWYM: what you see is what you mean). Including mathematical expressions, however, is very LaTeX minded and comfortable: you type LaTeX math constructs (stuff with _, ^, \sum, ...) and LyX directly visualises it as a pretty printed formula. For the advanced LaTeX constructions not available in LyX's interface one can always fall back om "raw LaTeX" input fields. In short, I think LyX is a very handy compromise between the power of LaTeX and the user friendliness of a WYSIWYG system.
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
texhashfrom the command line. This updates (La)TeX's database (it createsls-Rfiles, 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.incFor 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 EndYou 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}thefoorefers to the LaTeX class filefoo.clsandbaris 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)
Great article
That was simple enough! Very useful article.. Thank you.
Capitalization and Styles
Worked wonderfully. Just note the .cls file type has to be in small caps. (Unlike PNASTWO.CLS for instance).
Any crash manual on using custom .sty files?
Awesome! thanks, works for me
Awesome!
thanks, works for me lyx 1.6.4
Worked for me
I followed the basic layout file and got it working for Roger Cortesi's Handout Class. (On Lyx 1.6.5)
http://rogercortesi.com/portf/latex/
Thanks!
I have followed the
I have followed the instruction and when i load LyX , it finds the custom document class but when i select it, the application hangs.
Any idea?
Regards
Sajjad
llncs
Thanks very much, it worked for me with lyx 1.4.4
problem with lyx
Hello,
I have done all your recommendations but I am still having the same problem. Lyx cannot find the class.
I have installed lyx 1.5.6 in kubutun.
thanks
Carlos Sosa
I also get the same problem
I also get the same problem with Lyx 1.5.6 in Windows.
Post new comment