Chủ Nhật, 29 tháng 4, 2012

[LyX] Add new class into LyX

1. Create folder bmvc2k at C:\Program Files\MiKTeX 2.9\tex\latex
2. Copy bmvc2k.cls file into the new folder
3. Create file bmvc2k.layout with the content
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[xxx]{article (xxx)}
# Input general definitions
Input stdclass.inc
 
Replace xxx with the class name (here is bmvc2k)
4. Copy the bmvc2k.layout to the folder C:\Program Files\LyX 1.6.9\Resources\layouts
5. In command prompt (type cmd in start menu), type texhash. 
6. In LyX, Tools->Reconfigure, and then restart LyX
7. Open new document and set the new class: DOcument > Settings and select bmvc. If cannot see it, using Local Layout to pen the bmvc2k.layout file in LyX 1.6.9\Resources\layouts

References 
[1] Add new class for Linux
[2] Add new class for Windows Vista/Windows 7 
[3] For windows 

-------------------------------------------------------
Content from [3] is stored here for reservation
 

Adding custom class files (.cls) to Lyx in Windows Vista / Windows 7 environment

by  • February 22, 2010 • lyx, TeX, windows • 9 Comments

When writing for publication, you may be offered a .cls file from the journal in question in which to format a TeX document to their specification. Whilst this works great in TeX, usually by copying the class.cls file in your working directory where all your .tex files reside and adding \documentclass{class} in the preamble (before \begin{document}), using these custom classes isn’t so straightforward in Lyx, so I’ll describe the steps required. I’m using the eethesis.cls class file as an example, which you can obtain from http://www.latex-site.info/. This class file aids in the presentation of a thesis or progress report which meets the requirements of formatting at the University Of Birmingham, UK.
There are a couple of posts I ran across which deal with this specific issue, here and here. None were specific to Windows Vista/Windows 7, so I’ll deal with that here. This assumes version 2.8 of Miktex and version 1.6 of Lyx. If you are using an earlier or later versions, replace with the correct version numbers where I’ve used them.
  1. Get a copy of the class file, and copy it into a folder with the same name into C:\Users\your_user_name\AppData\Roaming\MiKTeX\2.8\tex\latex. So, for eethesis.cls, you should have a folder called eethesis within C:\Users\your_user_name\AppData\Roaming\MiKTeX\2.8\tex\latex. This is Windows Vista / Windows 7 specific, you will soon see why…
  2. Create a new file and paste the following into it:
    #% Do not delete the line below; configure depends on this
    # \DeclareLaTeXClass[xxx]{article (xxx)}
    # Input general definitions
    Input stdclass.inc
    replacing xxx with the class name (without the .cls extension). In my case, xxx is eethesis, and the code above becomes:
    #% Do not delete the line below; configure depends on this
    # \DeclareLaTeXClass[eethesis]{article (eethesis)}
    # Input general definitions
    Input stdclass.inc
    Thanks goes out to http://wastedmonkeys.com/2007/09/27/adding-a-new-class-in-lyx-windows for this.
  3. Save this file to C:\Program Files\LyX16\Resources\layouts, naming it eethesis.layout.
  4. In a command prompt (type cmd in start menu), type texhash. What you will now see it doing is iterating through several folders for new classes, one of which (C:\Users\your_user_name\AppData\Roaming\MiKTeX\2.8\) is where we copied the eethesis.cls class file into.
  5. Within Lyx, hit Tools > Reconfigure, then restart Lyx.
  6. Open a document and click Document > Settings. Click on ‘Document Class’, expand the drop down menu and you should see ‘article (xxx)’ is visible, and usable, (like below) within the drop down menu.
lyx-document-classes

Không có nhận xét nào:

Đăng nhận xét