Oxford has instructions to set up CLS file for Lyx here so this thread for Aalto uni. So

How can you use Aalto custom CLS file in Lyx?

Aalto files


As mentioned similar quostion here. The CLS file uses the document class Article. It seems that easiest is to set up local aaltothesis.layout file for your thesis, not working yet: errors documented below. Other option is to put it under /Applications/LyX.app/Contents/Resources/layouts/ but so far at least not working in my OSX Lyx.

The Aaltothesis.cls custom document class loads many options


where some of them such as inputenc are automatically loaded in Lyx: now need to find out how to load Custom Document Class in Lyx.

Under construction.

Steps in OS X

  1. Write your Lyx Layout for article according to the line \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}% in Aalto CLS file:

$ cd /; find . -iname "article.layout"


where we need to customise this layout by first changing the line \DeclareLaTeXClass{Article (Standard Class)} such that

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[aaltothesis]{Aalto Math dept}
#  \DeclareCategory{Articles}
# Article textclass definition file. Taken from initial LyX source code
# Author : Matthias Ettrich <ettrich@informatik.uni-tuebingen.de>
# Transposed by Pascal André <andre@via.ecp.fr>
# Heavily modifed and enhanced by serveral developers.

Format 49 Input stdclass.inc

SecNumDepth             3 TocDepth                3

NoStyle Chapter NoCounter chapter NoStyle Chapter*

Style Part
    Align                 Left
    AlignPossible         Left
    TopSep                2
    BottomSep             1.5
      Size                Larger

Style Part*
    Align                 Left
    AlignPossible         Left
    TopSep                2
    BottomSep             1.5
      Size                Larger
Provides inputec 1
  1. Either use old aaltothesis.sty file with \usepackage[sci]{aaltothesis} such as here or use the new Class file with \documentclass[sci,parameters]{aaltothesis} but the problem is that it is not totally straight-forward in Lyx.

  2. ...

TRIALS on the errors

8th June: None of the trials working yet. My friend told me that the ELEC template is supposed to be used this way \documentclass[english,12pt,a4paper,pdftex]{report} \usepackage[sci]{aaltothesis} in preamble (see Trial 3). I am getting odd Inputenc err where loading things twice, cannot yet see what is causing this.

Trial 1 for the step 3 (that is not yet working, skipping it with local layout): use local layout if LaTex cannot find the *.layout file

enter image description here

where move the *.layout file to your local dir

enter image description here

where getting new errs due to changing from Report document class to the Aaltothesis-article document class (not working yet).

Trial 2 document with only text testing aaltothesis.layout and aaltothesis.cls in local dir and using the aaltothesis.layout as a local version

enter image description here

where getting err that 'aaltologo.sty' not found "LaTeX Error: File 'aaltologo.sty' not found." so copy the aaltologo.sty from here to your local directory.

enter image description here

where I have empty preamble and getting next errors.

TRIAL 3 Premable with (OLD: aaltothesis.sty pkg has changed to CLS)


but err

enter image description here

such that

The package inputenc has already been loaded with options:
There has now been an attempt to load it with options
Adding the global options:
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.

where a peculiar amsmath err. I tried the change in LyX: Document Settings > Math Options > Load automatically ALL to Do Not Load ALL but same err

enter image description here

where this change did not alter the err. What is causing things to be loaded twice in LyX?

TRIAL 4 Preamble with (OLD: aaltothesis.sty has changed to CLS)


and comment out all lines to inputenc (Lyx loads Inputenc by default with latin9 by this)

enter image description here

where a mysterious file aaltothesis.sty missing, what is this? Only with aaltothesis.layout (generated), aaltologo.sty, aaltothesis.cls -- ideas, how/where to get this aaltothesis.sty?

TRIAL 5 [BUG I discovered, patch below] Empty preamble, trying to use aaltothesis.cls where Class options should be sci but I am getting peculiar Missing number, treated as zero with sci and without sci

enter image description here

where closer in logs (for reading logs in Lyx, see here)

enter image description here

and now I am uncertain.

enter image description here

TRIAL 6 with Patch I [BUG II uncovered] First time compiled with only hello world but no macro working such as \department{...}

enter image description here

enter image description here

where Warning and Runaway argument around lines 164-171? Chat here. I tried different settings here such as \value{page}, \thepage, \arabic{page}, \arabic{\value{page}} but the same warning last -- no other error until this. Is this causing things to fail so not reading the next commands such as \degreeprogram correctly?

[Update 2016 June 9th] Mvim points out that lines 770-773 has some mismatched }, there are 2 pieces less } than { in aaltothesis.cls, chat here.

Full log about the current error here, UNSOLVED.

Global setup (Unnecessary)

  1. Making files globally available Move the CLS file texmf folder to make it available $ cp *.cls ~/Library/texmf/ Where do I place my own .sty or .cls files, to make them available to all my .tex files?

  2. Tools/Reconfigure and restart Lyx and then Document/Settings/Document Class and pick up Aalto class [Error here, perhaps have to restart computer...?]

enter image description here


  1. aaltothesis.layout (remix from standard article article.layout) where name change to aaltothesis layout from article and Provides inputenc 1 on the last line addition

  2. aaltothesis.cls (where article used so hence article.layout chosen as default, right?) and copy here if the link expires about the aaltothesis.cls

  3. aaltologo.sty and its landing directory here


  1. for fast debugging: Lyx > Document Settings > Local Layout

enter image description here

BUGS in Aaltothesis.cls

I. "the class sets the counter to \thepage, this is a fault in the class --\thepage can be text and so shouldn't be used to set counters."

Solution by David use \value{page} not \thepage

II. TRIAL 6 uncovered mysterious Runaway argument warning and we found out that the aaltothesis.cls file has 2 curly brackets more than opening brackets. The runaway arguments starts near the first bug of \thepage instead of \value{page}

  • 1
    Thanks, keep us informed of your progress. Comments: 1) You can put everything: cls file, layout file and sty files, in the same directory as your lyx file (use choose local layout file). The question of installing them system-wide is unnecessary at first (you can try Reconfigure to get rid of your "Unavailable" problem). 2) I recommend writing the layout inside the tab Document Preference>Local layout, for a better trial-and-error cycle (apart from the first lines with \DeclareLaTeXClass, that must be in the layout file). – G.M. Jun 8 '16 at 17:13
  • 1
    4) The file thesistemplate.tex shows you what you want to obtain. It is not \usepackage...{aaltothesis} but \documentclass...{aaltothesis}. I don't think there is a aaltothesis.sty file. 5) The cls file contains \LoadClass{article} and therefore you should start by copying article.layout. 6) The beginning of your layout file must be #\DeclareLaTeXClass[aaltothesis]{Aalto Thesis} – G.M. Jun 8 '16 at 20:00
  • 1
    7) for any error The package xyz has already been loaded with options, you can try to add in the layout file: Provides xyz 1 (but first try to change document options in lyx so that the options match, to avoid bad surprises later) – G.M. Jun 8 '16 at 20:05
  • 1
    In this case I recommend to: 1) add Provides inputenc 1. This disables loading of inputenc by lyx. 2) Set Language > Encoding to utf8 so that there is no mismatch between the class and lyx. 3) To pass the option ELEC you can add it under document class options. – G.M. Jun 8 '16 at 20:33
  • 1
    1) Provides inputenc 1 at the end of the layout file, or in this case the setting you mention should work 2) Under Document Settings. 3) Yes. – G.M. Jun 9 '16 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.