LyXCannot Add a Basic Style to an Exisiting Layout

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

Cannot Add a Basic Style to an Exisiting Layout

Post by efroselli »

Hello, newbie here. Excuses if this topic is too basic, but I've been searching for days and cannot find the information that I need.

I'm writing documentation for a company that uses Lyx, and has a company layout which adds a few new styles to the front matter of the documents.

I want to learn to add some other new styles to this layout file.

What I did was to copy-paste one of the existing styles in the document, rename it and then just edit a few lines, to see if I could get an effect.

More specifically, the layout file, mycompany.layout, contained a style defined as follows:
****
Style DocumentID
Margin Static
LatexType Command
Category FrontMatter
InTitle 1
LatexName documentid
LabelSep xxx
ParSkip 0.4
TopSep 1.3
BottomSep 0.7
ParSep 0.7
Align Center
LabelType Static
LabelString "Document No."
Font
Size Large
EndFont
End
****

I copy-pasted this block of text farther down at the end of the same document and made the following modifications:
****
Style Note
Margin Static
LatexType Command
Category Unnumbered
InTitle 0
LatexName Note
LabelSep xxx
ParSkip 0.4
TopSep 1.3
BottomSep 0.7
ParSep 0.7
Align Block
LabelType Static
LabelString "Note:"
Font
Size Large
Family Sans
Color Red
EndFont
End
****

Then I did Tools>Reconfigure in Lyx and closed and restarted Lyx.

My new style appears in the Unnumbered section of the Environments list, and within Lyx I can apply it. It shows up on screen as a big ugly red paragraph. In the LaTeX source screen, I can see
\Note{my text here}
So far, so good.

But when I try to compile the PDF I get that infuriating message:
****
Undfined control sequence
\Note
{Key functions provided by the MediaControlCenter are:}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
****

I've tried all sorts of things, such as adding \usepackage{color} to the preamble, or separating this Note out as a different file called Note.sty and adding \usepackage{Note}, but I keep getting the error.

I've also tried to add the Note.sty layout via the Package Manager in MikTeX but it cannot find it. When I point it to the local directory where I put the file, (C:\Program Files (x86)\LyX 2.0\Resources\tex) it just complains.

And this is just an experiment - it's not even how I want my style to look.

I'm getting very frustrated as it seems to take days to do the simplest formatting tasks with Lyx and my job is to produce the documentation, not fight with formats till kingdom come. I worked with FrameMaker previously and am almost ready to throw up my hands and demand a Frame license from my new company.

Thanks to anyone with patience for my distress.

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

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Cannot Add a Basic Style to an Exisiting Layout

Post by scottkosty »

If you don't get help here, I recommend writing to lyx-users@lists.lyx.org

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

Re: Cannot Add a Basic Style to an Exisiting Layout

Post by efroselli »

Replying to myself here. My Manager has shown me that need to define the style not only in the layout file but also in the class we are using (a customization of Koma Script). The layout only seems to affect what is shown on screen, and not what outputs to pdf.
Post Reply