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
Thank you very much!!!!!!!
ReplyDeleteThis is exactly what I was looking for two days now.
Regards HoWil
Same for me !
ReplyDeleteThank you
Thank you, for solving my problem by a perfect how-to. I was facing exactly the same problem.
ReplyDeleteRegards
Also worked for me.
ReplyDeleteThank you!
I got the following error:
ReplyDeleteThe selected document class
article(myarticlename)
requires external files that are not available. The document class can still be used, but the document cannot be compiled until the following prerequisites are installed:
myarticlename.cls
See section 3.1.2.2 (Class Availability) of the User's Guide for more information
So what is wrong? I followed exactly the same procedure as listed above
I also got the same error as the above user has.
ReplyDeletewhat is wrong?
I even use sudo texhash to do it.
I got the same error as the Anonymous3/10/2012 06:59:00 AM.
ReplyDeleteSame problem - prerequisites are not installed.
ReplyDeleteI had the same problem as everybody above. That was because, as the source http://www.paulkiddie.com/2010/02/adding-custom-class-files-cls-to-lyx-in-windows-vista-windows-7-environment/ instructs, the command `texhash` needs to be run before reconfiguring LyX. Of course, in Linux that would be `sudo texhash`.
ReplyDeleteThank you for the update, very nice site..
ReplyDeletenescafe
Ordinarily one searches for a bundled alternative, downloadable, and I was dealing with the free and not all that free, the working and not all that working and I went over this little diamond called Zamzar. www.altoconvertpdftopng.com
ReplyDeleteDoremisoft Mac AVCHD Converter is a viable answer for you to effectively dispose of the considerable number of issues subsequent to changing over MTS to MOV, on the grounds that MOV document design is locally record position upheld by QuickTime, iMovie or Final Cut Pro X.AnyConv
ReplyDeleteThe most amazing feature of the Free FLV to MP4 Converter is that it offers high end technical advanced video settings to better the quality and also enhance it according to the fancies of the user. flv to mp4
ReplyDeleteAnd what can be a better choice than the data science field which is currently running on a boom with millions of job positions getting opened every month. 360DigiTMG data science training in hyderabad
ReplyDeleteThanks for the Information.Interesting stuff to read.Great Article.
ReplyDeleteI enjoyed reading your post, very nice share.
Data Science Course Training in Hyderabad
Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!Thanks https://www.postinweb.com/ontiva-the-best-tool-for-youtube-converter/
ReplyDeleteIm really impressed by it.I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing. Great efforts. data science training
ReplyDelete"Thanks for the Information.Interesting stuff to read.Great Article.
ReplyDeleteI enjoyed reading your post, very nice share.data science training"
I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it!
ReplyDeletedata science courses