In OpenOffice and Microsoft Word it takes seconds to create a new paragraph style. Here is how I currently use LyX with the KOMA Script document class to mark text as a quotation:

  1. Type some text.
  2. Click the layouts drop-down.
  3. Click Quotation.

At this point, the text typed in step 1 is rendered as a quotation. The look of the quotation (for example, adding a border or changing its colour) can be altered by adding code to the preamble. All good here.


The Customization guide for LyX talks about adding a new document class, new styles, new layouts, etc. But the documentation does not say how to create a new text layout (like quotation) and have it show up in the menu.

I could create the new layout in the preamble, then insert LaTeX code before and after the text that I want to stylize. But that seems to run counter to how to wield LyX.


  1. What is the formal name for the layouts in the drop-down? (Style, layout, template, paragraph style, etc.? It is difficult to search for something when the name seems to have several synonyms.)
  2. Without copying and pasting KOMA Script's .class file, what are the exact steps needed to add a new layout, such as a "warning" box, and make it available from the LyX drop-down?

For example:

  1. Create a new file called warning.inc.
  2. Copy the contents from pastebin.com/etc.
  3. Copy warning.inc into $HOME/.lyx/layouts.
  4. Update the document preamble as follows:
  5. Click Tools » Reconfigure.
  6. Restart LyX.
  7. Type some text.
  8. Click Warning from the drop down.
  9. Render the PDF to see the text in a box with a red border.

A simple, working example of steps, such as the above, to create a new "paragraph style" would be fantastic. Nearly all the documentation I have read shows how to set up a Document Class and define your own Templates (or Styles). Unless I have misunderstood something, I already have a Document Class: KOMA Script v2. I don't want to copy it (because if a new version is released, I have to merge if I upgrade): I want to extend it.

Thank you!


2 Answers 2


in the file stdlayouts.inc you can copy the definition for quotation to a part called "myquotation". In the file stdlists you can see at the end how additional preamble commands can be made which are hided from the normal user. After changing your layout file run reconfigure and restart lyx, there should now be a "myquoation" in all styles which support this kind of environment.

Here is an example for an LyX environment MyQuotation

Style MyQuotation
    Category              MainText
    Margin                Static
    LatexType             Environment
    LatexName             myquotation
    NextNoIndent          1
    LeftMargin            MMM
    RightMargin           MMM
    ParIndent             MM
    ParSkip               0
    ItemSep               0
    TopSep                0.5
    BottomSep             0.5
    ParSep                0
    Align                 Block
    AlignPossible         Block, Left, Right, Center

insert it into the file stdlayouts.inc and save the file in your local .lyx/layouts/ directory (don't know how it shopuld be on windows). Then run reconfigure and you shouöld see the paagraph layout MyQuotation which then gives a framed output. alt text

  • Where do I put the files? How do I change the definition to make a box with a red border? Thank you. Commented Dec 20, 2010 at 22:17
  • it should also be possible to see it in the LyX window witha a red border. However, with the above layout changes you can use it as a default quation environment which has a red framed quoatation.
    – user2478
    Commented Dec 21, 2010 at 8:26
  • Dank. Dies ist eine großartige Erklärung. I have not tried it, yet, but will presume it is correct. Commented Dec 21, 2010 at 14:19

I'm not a LyX user, but here's something that I understood from an (unfortunately, now dead) link. (Note, it requires the 1.6 or higher version of LyX.)

You need to

  1. First procure an appropriate warning.module file. Either have someone with LyX voodoo write it for you, or do it using the instructions given in the now dead link.
  2. Put warning.module into $HOME/.lyx/layouts/, where $HOME/.lyx should be replaced by appropriate user directory if different.
  3. Go to Tools -> Reconfigure
  4. Restart LyX
  5. Load the module to use for your current document by going to Document -> Settings -> Modules and selecting the newly installed module. Note: you shouldn't have to add anything to the preamble. The way the module files are written suggests to me that the appropriate preamble texts should be added when you load the module.
  6. Profit!!!

You can test this set of instructions against some of the modules given here to see if if they work. (BTW, I think the name that you should search for is "layout modules".)

For writing the module, in view of the note in step 5 above, you will need to put the text you want for the preamble in the Preamble section in the module file.

Edit: Ah, I see the problem. You are not just asking about Layouts! You also want to be able to access it in the toolbar. In that case you may also want to look at this page. You will need to copy the system default.ui to $HOME/.lyx/ui/, and merge in the changes from the *inc file that you found or wrote. Then fire-up LyX, select the now customized user interface file from Edit -> Preferences -> Look and Feel -> User Interface, and restart LyX.

  • @Willie: I have read both of those pages before. While they are useful in their own right, they leave many technical questions unanswered. Such as: where do files go? What are they named? What is the minimum effort required to get something working? Also, it states, "A particular document may only use one document class/layout file, but many packages/styles/modules." That sentence seems to be in conflict with a "layout module". There are more questions I have, but you get the idea. Looking for a simple example. Commented Dec 10, 2010 at 14:18
  • Doesn't the second page state up front that the *.module files go straight in to the layouts folder of your user directory? So I think that tells you (a) how they are named and (b) where they go. ... And how does that sentence conflict with a "layout module"? I actually don't "get the idea", since to me those two pages are perfectly clear. Perhaps you should edit-in those two links to your question, and point out exactly what confuses you? Commented Dec 10, 2010 at 15:33
  • @Willie: This is a great answer. I still am unclear about a few things: Where does the code for a red border around the text go? That is, how do you stylize the text? Preamble? Module? Inc file? Thank you, by the way, for all your help. Commented Dec 10, 2010 at 16:59
  • @Willie: Also, the link to the UI shows how to put items into the toolbar. Not quite what I'm looking to do. The toolbar shows a drop-down selection box with "ListePuces". The link you supplied does not detail how to insert elements into that list -- only to add items to the toolbar or update the menu. The drop-down list is neither a toolbar icon nor a menu option. Commented Dec 10, 2010 at 17:05
  • @Willie: Even though you explained that I need to procure a module, there remains a technical detail that is not explicit: where are the modules found and what module would be an acceptable starting template? Commented Dec 10, 2010 at 17:08

You must log in to answer this question.

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