After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 675344 - Simple alteration in the "Insert figure" command
Simple alteration in the "Insert figure" command
Status: RESOLVED FIXED
Product: gnome-latex
Classification: Other
Component: general
2.4.x
Other Linux
: Normal normal
: unspecified
Assigned To: LaTeXila maintainer(s)
LaTeXila maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-05-03 03:34 UTC by slash_tib
Modified: 2012-05-03 17:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample with wrong labeling and right labeling of figures and tables. (285.36 KB, application/zip)
2012-05-03 15:20 UTC, slash_tib
Details

Description slash_tib 2012-05-03 03:34:20 UTC
When you want to insert a figure, the Latexila "Figure" icon returns the following command lines:

\begin{figure}
  \begin{center}
    \includegraphics{}
    \label{fig:}
    \caption{}
  \end{center}
\end{figure}

My suggestion is to permute the 'caption' and the 'label', creating the profile

\begin{figure}
  \begin{center}
    \includegraphics{}
    \caption{}
    \label{fig:}
  \end{center}
\end{figure}

It may sound unnecessary, but I found that many 'wrong labeling' errors (e.g., reference a figure as number 2 in a document with only one figure) ocurred because of this ordering. 

In addition, there could be a '[width = (fraction)\textwidth]' just after the 'includegraphics' to facilitate the definition of the size of the figure in the text. What do you think?
Comment 1 Sébastien Wilmet 2012-05-03 14:51:47 UTC
(In reply to comment #0)
> It may sound unnecessary, but I found that many 'wrong labeling' errors (e.g.,
> reference a figure as number 2 in a document with only one figure) ocurred
> because of this ordering.

Do you have a .tex sample that show this bug?

I thought the label refers to the figure environment, but it is possible that the label refers to the previous caption, or something else.

Before applying the modification, it would be nice to know why this bug occurs, and knowing what is the best way to include a figure with a caption and a label.

> In addition, there could be a '[width = (fraction)\textwidth]' just after the
> 'includegraphics' to facilitate the definition of the size of the figure in the
> text. What do you think?

The plan is to add completion support for the options of \includegraphics. There are a lot of different means to specify the size of the image. I prefer no options at all by default.
Comment 2 slash_tib 2012-05-03 15:20:13 UTC
Created attachment 213389 [details]
Sample with wrong labeling and right labeling of figures and tables.

This .zip file contains two folders, both with the sample example. In the first, "Buggy example", the .pdf generated contains wrong labeling of the figure (ftest.pdf) and the table because of the ordering of the \label and \caption. In the second, this order is permuted (puting \caption first), and the references are now o.k.
Comment 3 slash_tib 2012-05-03 15:24:26 UTC
I put an example in the above comment.

I tried several (la)tex editors, and all of them results in the same bug. It seems to happen when you have a text with several sections, chapters etc.

I found a solution in the following blog:

http://www.terminally-incoherent.com/blog/2007/04/14/latex-fixing-wrong-figure-numbers/

I really don't know the technical reason for doing this change, but since it worked and Latexila is my favorite tex editor, I decided to share this.
Comment 4 Sébastien Wilmet 2012-05-03 17:05:27 UTC
Thanks for the examples and the link to the blog post.

The bug is fixed:
http://git.gnome.org/browse/latexila/commit/?id=46f5eced6797f020aa14a425091a8cd05ec85fa6

This will be available in the next versions (2.4.1 and 2.5.1).