I'm using LyX together with the Springer Journal LaTeX template to write a document. I'm also using the Algorithmic Environment module to create an algorithm layout within my document. The problem is that every time I compile the file, I get the following error:

No counter 'chapter' defined.

I found the line that is causing the problem and is this:


Basically, the Springer template is not divided in chapters, but in sections, so I decided to use the LyX preamble and correct this by writing:


But it seems it is not working because I keep getting the same error on the same line, like if I hadn't written anything in the preamble. Does anybody know how can I solve this?

I'm using LyX 2.1.2 on a Mac.


In the Document > Settings... > LaTeX Preamble, re-enter the Algorithm float as a Local Layout:

Format 49
    Type                  algorithm
    GuiName               Algorithm
    Placement             tbp
    Extension             loa
    NumberWithin          none
    Style                 ruled
    ListName              "List of Algorithms"
    IsPredefined          false
    UsesFloatPkg          true
    RefPrefix             alg

This respecifies that an Algorithm should not have any "NumberWithin" attribute, and therefore will be defined using the float package (UsesFloatPkg is set to true) without the [chapter] appendage.

enter image description here

  • Thank you very much @Werner! It worked perfectly fine. I really appreciate your help! Oct 31 '14 at 13:38

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.