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?

santo
  • 13
  • 1
    "Doesn't work" isn't a helpful information. Please post a complete minimal example. – campa Jan 27 '21 at 16:20
  • The colour comes from the option colorlinks passed to hyperref. Just remove it. – campa Jan 28 '21 at 09:43
  • Thanks, do you have a suggestion how to solve the change of size of the font? – santo Jan 28 '21 at 10:35
  • There is nothing changing the font there. You are just using an A6 paper size. – campa Jan 28 '21 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 (https://tex.stackexchange.com/questions/230149/label-a-word-or-sentence) – santo Jan 28 '21 at 12:47
  • No, \usepackage[a6paper]{geometry} is not necessary; egreg used it only to have a more readable snapshot. Remove it. – campa Jan 28 '21 at 12:49
  • Thanks a lot it works and now I understood the problem. – santo Jan 28 '21 at 12:54
  • Can we mark this question as answered by the linked one? – campa Jan 28 '21 at 13:17
  • Sure, for me the problem is solved. thanks again – santo Jan 28 '21 at 14:15

0 Answers0