LyXDifference between Latex preamble and inserting ERT

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Difference between Latex preamble and inserting ERT

Post by insipidtoast »

I could also title this thread: "How to delete extra pages that are created against my will?"

Hello again,

I'm stumped.

I've been reading a guide for creating a book in lyx, and for the first page it says to insert the latex code (the ERT - red box), \frontmatter. This apparently takes away the folios (page numbers) because page numbers are normally not in the frontmatter of books.

When I insert the above latex code at the beggining of the document and then hit Ctrl+R to preview the pdf, it shows a first page blank, and the second page with my book's title.

Now, if I go enter the same command, \frontmatter into the latex preamble, then there is no extra page, and does exactly what I want.

Why?
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class

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

lyxrocks
Posts: 91
Joined: Sat Oct 23, 2010 5:59 pm

Re: Difference between Latex preamble and inserting ERT

Post by lyxrocks »

good question, i was wondering about something similar too!
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Re: Difference between Latex preamble and inserting ERT

Post by insipidtoast »

hahaha...it's so touchy, I'm worried I might run into some formatting issue like this during the middle of the book, and then not know why it happened or how to fix it.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Difference between Latex preamble and inserting ERT

Post by scottkosty »

It's hard to generalize the difference between LaTeX preamble and inserting ERT. In general, I would guess that if you put a command in the preamble it will apply to the whole document and if you put it in ERT it might apply more locally. That said, there are many things you can put in ERT that apply globally.

As far as not knowing how to fix an error, this is why it's important to backup regularly. LyX supports version control and it's also nice that a .lyx file is just a plain text file so you should never break your content.

On a similar note, I've wondered if a "revert to last good compile" would be useful.
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Re: Difference between Latex preamble and inserting ERT

Post by insipidtoast »

HHHhhhAHAHAHAHA another touchy thing I noticed is that lyx recognizes the ERT as a line of text instead of something in the background.

When I enter ERT in the first line of a page say before a chapter heading I can either write the chapter title on the same line as the ERT or press return and write the chapter title on the next line.

On the same line as the ERT, I go to select "Chapter" from the drop down menu and voila the ERT, and also the last line of text on the previous page suddenly turn into the Chapter title.

When I instead press return and write the chapter heading below the ERT, lyx thinks I'm on the second paragraph of the page and thus automatically indents whatever text I write. (I know this is a quick fix in paragraph settings) but still...what were they thinking?!

Does that extra line after the ERT result in the Chapter title being further down the page than on the other chapter pages where there is no ERT?
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
Post Reply