Install style files in LyX

Sep 19, 2009

LyX is a frontend to LaTeX and so installation of any style file in LyX essentially mean: (1) installation of that style file in underlying LaTeX; and then (2) getting that style file work in LyX (using LyX layout files). Installation method for different types of style files are given below:

Install LaTeX class (.cls)
  1. create new directory with name <your-class-name> under /usr/share/texmf-texlive/tex/latex/
  2. copy <your-class-name>.cls file (& other files, if present) in the new directory
  3. sudo texhash
  4. create  a file <your-class-name>.layout in ~/.lyx/layouts
  5. edit the layout file according to the instructions given in Chapter 5 of "Customizing LyX: Features for the Advanced User" (Help->Customization in LyX).
  6. open LyX and click 'tools -> Reconfigure' and restart LyX when done. The new Document Class should be available now.
For Example, to install IEEEconf class file, download the zip files from here. Create .cls file by executing 'latex IEEEconf.ins'. Copy the folder IEEEconf to /usr/share/texmf-texlive/tex/latex/. Run sudo texhash. Find IEEEtran.layout file & copy it to a new file named IEEEconf.layout in ~/.lyx/layouts (IEEEconf and IEEEtran are very similar, so IEEEtran-layout file can be used as layout file for IEEEconf). Edit the the second line in IEEEconf.layout from
# \DeclareLaTeXClass{article (IEEEtran)}
to
# \DeclareLaTeXClass{article (IEEEconf)}
and it should turn up when you reconfigure LyX.
Install LaTeX style (.sty)

Style file (.sty) is an addition to class files (.cls) files and they provides special formatting rules which overrides the similar rules in class  files, if present. So each style file must be associated with a class file. Installation process is similar to that of class files (see previous section of this post). Layout files (step 5 above) have different format. Instructions are given in Chapter 5 of "Customizing LyX: Features for the Advanced User" (Help->Customization in LyX).

For Example, to install ACRA style file, download the files from here. Copy the file acra.sty to /usr/share/texmf-texlive/tex/latex/ACRA/. Run sudo texhash. Find article.layout file & copy it to a new file named acra.layout in ~/.lyx/layouts (acra.sty uses "article" class). Edit the the second line in acra.layout from
#  \DeclareLaTeXClass{article}
to
#  \DeclareLaTeXClass[article, acra.sty]{article (ACRA)}
Then add in next line

Preamble
    \usepackage{acra}
EndPreamble


and it should turn up when you reconfigure LyX.

Install BibTeX Style (.bst)
  1. create new directory with name <your-bib-style-name> under /usr/share/texmf-texlive/bibtex/bst/
  2. copy <your-bib-style-name>.bst file (& other files, if present) in the new directory
  3. sudo texhash
  4. open LyX and click 'tools -> Reconfigure' and restart LyX when done.
  5. open LyX and click 'tools -> TeX Information' and choose BibTex Styles. Click 'Rescan' The new BibTeX should be available now.

Comments (7)

Loading... Logging you in...
  • Logged in as
and what abut Windows ?! please help me on windows. I need it in weindows. I try to use one cls file , but I cannot
1 reply · active less than 1 minute ago
Most probably you have to install that .cls file in MikTeX. This page might be helpful: http://docs.miktex.org/manual/localadditions.html
For LyX layout you may create the layout file here (Windows 7): C:\Users\<userName>\AppData\Roaming\lyx16\layouts
Hello, I still haven't worked it out. However, there is an alternative way that seems even easier: 1) save the .bst file in any folder. 2) click on the bib-desk field at the bottom of the Lyx document. 3) Browse under `style' and select the .bst file. And done. Cheers, Mark
Hello! Well, I followed your instructions on how to install BibTex Style (.bst) - and yes, I can see my new file in Lyx. However, when I click `View', all I can see is the first symbol of the .bst file (in this case %). Not surprisingly, I cannot use the file. Any ideas? Thanks!
Mark
2 replies · active less than 1 minute ago
No, I cannot think of any reason. But I will try to install some new .bst files and will check if I can reproduce your problem.
Thanks a bunch, that's brilliant!
Your description helped me solved an issue.
Thank you very much...
Cheers.

Post a new comment

Comments by