The problem is I already have latex (.tex) files and the document class file (.cls)
Basically, Lyx comes with a converter called "tex2lyx", which be able to convert any .tex file into .lyx file to be used in Lyx.
So, what I did is to import the main tex file "thesis.tex" which has content like this:
% This is a template for Ph.D. dissertations in the UCI format.
% All fonts, including those for sub- and superscripts, must be 10 points or larger.
% Recommended sizes are 14-point for chapter headings, 12-point for the main body of text
% and figure/table titles, and 10-point for footnotes, sub- and super-scripts, and text in
% figures and tables.
\documentclass[12pt,fleqn]{ucithesis}
...
\include{introduction}
\include{background}
\include{relatedwork}
...
Unfortunately, when I tried to import I found this error.
$ tex2lyx -f thesis.tex Error: Could not find layout file for textclass "ucithesis".
After searching for awhile, I found that Lyx does not use and cannot understand ".cls" file in Tex. The only Lyx can understand the format of the document is to use ".layout" file. So, how to convert .cls to .layout , and how to use it??
I also found this http://www.paulkiddie.com/2010/02/adding-custom-class-files-cls-to-lyx-in-windows-vista-windows-7-environment/
It shows a way to use ".cls" in Lyx, but it is for Windows, I need to adapt it for using it in Linux.
To summarize, the idea from the link above can be separated into 2 parts:
1. Create new document class for Latex in your system:
2. Set Lyx to recognize the style
1. Create new document class for Latex
- go to main folder of Latex. Mine is at /usr/share/texmf/tex/latex
- create new folder the same name as the class file. So I'll have /usr/share/texmf/tex/latex/ucithesis
- move .cls file into that folder. For this move my "ucithesis.cls" into the folder.
/usr/share/texmf/tex/latex/2. Set Lyx to know that
----------ucithesis/
---------------------ucithesis.cls
- go to layout folder of Lyx. Mine is at /usr/share/lyx/layouts
- create a .layout file. I want to use class "ucithesis", so I create "ucithesis.layout"
- put this text into that file (replace "ucithesis" with whatever class name you want") :
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[ucithesis]{article (ucithesis)}
# Input general definitions
Input stdclass.inc
- this will add new layout into Lyx, but Lyx doesn't know it yet.
- to let Lyx knows it, open Lyx program, then go to Tools --> Reconfigure
- restart Lyx for it to take effect.
Moreover, if you want to set document class for the current open document,
go to Document --> Settings... --> Change Document class to what you want