## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Text in reference labels Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Matrix
Posts: 3
Joined: Mon Feb 05, 2018 12:32 pm

### Text in reference labels

Hi,

First post here

I have one document where all my \ref commands are including the category label as well. I don't want this, as I've written the text already, and this is resulting in text such as 'in Figure Figure 1, blah...'

What could be causing this? This is the list of packages loaded for the document:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{textcomp}
%\usepackage{tikz}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage{natbib}
\usepackage{url}
\usepackage{lineno}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{ellipse}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{mhchem}
\usepackage{chemstyle}
\usepackage[shortlabels]{enumitem}

Stefan Kottwitz
Posts: 8666
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
With these packages,

• the chemstyle package may cause a problem
• reference numbering is "1" not "Figure 1"

so I get with

See figure \ref{test}

the result "See figure 1".

Perhaps post code that produces the output with the issue (minimal working example).

Stefan

Matrix
Posts: 3
Joined: Mon Feb 05, 2018 12:32 pm
Here's a minimal working example.

Thanks for the tip - it is indeed the chemstyle package that's causing it. Do you have any ideas for a fix?

The code below gives the output

"This is a test.
Reference to figure Figure 1"

(At least, it does on my system - TexWorks 0.6.2, on Windows - and using a png file as the figure.)

\documentclass[12pt]{article}\usepackage{chemstyle} \begin{document} \begin{figure}  \includegraphics{no-figure}  \caption{Caption here}  \label{test}\end{figure} This is a test. Reference to figure \ref{test} \end{document}

Johannes_B
Site Moderator
Posts: 3618
Joined: Thu Nov 01, 2012 4:08 pm
\listfiles\documentclass[12pt]{article}\usepackage[varioref=false]{chemstyle}% <----- \begin{document}\begin{figure}\includegraphics{example-image}% this file exists on your system\caption{Caption here}  \label{test}\end{figure} This is a test. Reference to figure \ref{test} \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Matrix
Posts: 3
Joined: Mon Feb 05, 2018 12:32 pm
Works perfectly - thanks!