[OS X TeX] Figure cross-referencing in TeXShop

Herbert Schulz herbs at wideopenwest.com
Tue Feb 1 20:00:08 CET 2022



> On Feb 1, 2022, at 12:54 PM, R Martinez via MacOSX-TeX <macosx-tex at email.esm.psu.edu> wrote:
> 
> All,
> 
> I’m experiencing what appears to be very strange TeXShop behavior. I attribute it to TS with much trepidation, but here it goes. I’m using TS 4.68 on an M1 MacBook Pro running MacOS 12.1. I’m using MacTex 2021 and pdfTeX.
> 
> I’m working on a document that includes about 20 figures, all of which are PDF documents. All the figures and all LaTeX documents are in one directory so there are no path-definition issues.
> 
>  All but one of the figures—call it fig47---are handled correctly. fig47 is typeset and labeled correctly as Figure 3.3 in the typeset pdf document but the reference is not. When I invoke \ref{figure:fig47} in the text to refer to fig47, I get Figure 3.2 instead of Figure 3.3. Here’s the sample text:
> 
> \begin{figure}[h!] 
>     \centering\includegraphics[scale=0.9]{fig47.pdf} \label{figure:fig47} 
>     \caption{}
>   \end{figure} 
>   % 
>   
>   \ref{figure:fig47}
> 
> The typeset output is 
> 
> 3.2
> 
> not 3.3
> 
> I’ve tried lots of things to see if I can get the right reference to no avail. Here is a list: (1) changing the figure label, (2) remaking the figure with a different file name, (I’ve done this several times); (3) quitting and restarting TS, (4) moving the figure environment  to other places in the source document.
> 
> All the other 19 figures use similar code and get the correct reference when invoked.
> 
> As always, I appreciate your advice.
> 
> Thanks in advance,
> 
> Raul Martinez 

Howdy,

The \label command should be placed after the \caption command since the latter is what increments the counter.

Good Luck,

Herb Schulz
herbs at wideopenwest.com


----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex



More information about the macostex-archives mailing list.