LyXHow to end a section title with a displayed formula?

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
lyxrocks
Posts: 91
Joined: Sat Oct 23, 2010 5:59 pm

How to end a section title with a displayed formula?

Post by lyxrocks »

how come you cannot end a section title with a "(centered) displayed formula"?

I want something like this:

Section Name(this is of section environment)
Centered Displayed Formula (also of section environment)
Beginning of Theorem (this is of theorem environment)

but it won't compile. it would compile if i change the Displayed Formula into an "Inline" formula, but that's not what i want.

i could make the

Centered Displayed Formula

"standard" environment instead of "section" environment, but then I would have to manually increase the font of the formula every single time, which doesn't seem very sophisticated.

I uploaded the lyx file that wouldn't compile. as you can see, if you change the formula into "inline" then it compiles, but that's not what I want :cry:

thanks in advance!
Attachments
lyxquestion.lyx
(5.04 KiB) Downloaded 267 times

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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

How to end a section title with a displayed formula?

Post by Stefan Kottwitz »

Load the module "Fix LaTeX":
fixltx2e.png
fixltx2e.png (47.84 KiB) Viewed 5985 times
For explanation: when you insert displayed math formulas, LyX uses \[ ... \] which is a so called fragile environment - it breaks in moving arguments, and section arguments are moving: they are expanded and written to the .toc file, causing trouble. Such fragile commands or environments can be protected against expansion or made robust. In this case, the fixltx2e package makes it already robust, so adding the module fixes it.

Stefan
LaTeX.org admin
lyxrocks
Posts: 91
Joined: Sat Oct 23, 2010 5:59 pm

How to end a section title with a displayed formula?

Post by lyxrocks »

thank you the reply!!! it does seem to fix the error, but the file still wouldn't compile due to a new error that is related to the same problem.in both of these screenshots I used the lyxquestion sample file in the OP.

error msg with Fix Latex
with.jpg
with.jpg (22.97 KiB) Viewed 5978 times
error msg without Fix Latex
without.jpg
without.jpg (37.44 KiB) Viewed 5978 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: How to end a section title with a displayed formula?

Post by Stefan Kottwitz »

Perhaps try to narrow it down, and post a new topic. Btw. marking a topic as solved means clicking the checkmark button in the answer/solution, not the question. ;-) The reason is, that it creates a link from the checkmark sign to the solution, for easier browsing.

Stefan
LaTeX.org admin
lyxrocks
Posts: 91
Joined: Sat Oct 23, 2010 5:59 pm

Re: How to end a section title with a displayed formula?

Post by lyxrocks »

ok i will do that. thanks again!
lyxrocks
Posts: 91
Joined: Sat Oct 23, 2010 5:59 pm

How to end a section title with a displayed formula?

Post by lyxrocks »

i want to point out that the fix latex module suggested by stefan_k is awesome, as far as i know, you have nothing to lose by adding it.

http://latex-community.org/forum/viewto ... 148#p70269
Post Reply