I tried googling this elsewhere but I'm new to LaTeX and extremely confused about certain things. Basically I downloaded MikteX and I'm using the latest version of Lyx with it. Now all I basically know how to do is make pretty looking mathematics and add contents pages/titles/references/etc.

I'm looking to make a dissertation and my unviersity provides a template, ociamthesis.cls (available for download at that link).

So, what exactly do I need to do (and please be super specific as I am totally clueless to all the jargon I read).

Basically, I need to download ociamthesis.cls in the first line of that webpage. Does it matter where I save it? What exactly do I do next?

  • Have a look here. This seems to be basically the same situation.
    – vaettchen
    Commented Dec 22, 2013 at 5:26
  • Thanks for the help although I am still confused. There are no words for how clueless I am about Lyx right now. Looking at that answer, I have some questions. What is my existing class's layout file? What directory do I need to save it in? Then the editing bit he talks about I don't even know where to begin... so yeah, pretty damn clueless.
    – user43058
    Commented Dec 22, 2013 at 13:35
  • This is very detailed and closer to your situation. It's for a Mac but should work very similarly for Linux.
    – vaettchen
    Commented Dec 22, 2013 at 14:16
  • I appreciate your help. So, just to make this really explicit: All I do is save the file "ociamthesis.cls" in miktex>tex>latex then leave it, or do I go one further and save it in the folder miktex>tex>latex>lyx? After that, i try to save the file "ociamthesis.cls" again but this time I change the ".cls" into ".laylout" then save it in the folder lyx>resources>layouts? then i reconfigure lyx then restart lyx and then the oxford thesis should be a document class?
    – user43058
    Commented Dec 22, 2013 at 14:32
  • I'm sorry I don't know Windows / MikTex well enough to give advice. I'm sure the Apple version can be translated into the Windows world but I don't know how.
    – vaettchen
    Commented Dec 22, 2013 at 17:10

2 Answers 2


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):

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

  2. 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 reveals


    which implies that ociamthesis.cls is based on (or a descendant of) report.cls - something known to LyX. So you should start with report.layout:

    enter image description here

  3. Open report.layout and change it to resemble

    #% Do not delete the line below; configure depends on this
    #  \DeclareLaTeXClass[ociamthesis]{Oxford Math Inst}
    # Read the definitions from report.layout
    Input report.layout

    Save this file as ociamthesis.layout in the same folder.

  4. 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 edit ociamthesis.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.

  5. 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 through ociamthesis.cls and see what else to add to ociamthesis.layout to complete it. For example, since the class report is loaded with the option a4paper, we need to add

      Other "a4paper"

    after Input report.layout.

  6. A feasible final step is to include the remainder of ociamthesis.cls as part of the LyX layout's preamble:

      \RequirePackage{graphicx} % needed for latest frontpage logo
      \RequirePackage{ifthen}   % needed for option parsing for logo
      %define the default submitted text
      \newcommand{\submittedtext}{{A thesis submitted for the degree of}}
      %... the remainder of ociamthesis.cls
  • Give some feedback if you experience problems. I've never transformed a .cls to a .layout.
    – Werner
    Commented Dec 24, 2013 at 8:09
  • I am trying to tweak this help for different CLS file here that is apparently based on Article document class, could you overview it? I am trying to follow your instructions step-by-step and reporting errs encountered so far in OSX lyx, the change from Report class to Article class not yet as smooth as hoped.
    – hhh
    Commented Jun 7, 2016 at 20:20

Usually, I have forgotten above procedure when urgently needing to use a template which requires an accompanying class. Hence, a brain-fog-proof method is needed. No texhash or LyX->Tools->Reconfigure required.

  1. Leave the .cls and .layout files in the template's directory
  2. Create the yourclassname.layout file:
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[yourclassname]{article (yourclassname)}
# Input general definitions
Input stdclass.inc
  1. When importing the template.tex file LyX will not be able to detect that it belongs to yourclassname.cls and will produce an error. Instead run the converter directly on the command-line: C:\template_dir_w_class_and_layout_file>"C:\Path_to_this_exe\tex2lyx2.3.exe" -f C:\template_dir_w_class_and_layout_file\template.tex

  2. Assuming some article class derivative delete the Title and abstract sections. Copy those from template.tex and insert into a TeX block (ERT).

  3. Now template.lyx should open and build in Lyx.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .