LyX ⇒ Inset inside float error
Inset inside float error
I have a LilyPond inset inside a float:Figure. Im getting the error
Undefined control sequence.
Argument of \@caption has an extra }.
Paragraph ended before \@caption was complete.
If I just have the lilypond inset by itself it works fine.
Can anyone help please?
Thanks,
Tommy
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
Re: Inset inside float error
it seems there's a fragile macro which breaks while moving to the list of figures. Protect the macro, that is, write a \protect right before the problematic macro. Or add an optional caption.
Perhaps export your LyX document into LaTeX and post the relevant part here, the code of the figure. Then we could tell you in detail.
Stefan
Inset inside float error
The code can be found here:
Code: Select all
by the original. This has given the final work a much deeper feel,
and it integrates with the story much better.
\begin{figure}
\protect\caption{
\begin{lilypond}[staffsize=18]
\version "2.18.2"
\header { title = "Symphony" composer = "Tommy Burn" opus = "Op. 9" }
\relative c'{ \set Score.alternativeNumberingStyle = #'numbers \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers-with-letters \repeat volta 3 { c,4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 }
\end{lilypond}
}
\end{figure}
\end{abstract}
As the composer I approached the task with a number of objectives
I wanted to achieve.
Many thanks,
Tommy Burn
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Inset inside float error
Your figure-environment does not include an image (or something else), but a caption containing lilypond code. As the content of the caption is printed to the list of figures as well, nearly all commands inside the caption argument break. You can prevent the breaking by putting a
\protect
in front of the breaking command (also called macro). In your case, you have an environment inside the caption. Are you sure this should go to the caption?You didn't post a minimal example and i don't have any experience with lilypond, so i can't be really helpful.
Re: Inset inside float error
I didn't realise i was putting it as a caption. I thought I was puttting it as a figure. I moved it outside of the caption and wrote appropriatley in the caption box and it works.
Thanks loads.
Tommy