I tried to make a layout file supporting the scrpage2 package, which is the koma-script way of customizing the page headings. This package support extra pagestyles, such as "scrheadings".
So I put this in my .layout file: PageStyle scrheadings Classoptions PageStyle "empty|scrheadings" End Preamble \usepackage{scrpage2} EndPreamble All this works with the LyX user interface, I can now specify the "scrheadings" page style in document settings. Unfortunately, at latex generation time I get this: \documentclass[12pt,norsk,smallheadings]{scrbook} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{geometry} \geometry{verbose,letterpaper} \pagestyle{scrheadings} . . . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. \usepackage{scrpage2}% Head/foot The problem here is that \pagestyle{scrheadings} happens early, before \usepackage{scrpage2}. The latter comes from the .layout file. But \pagestyle{scrheadings} is not understood until "scrpage2" is loaded. So I get a latex error. The simplest fix I can imagine is to output the \pagestyle command _after_ the preamble from the .layout-file. Testing shows that this one change is enough - I can make a PDF again. Making this change in lyx will give more options when making .layout files. I filed this as a wishlist bug - current lyx makes no promise about pagestyles in extra packages. But the .layout mechanism have fields for specifying free-form page styles, and scrpage2 is an official add-on package for the popular koma-script classes. Would you be interested in a patch that makes LyX hold back \pagestyle{} to after the .layout preamble, or is the current freeze absolute? It looks like a simple low-risk thing to me. Helge Hafting