Edit Links |
Layouts /
CreatingLayoutsCategories: Layouts << | Page list | >>Tips and links related to creating your own LyX layout-filesThis page contains tips, notes and links related to creating your own layout-files for LyX. Contents Pages, sites and other resources related to creating layouts
BackgroundThis page answers the FAQ "How do I make LyX recognize a new LaTeX class?" It was created in response to a question in LyxUsersPost:13975 I would like to submit a paper for siggraph, a computer graphics conference, and they defined some guidelines for paper formatting and delivery everybody has to follow. They even provide some LaTeX class and BibTeX style files (acmsiggraph.zip [www.siggraph.org]) but I would love to write the paper not with LaTeX but LyX. Can I use LaTeX class files and BibTeX style files in LyX? Quick'n dirty answerFirst you have to install the latex class and bibtex bst so that it works with latex (put in place and run [ RedHat 9.0 / Fedora Core 1,2,3 : latex class location is /usr/share/texmf/tex/latex; make a directory inside this directory called acmsiggraph and place acmsiggraph.cls inside. The bibtex .bst location is /usr/share/texmf/bibtex/bst/; make a directory inside this directory called acmsiggraph and insert .bst file. The .bib file location is /usr/share/texmf/bibtex/bib; make a directory inside this directory called acmsiggraph and insert .bib file. Now run "texhash" . This will reconfigure latex and make it available for lyx. ] Using their BibTeX style should be very easy. After an Tools>Reconfigure from lyx, it should show up in the drop-down list of available bibtex styles and you can select it as usual. For using their LaTeX-class, you'll have to write your own LyX-layout. (It shouldn't be that difficult...) Find the basis class for your new class.
Lets assume, the LaTeX class #% Do not delete the line below; configure depends on this # \DeclareLaTeXClass[acmsiggraph]{ACM SigGraph} # Read the definitions from article.layout Input article.layout
For a more detailed answer and example files, see the links above. Quick'n dirty answer extendedMost of the times the previous approach results in an exception when trying to create a pdf. The problem is that many latex layouts (.cls) require certain fields especially at the beginning of the document (e.g. title, author). If an example .tex is provided I suggest the following approach:
For those who really want to dig inSee the section "The layout file format" (LyX Documentation: Help→Customization, Section 5.3 (tag "sec:TextClass")). If you want to go a little farther and edit a layout file, you will find there are several common commands: Format 4 # Format of this layout file. 11 is maximum readable by version 1.6. LyX is backwards-compatible, and can read all previous layout formats. Input filename.inc # Includes the contents of filename.inc as if you had typed the contents of filename.inc # instead of this line in your layout. DefaultModule theorems-ams # Use the ams theorems module by default. # Presumably there are various components which import "modules" of additional tex code. For example, if you # use a feature only available in AMSMath, the AMSmath package is included automatically. # the module theorems-ams is defined in /usr/share/lyx/layouts/theorems-ams.module on my machine. Requires amsmath,amsthm # The main purpose of this command # is to stick the LaTeX code "\usepackage{amsmath}" in the # document preamble. (You can see that it does this by using # View->View Source and checking "complete source". # # Note that only supported classes can be included. These are known # as features and included in LaTeXFeatures.cpp Style MyStyleName CopyStyle YourStyleName LatexName mylatexcommand LabelString "My Style:" # Appended to the beginning of the field, so this will read "My Style: <content>" End |