Graphics, Figures & TablesMajor problem compiling to .pdf

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
TMorville
Posts: 16
Joined: Thu Mar 14, 2013 4:58 pm

Major problem compiling to .pdf

Post by TMorville »

Hi everyone,

im currently writeing a paper in Lyx, and i have a weird problem:

I have a number of ERT boxes with tex code for subfloats. It's been working fine, until now, where suddenly none of them work.

When compiling to pdflatex, i get these errors:

Code: Select all

Undefined control sequence
\subfloat
               [Is this is?\label{subfig-1:subfloats}]{
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.

Missing $ inserted
 ...e=0.3]{C:/Users/Tobias/Dropbox/DRCMR/Dice_
                                                  paper/figures/scheme.png}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

Extra }, or forgotten $.
 ...opbox/DRCMR/Dice_paper/figures/scheme.png}
                                                  
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

Missing } inserted.
 \end{figure}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
ALL of these mistakes are for JUST one small piece of code:

Code: Select all

\begin{figure}[H]   
	\subfloat[Is this is?\label{subfig-1:subfloats}]{     
		\includegraphics[scale=0.3]{C:/Users/Tobias/Dropbox/DRCMR/Dice_paper/figures/scheme.png}   
}   
	\hfill   
	\subfloat[Is this is?\label{subfig-2:subfloats}]{     
		\includegraphics[scale=0.3]{C:/Users/Tobias/Dropbox/DRCMR/Dice_paper/figures/scheme.png}   
}   
	\caption{}  
	\label{fig:sub-floats} 
\end{figure}
And have to underline, that this worked JUST fine. Further, if i take that tex code just posted, and put into NEW document it does NOT work. But if i put into another old document with similair boxes already inserted, it works just fine!

I have to say that i am utterly confused about this. It seems like theres an error for every line in that small piece of code above, and then it works just fine in another document with the same settings..

Any, and all input is appriciated.

T
Last edited by cgnieder on Thu Mar 21, 2013 12:48 pm, edited 1 time in total.

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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Major problem compiling to .pdf

Post by cgnieder »

Since the error message says that \subfloat is undefined: did you insert

Code: Select all

\usepackage{subfig}
to your preamble?

Regards
site moderator & package author
TMorville
Posts: 16
Joined: Thu Mar 14, 2013 4:58 pm

Re: Major problem compiling to .pdf

Post by TMorville »

Hi Clement!

Yes i do. I even tried to reinstall the package.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Major problem compiling to .pdf

Post by svend_tveskaeg »

Then you must produce a minimal (non-)working example if $P(\text{help}) > 0$.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
TMorville
Posts: 16
Joined: Thu Mar 14, 2013 4:58 pm

Major problem compiling to .pdf

Post by TMorville »

But won't that be a problem when im using Lyx?

Should i convert it all to Tex, and then make the minimal package?

If anyone can confirm that the piece of code i pasted in, works with a picture of their choice, the problem must be with my lyx?

If i start a completely fresh lyx document, add \usepackage{subfig} to my preamble, this peice of code does NOT work:

Code: Select all

\begin{figure}[H]   
	\subfloat[fig.a test\label{subfig-1:subfloats}]{     
		\includegraphics[scale=0.09]{path_to_picture}   
}   
	\hfill   
	\subfloat[fig.b text\label{subfig-2:subfloats}]{     
		\includegraphics[scale=0.09]{path_to_picture}   
}   
	\caption{This is a figure}  
	\label{fig:sub-floats} 
\end{figure}
... which is weird, because i works fine in another document - and i can't seem to find the difference.

Anyway. I will try to make a minimal package so you can see the entire script. I just need to know how to do it when im using Lyx.

Thanks.
Last edited by cgnieder on Thu Mar 21, 2013 8:00 pm, edited 1 time in total.
TMorville
Posts: 16
Joined: Thu Mar 14, 2013 4:58 pm

Re: Major problem compiling to .pdf

Post by TMorville »

And the plot thickens..

I manually added a "float" in the beginning of the document via Insert->Float-Figure, and added a random piece of graphics.

That works just fine, and now - when compiling - i dont get the same error messages, but Lyx just completely ignores every instance of ERT!

:!: Edit: Solution:

Manually adding a float in its own still produces errors.

Adding a picture to that float made every other ERT float work.

Together with "Add here, and def. here" option for float objects everything works again.

So no explaination, but this works if someone should have similair problems.
Post Reply