I was struggling with this myself, until I came across this article. I had to make a few adaptations for my setup as follows (for the purposes of this post, the unavailable document class I wanted to install was called clv2
, for which I had a clv2.cls
file):
Step 0:
This was not mentioned in the article, nor do I know if it's absolutely necessary, but I quit LyX before I started this process.
Step 1:
Copy the clv2.cls file in your latex directory. To find where it is go to LyX > Tools > TeX Information > LaTeX Classes > Show path. For me it was /Users/sylvie/Library/texmf/tex/latex/lyx/.
When I did LyX > Tools > TeX Information > LaTeX Classes > Show path
, I saw /usr/local/texlive/2011/texmf-dist/tex/latex
There was no lyx
directory there, so I had to create one for myself. Then I copied clv2.cls
into /usr/local/texlive/2011/texmf-dist/tex/latex
Step 2:
Make a .layout file with the same name (clv2.layout)
This was very straightforward. I wanted an article
(not a manuscript
) though, so my layout file looked like this:
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[clv2]{article (clv2)}
# Input general definitions
Input stdclass.inc
Step 3:
Copy the clv2.layout file into your package content. For me it was Applications > LyX > Contents > Resources > layouts > clv2.layout
My package content was located at /Users/ashwin/Library/Application Support/LyX-2.0/layouts
, so that's where I copied clv.layout
to
Step 4:
Open a terminal and on the command prompt write sudo texhash (LaTeX will be reconfigured)
This was very straightforward. I was asked for my password, which is normal.
Step 5:
Open LyX, and then go to LyX > Reconfigure, and Restart Lyx
Again, this was very straightforward. No hitches here.
Step 6:
Go to Document > Settings > Document Class > manuscript (clv2)
Since I wanted an article
and therefore changed clv2.layout
, I found an article (clv2)
in my list of document classes.
Hope this helps
To make LyX aware of installed packages, run reconfigure (Tools → Reconfigure).
If you need another package that is required by LyX and not provided by MacTeX, install it in ~/Library/texmf
or /usr/local/texlive/texmf-local
.
If you choose to install in /usr/local/texlive/texmf-local
, you will need to run mktexlsr /usr/local/texlive/texmf-local
in order for TeX to find the files. If you install in ~/Library/texmf
, this is not necessary.
Don't forget to reconfigure LyX again.
As @cfr already pointed out: do not copy stuff from the application package to some place else. Instead do a clean install of LyX
(remove the App with AppTrap or a similar tool if necessary) and MacTeX. Aaand reconfigure LyX.
Best Answer
A layout in LyX is analogous to document classes in LaTeX. Since the provided document class (
ociamthesis.cls
) is not covered by an existing LyX layout, you have to create your own, by following these instructions (also available under Help > Customization; section 5.3 The layout file format):First you have to install the LaTeX class so that it works with LaTeX. A discussion on this is available in Where do I place my own
.sty
files, to make them available to all my.tex
files? that holds also for.cls
document class files.For using this LaTeX class, you'll have to write your own LyX layout. This requires you to find the "basis class" for your new class. The first couple of lines of
ociamthesis.cls
revealswhich implies that
ociamthesis.cls
is based on (or a descendant of)report.cls
- something known to LyX. So you should start withreport.layout
:Open
report.layout
and change it to resembleSave this file as
ociamthesis.layout
in the same folder.In LyX, follow Tools > Reconfigure, and restart LyX. Now
Oxford Math Inst
is the text you will see in the Layout > Document > Document-Class drop-down list. With LyX reconfigured, you can now editociamthesis.layout
and immediately see the effects of it when you recompile. LyX just needed to know where it is located, which took quite a while.It's clear that the above minimal definition just builds the shell for the newly defined class that is based on
report
. Now you have to go throughociamthesis.cls
and see what else to add toociamthesis.layout
to complete it. For example, since the classreport
is loaded with the optiona4paper
, we need to addafter
Input report.layout
.A feasible final step is to include the remainder of
ociamthesis.cls
as part of the LyX layout's preamble: