Lyx: Convert Latex .cls file to .layout in Lyx

I just started using Lyx.
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.






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

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.
 2. Set Lyx to know that
  • 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
  • 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.
 At this point I can import my main Tex file into Lyx program.

Moreover, if you want to set document class for the current open document,
go to Document --> Settings... --> Change Document class to what you want


  1. Thank you very much!!!!!!!

    This is exactly what I was looking for two days now.
    Regards HoWil

  2. Same for me !
    Thank you

  3. Thank you, for solving my problem by a perfect how-to. I was facing exactly the same problem.


  4. Also worked for me.
    Thank you!

  5. I got the following error:
    The selected document class
    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:
    See section (Class Availability) of the User's Guide for more information

    So what is wrong? I followed exactly the same procedure as listed above

  6. I also got the same error as the above user has.
    what is wrong?
    I even use sudo texhash to do it.

  7. I got the same error as the Anonymous3/10/2012 06:59:00 AM.

  8. Same problem - prerequisites are not installed.

  9. I had the same problem as everybody above. That was because, as the source instructs, the command `texhash` needs to be run before reconfiguring LyX. Of course, in Linux that would be `sudo texhash`.

  10. Thank you for the update, very nice site..

  11. 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.

  12. Doremisoft 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

  13. The 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

  14. And 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

  15. Thanks for the Information.Interesting stuff to read.Great Article.
    I enjoyed reading your post, very nice share.
    Data Science Course Training in Hyderabad

  16. 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

  17. Im 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

  18. "Thanks for the Information.Interesting stuff to read.Great Article.
    I enjoyed reading your post, very nice science training"

  19. 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!
    data science courses