0

I use pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex)

I put \label on sections, figures, etc.

I include \usepackage[colorlinks=true,urlcolor=blue]{hyperref}

I had been using texlive 2016. Until I installed texlive 2022, \ref{xyz} produced only the number for xyz.

Now it includes the number, the title (section name, figure caption, ...) what it is (section, figure, ...) and then the number again.

For example, with an equation having \label{Flow}, when I wrote "Equation (\ref{Flow})" I used to get "Equation (2)". Now I get "Equation (2Flowequation.3.2)"

This occurs both using \documentclass{article} and a proprietary class for a professional journal. I haven't tried others.

I've "compiled" in a fresh directory, so it's not due to confusion caused by an old .aux file.

Without including hyperref, I get only the number -- but of course no hyperlink.

Is there a repair for this?

=================================================================

In response to Carlisle's request for an example.

\documentclass[10pt]{article}

\usepackage[colorlinks=true,urlcolor=blue]{hyperref}

\begin{document}

as shown by Equation (\ref{Drag}) in section \ref{Flow}.

\section{Flow}\label{Flow}

Equating the drag force on a particle to the force of gravity determines
the velocity at which particles are suspended in equilibrium with upward
fluid flow:

\begin{equation}\label{Drag}
F_d = \frac12\, C_d\, \rho_s\, U_t^2\,  \pi\, \frac{d_f^2}4
 = F_g = \frac{4\pi}3\, \frac{d_f^3}8\, \rho_f \, g
\end{equation}

\end{document}
6
  • 4
    clearly \ref does not normally do that so it is due to code you have not shown, please show a small complete document that shows the problem Mar 21, 2023 at 23:12
  • 2
    also check your logs for the location of hyperref, check you are using a 2022 version Mar 21, 2023 at 23:14
  • Package: hyperref 2023-02-07 v7.00v Hypertext links for LaTeX<br> Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO) Package hyperref Info: Option colorlinks' set true' on input line 4060. File: hpdftex.def 2023-02-07 v7.00v Hyperref driver for pdfTeX
    – Van Snyder
    Mar 22, 2023 at 20:29
  • Package hyperref Info: Hyper figures OFF on input line 4177. Package hyperref Info: Link nesting OFF on input line 4182. Package hyperref Info: Hyper index ON on input line 4185. Package hyperref Info: Plain pages OFF on input line 4192. Package hyperref Info: Backreferencing OFF on input line 4197. Package hyperref Info: Implicit mode ON; LaTeX internals redefined. Package hyperref Info: Bookmarks ON on input line 4425.
    – Van Snyder
    Mar 22, 2023 at 20:29
  • 2
    You shouldn't have nameref.sty in the local tree: it is automatically loaded by hyperref and it needs to be the version shipped with the current hyperref.
    – egreg
    Mar 22, 2023 at 21:43

1 Answer 1

1

I made an experiment and copied an older version of nameref.sty in the same directory as the example file.

With nameref 2021-04-02 v2.47 and hyperref 2023-02-07 v7.00v the output is

enter image description here

The nameref package is automatically loaded by hyperref and it should be in a version compatible with the latter: their updates are coordinated. Having a copy of nameref.sty in the local tree is the cause of your problem. Remove it and rerun mktexlsr, so the 2022-05-17 v2.50 version will be used (if you have updated your TeX distribution).

In general, having in the local tree something that's also in the main tree is not recommended.

enter image description here

For personal preference, here's the fixed output from

\documentclass[10pt]{article}

\usepackage[colorlinks=true,urlcolor=blue]{hyperref}

\begin{document}

as shown by Equation (\ref{Drag}) in section \ref{Flow}.

\section{Flow}\label{Flow}

Equating the drag force on a particle to the force of gravity determines
the velocity at which particles are suspended in equilibrium with upward
fluid flow:
\begin{equation}\label{Drag}
F_d = \frac12 C_d \rho_s U_t^2  \pi \frac{d_f^2}4
 = F_g = \frac{4\pi}3 \frac{d_f^3}8 \rho_f  g
\end{equation}

\end{document}

No \, and no blank line before the displayed equation.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .