1

Hi I'm using a RevTex template and I would like to create a reference for a single word for instance 'molecule'. So i would like to use the reference for this word everytime I should write the word molecule. For example the phrase is:'The molecule is toxic' I tried:

molecule\label{a}
The \ref{a} is toxic.

I also tried the solution here Label a word or sentence?, but it doesn't work well, I observe these problems: -It references the word but the word is in another color -It changes also the color of other references made just with '\label{} + \ref{}, so the reference of equations for example appears red or green -It changes also the dimension of my entire text This is the code:

\documentclass[reprint,amsmath,amssymb,aps,]{revtex4-2}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage[a6paper]{geometry}
\usepackage[colorlinks]{hyperref}

\makeatletter
\newcommand{\setword}[2]{%
    \phantomsection
    #1\def\@currentlabel{\unexpanded{#1}}\label{#2}%
}
\makeatother
 \begin{document}
 \section{\label{sec:level1}example}
This is an example how to reference a word 'molecule'.
So I fixed the word '\setword{molecule}{Word:molecule}' and I try to use it again\\
The \ref{Word:molecule} is toxic
\begin{eqnarray}\label{eq}
dV=Cd
\end{eqnarray}
As you can see in equation(\ref{eq})

\begin{eqnarray}\label{eq1}
dV=Cds
\end{eqnarray}
As you can see in equation(\ref{eq1})

\end{document}

here there's my initial test:

enter image description here

And this is what happen when I use the suggestion Label a word or sentence?:

enter image description here

Is there a way how to fix it?

9
  • 1
    "Doesn't work" isn't a helpful information. Please post a complete minimal example.
    – campa
    Jan 27, 2021 at 16:20
  • The colour comes from the option colorlinks passed to hyperref. Just remove it.
    – campa
    Jan 28, 2021 at 9:43
  • Thanks, do you have a suggestion how to solve the change of size of the font?
    – santo
    Jan 28, 2021 at 10:35
  • There is nothing changing the font there. You are just using an A6 paper size.
    – campa
    Jan 28, 2021 at 11:37
  • Sorry but I'm rookie and I started to use latex since few days. The problem is that this change is somehow related with the modification for referencing words (tex.stackexchange.com/questions/230149/label-a-word-or-sentence)
    – santo
    Jan 28, 2021 at 12:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.