cristy@eplrx7.uucp (John Cristy) (05/22/91)
I have 5 tables in my document (documentstyle{article}. After I run latex, the table captions show the tables as Table 1, Table 2, etc. But in the references (\ref{table.1}) the reference numbers are all the same, 3.3. For example, one line should read Tables 2 and 3 illustrate... but instead reads Tables 3.3 and 3.3 illustrate... The tex portions is Tables \ref{table.2} and \ref{table.3}... Any ideas? Please Email you response. And thanks in advance. -- The UUCP Mailer
flowers@memstvx1.memst.edu (Harry Flowers) (05/23/91)
In article <1991May22.152713.1560@eplrx7.uucp>, cristy@eplrx7.uucp (John Cristy) writes: > I have 5 tables in my document (documentstyle{article}. After I run > latex, the table captions show the tables as Table 1, Table 2, etc. > But in the references (\ref{table.1}) the reference numbers are > all the same, 3.3. For example, one line should read > > Tables 2 and 3 illustrate... > > but instead reads > > Tables 3.3 and 3.3 illustrate... > > The tex portions is > > Tables \ref{table.2} and \ref{table.3}... > > Any ideas? Please Email you response. And thanks in advance. Sounds like you've got your \label's outside of your begin/end table statements. Instead, they get the section number (3.3 in this case) in which they appear. Move them inside the table environment. I tried email, but our UUCP gateway doesn't route through mail anymore :-( Harry Flowers Internet: FLOWERS@MEMSTVX1.MEMST.EDU Memphis State University & Bitnet: FLOWERS@MEMSTVX1
anita@brahms.udel.edu (Anita Marie Hoover) (05/23/91)
In article <1991May22.110347.52@memstvx1.memst.edu> flowers@memstvx1.memst.edu (Harry Flowers) writes: =>In article <1991May22.152713.1560@eplrx7.uucp>, cristy@eplrx7.uucp => (John Cristy) writes: =>> I have 5 tables in my document (documentstyle{article}. After I run =>> latex, the table captions show the tables as Table 1, Table 2, etc. =>> But in the references (\ref{table.1}) the reference numbers are =>> all the same, 3.3. For example, one line should read =>> =>> Tables 2 and 3 illustrate... =>> =>> but instead reads =>> =>> Tables 3.3 and 3.3 illustrate... =>> =>> The tex portions is =>> =>> Tables \ref{table.2} and \ref{table.3}... =>> =>> Any ideas? Please Email you response. And thanks in advance. => =>Sounds like you've got your \label's outside of your begin/end table =>statements. Instead, they get the section number (3.3 in this case) =>in which they appear. Move them inside the table environment. => =>I tried email, but our UUCP gateway doesn't route through mail anymore :-( => The number of times this particular question is asked never ceases to amaze me. Anyway as the first response indicates, you probably have your \label's in the wrong place. I guess I would have looked up in the manual (I am referring to LaTeX: User's Guide and Reference Manual) under "captions" in the index and find an entry "cross reference to" on page 72. So I went to page 72 and started reading from the top of the page until I found ``Since there can be several captions in a {\bf figure} or {\bf table} environment, \caption works like a sectioning command within the environment, with the \label command going either after the \caption command or in its argument.'' ... Then I read on to find out about \ref and \pageref and then read ... ``... A \label can appear in the argument of a sectioning or \caption command, but in no other moving argument. ...'' A good rule of thumb, make sure you put the \label command after the particular counter you want the value of the label to contain. As for the sectioning and \caption command you can put it as part of the argument. The point: \section{Title\label{sec:title}} or \section{Title}\label{sec:title} are legal and will give you the right values. \begin{figure} \caption{Caption for a figure\label{fig:cap}} \end{figure} or \begin{figure} \caption{Caption for a figure} \label{fig:cap} \end{figure} are legal and will give you the right values. So what if you wanted to references an item in a list? \begin{enumerate} \item The first thing I want to do is scream! \label{enum:scream} \item The second thing is to clear up this issue \item The third thing I will do is rest. \label{enum:rest} \end{enumerate} What does item~\ref{enum:scream} and item~\ref{enum:rest} mean in the above list? produces 1. The first thing I want to do is scream! 2. The second thing is to clear up this issue 3. The third thing I will do is rest. What does item 1 and item 3 mean in the above list? Another point to make is concerning \ref and \pageref that need to be in an argument of another command, like \caption, and sectioning commands. You will notice that both \ref and \pageref are fragile so they need to be protected when used in an argument of another command. Take our examples above for section and caption: \section{Title}\label{sec:title} \begin{figure} \caption{Caption for a figure and a reference to section\protect\ref{sec:title}.\label{fig:cap}} \end{figure} Enough said, but worth it if it helps reduce the number of times this question is asked.