LyXHow to create new environment in Lyx?

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
efroselli
Posts: 24
Joined: Wed Feb 20, 2013 1:24 pm

How to create new environment in Lyx?

Post by efroselli »

Hello,

I am using a layout based on the Article class. It is missing a paragraph style (environment) that I really need.

This would be an environment similar to the ones called Paragraph or Subparagraph. It would appear in the bookmarks, but unnumbered and at any point in the hierarchy. It would be similarly bolded.

However, when followed by another paragraph in the Standard environment, it would not be inline, but the Standard paragraph would start on a new line.

Ideally, the new style might also have a fancy graphical bullet, like an arrow or a pointing hand.

The purpose of this environment is to define the titles of procedures in technical manuals. For example,

To create the database model

This is normally followed by a numbered list of steps. Using the Enumerate environment, I get the look I want, but if there is only one step in the procedure, it looks silly to have a numbered list with only one item.

Also, I need a separate Environment for this because that should make it easier to parse the document on it, if ever I get into single-sourcing with XML, for example.

It would also be useful to be able to create a TOC of just the paragraphs in this style, with their page numbers (IOW, a lookup table of procedure titles). I'm used to doing that in FrameMaker but trying laboriously to convert to Lyx in my new firm. Can this be done?

Thanks for guidance. I'm still quite a newbie.

EFR

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

efroselli
Posts: 24
Joined: Wed Feb 20, 2013 1:24 pm

How to create new environment in Lyx?

Post by efroselli »

Answering myself again:

I've got something approximating what I want by adding the following in my Local Layout:

Code: Select all

Format 35
#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[book]{mybook}

Input stdclass.inc

Preamble
\newenvironment{ProcTitle}{%
    \topskip 10in
~\\\\
  \bf
\large
\sffamily
{>>}
}

EndPreamble

Style ProcTitle
  CopyStyle  Paragraph
LatexType	Environment
LatexName	ProcTitle
LabelString           ">>"

End
But it's very close to guesswork and there's probably a much more elegant way of doing it. Also the LabelString ">>" in the Lyx layout doesn't show; it would be nice if it showed as that would help distinguish it from the Paragraph environment.

Also, what is the meaning of the first two lines?

Code: Select all

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[book]{mybook}
I'm not using a class called {mybook} but a custom class created by my firm.

I know I need to transfer the Preamble part to the class and the Style ProcTitle part to our layout, but I will wait to see if I can't improve on this before going ahead.

Thanks for any pointers and advice. I know this is a Frequently Asked Question (indeed, I mself have asked it before) but I can't find any clear guidelines on how to create new environments in Lyx. For example, I have an old O'Reilly LaTeX guide, but I try things out from there and they don't seem to have any effect on my output. I tried using parskip instead of ~\\\\ above but nothing showed.

Ta,

EFR
Post Reply