LaTeX forum ⇒ TeXworksHow to refer my figure?

Information and discussion about TeXworks, an integrated LaTeX environment for several platforms
yaozhao
Posts: 37
Joined: Sat Oct 27, 2018 10:38 pm

How to refer my figure?

Postby yaozhao » Tue May 07, 2019 2:07 am

  1. \section{Research Hypothesis}
  2. \begin{figure}[h]
  3. \centering
  4. \includegraphics[width=1\textwidth]{"box-image"}
  5. \caption{Main effect}
  6. \label{Figure 1}
  7. \end{figure}
  8.  
  9. Like \ref{image-myimage} showed,


The outcome is "Like 1 figure showed". My idea is to show up "Like Figure 1 showed". I don't know where does 1 come from.

Many thanks in advance!

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue May 07, 2019 6:37 am

You always reference the label, in your case this is Figure 1. That is a very bad label. A better label would be mainEffectBoxImage, which would result in
  1. Like Figure~\ref{mainEffectBoxImage} shows, ...


Package autoref can be helpful here as well.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

yaozhao
Posts: 37
Joined: Sat Oct 27, 2018 10:38 pm

Postby yaozhao » Tue May 07, 2019 1:23 pm

Thanks! What does ~ mean? A space between words?

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue May 07, 2019 6:32 pm

The tilde in LaTeX is an unbreakable space. That means, the word figure and the final number stick together.

Reason: There is a chance that the word figure is at the end of a line and the number printed on the start of the next. This would disrupt the flow of reading. To prevent that, use the tilde so they stick together.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “TeXworks”

Who is online

Users browsing this forum: No registered users and 1 guest