Karakas Online

5.1. LyX environments

Different parts of a document have different purposes; we call these parts environments. Most of a document is made up of regular text. Section (chapter, subsection, etc.) titles let the reader know that a new topic or subtopic will be discussed. Certain types of documents have special environments. A journal article will have an abstract, and a title. A letter will have neither of these, but will probably have an environment that gives the writer's address.

Environments are a major part of the “What You See Is What You Mean” philosophy of LyX. A given environment may require a certain font style, font size, indenting, line spacing, and more. This problem is aggravated, because the exact formatting for a given environment may change: one journal may use boldface, 18 point, centered type for section titles while another uses italicized, 15 point, left justified type; different languages may have different standards for indenting; and bibliography formats can vary widely. LyX lets you avoid learning all the different formatting styles.

The Environment box is located on the left end of the toolbar (just under the File menu). It indicates which environment you're currently writing in. While you were writing your first document, it said “Standard,” which is the default environment for text. Now you will put a number of environments in your new document so that you can see how they work. You'll do so with the Environment menu, which you open by clicking on the “down arrow” icon just to the right of the Environment box.

Important Don't use the "Paragraph" environment!
 

Use "Standard" instead! Using "Paragraph" interferes with the changes that runsed and sedscr try to effect in the SGML code as exported by LyX. Writing paragraphs in LyX is treated in Section 5.5 - although there is actually nothing more to say on this subject for the moment. Just choose "Standard" and write.smile

An important thing to keep in mind is that whatever environment you set in LyX, it will NOT, per se, affect the formatting of your document! LyX environments tell something about the structure of the document, never about its formatting (at least not in the context we will be using them here, i.e. as equivalent to SGML tags). Thus, an environment of “Standard” will induce the <para> tag when exported to SGML from LyX. The following quote from the sgml-tools mailing list deals with a common misconception of <para> (see Use of <Para> within <ListItem> mangles list items):

> I think the definition of <Para> means to start on a new line and break on a new line.

At the risk of being pedantic, I think you're making a mistake of interpreting DocBook markup tags as having any bearing on format, which they do not. This is unlike many HTML tags, so if that's the particular SGML DTD that you have more experience with, it may be coloring your intepretation.

DocBook tags (and to be honest, most SGML DTDs) are used to identify the type and purpose of information, but not how that information might be portrayed in a formatted fashion. That's part of the whole power of it - by separating formatting/display from content, you are free to both ignore such issues when documenting, and yet be totally flexible during formatting on how you want to present marked up text.

In DocBook, the <Para> element is just defined as a "paragraph", a container sort of element for other inline, and some block, elements. It says nothing about starting nor breaking on a newline, although of course such could be selected by a style sheet as an implementation. In that respect the more tags you have in a document (and the more granularity of the information so tagged) the better - it gives the formatter and style sheet the most flexibility in handling how the formatted output should appear.

We talk about stylesheets in Section 4.2, Section 4.14, Section 7.1.5, Section 7.1.8 and Section 10.3.2.1.

Last updated Mon Sep 24 01:19:25 CEST 2007 Permalink: http://www.karakas-online.de/mySGML/lyx-environments.html All contents © 2002-2007 Chris Karakas