LaTeX forum ⇒ Graphics, Figures & TablesText 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

Postby Matrix » Mon Feb 05, 2018 12:44 pm

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}

User avatar
Stefan Kottwitz
Site Admin
Posts: 8666
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Mon Feb 05, 2018 11:20 pm

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 (Infominimal working example).

Stefan
Site admin

Matrix
Posts: 3
Joined: Mon Feb 05, 2018 12:32 pm

Postby Matrix » Tue Feb 06, 2018 12:41 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.)

  1. \documentclass[12pt]{article}
  2. \usepackage{chemstyle}
  3.  
  4. \begin{document}
  5.  
  6. \begin{figure}
  7. \includegraphics{no-figure}
  8. \caption{Caption here} \label{test}
  9. \end{figure}
  10.  
  11. This is a test.
  12.  
  13. Reference to figure \ref{test}
  14.  
  15. \end{document}

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

Postby Johannes_B » Tue Feb 06, 2018 8:31 pm

  1. \listfiles
  2. \documentclass[12pt]{article}
  3. \usepackage[varioref=false]{chemstyle}% <-----
  4.  
  5. \begin{document}
  6. \begin{figure}
  7. \includegraphics{example-image}% this file exists on your system
  8. \caption{Caption here} \label{test}
  9. \end{figure}
  10.  
  11. This is a test.
  12.  
  13. Reference to figure \ref{test}
  14.  
  15. \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

Postby Matrix » Wed Feb 07, 2018 12:13 pm

Works perfectly - thanks!

:D


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests