TeXworksHow to refer my figure?

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

How to refer my figure?

Post by yaozhao »

Code: Select all

\section{Research Hypothesis}
\begin{figure}[h] 
\centering 
\includegraphics[width=1\textwidth]{"box-image"}
\caption{Main effect}
\label{Figure 1}
\end{figure} 

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!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to refer my figure?

Post by Johannes_B »

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

Code: Select all

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: 57
Joined: Sat Oct 27, 2018 10:38 pm

How to refer my figure?

Post by yaozhao »

Thanks! What does ~ mean? A space between words?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to refer my figure?

Post by Johannes_B »

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.
Post Reply