LaTeX forum ⇒ Graphics, Figures & TablesMajor problem compiling to .pdf Topic is solved

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

Major problem compiling to .pdf

Postby TMorville » Thu Mar 21, 2013 12:25 pm

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:

  1. Undefined control sequence
  2. \subfloat
  3. [Is this is?\label{subfig-1:subfloats}]{
  4. The control sequence at the end of the top line
  5. of your error message was never \def'ed. If you have
  6. misspelled it (e.g., `\hobx'), type `I' and the correct
  7. spelling (e.g., `I\hbox'). Otherwise just continue,
  8. and I'll forget about whatever was undefined.
  9.  
  10. Missing $ inserted
  11. ...e=0.3]{C:/Users/Tobias/Dropbox/DRCMR/Dice_
  12. paper/figures/scheme.png}
  13. I've inserted a begin-math/end-math symbol since I think
  14. you left one out. Proceed, with fingers crossed.
  15. Extra }, or forgotten $.
  16. ...opbox/DRCMR/Dice_paper/figures/scheme.png}
  17.  
  18. I've deleted a group-closing symbol because it seems to be
  19. spurious, as in `$x}$'. But perhaps the } is legitimate and
  20. you forgot something else, as in `\hbox{$x}'. In such cases
  21. the way to recover is to insert both the forgotten and the
  22. deleted material, e.g., by typing `I$}'.
  23.  
  24. Missing } inserted.
  25. \end{figure}
  26.  
  27. I've inserted something that you may have forgotten.
  28. (See the <inserted text> above.)
  29. With luck, this will get me unwedged. But if you
  30. really didn't forget anything, try typing `2' now; then
  31. my insertion and my current dilemma will both disappear.


ALL of these mistakes are for JUST one small piece of code:

  1. \begin{figure}[H]
  2. \subfloat[Is this is?\label{subfig-1:subfloats}]{
  3. \includegraphics[scale=0.3]{C:/Users/Tobias/Dropbox/DRCMR/Dice_paper/figures/scheme.png}
  4. }
  5. \hfill
  6. \subfloat[Is this is?\label{subfig-2:subfloats}]{
  7. \includegraphics[scale=0.3]{C:/Users/Tobias/Dropbox/DRCMR/Dice_paper/figures/scheme.png}
  8. }
  9. \caption{}
  10. \label{fig:sub-floats}
  11. \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.
Reason: added code markup for log messages and changed inline to block for the code

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Thu Mar 21, 2013 12:51 pm

Since the error message says that \subfloat is undefined: did you insert
  1. \usepackage{subfig}

to your preamble?

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

TMorville
Posts: 16
Joined: Thu Mar 14, 2013 4:58 pm

Postby TMorville » Thu Mar 21, 2013 2:00 pm

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

Postby svend_tveskaeg » Thu Mar 21, 2013 3:20 pm

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

Postby TMorville » Thu Mar 21, 2013 3:34 pm

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:

  1. \begin{figure}[H]
  2. \subfloat[fig.a test\label{subfig-1:subfloats}]{
  3. \includegraphics[scale=0.09]{path_to_picture}
  4. }
  5. \hfill
  6. \subfloat[fig.b text\label{subfig-2:subfloats}]{
  7. \includegraphics[scale=0.09]{path_to_picture}
  8. }
  9. \caption{This is a figure}
  10. \label{fig:sub-floats}
  11. \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.
Reason: changed inline code markup into block code markup

TMorville
Posts: 16
Joined: Thu Mar 14, 2013 4:58 pm

Postby TMorville » Thu Mar 21, 2013 4:05 pm

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.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 1 guest