[Tex/LaTex] How to install an unavailable document class for LyX on Mac


I am new to LyX so I'm sorry if this question is really naive.

I'm using LyX on a MacBook and I'm hoping to use the AEA document class on it. Since it is not available automatically, seems that I need to somehow install it on my own. All the help pages I can find talks about layouts and stuff that I, as total layman, have no idea what they are. Can somebody please show me how I can do it with simple language?

Best Answer

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