kaobook icon indicating copy to clipboard operation
kaobook copied to clipboard

parenthesis around equations with \refeq

Open luisberndt opened this issue 2 years ago • 3 comments

Description

Is there an easy way to get the parenthesis back while using the command \refeq? In the kaorefs style there is a part wich is labeled with Remove parentheses around equations.

But commenting the line below \creflabelformat{equation}{#2\textup{#1}#3} doesnt help. Also using \cref{eq:...} creates a link to the equation without the brackets. I can't find any other part in the code wich could control this. But I also don't know which package controls this: vref, cref, hyperref or the LaTeX standart ref.

Just adding () to the \refeq command like: \newcommand{\refeq}[1]{\hyperref[eq:#1]\eqname\xspace(\ref{eq:#1})} doesnt help etheir because now the backets arent linked to the equation.

I use all kao packages with little to no changes and the few I did shouldn't affect it.

luisberndt avatar Jun 03 '22 12:06 luisberndt

Hi, if I'm not wrong, \creflabelformat sets the format for the references to equations, so what about modifying to \creflabelformat{equation}{#2(\textup{#1})#3} instead of commenting out? I haven't tried it though, so it may not do the right thing.

fmarotta avatar Sep 17 '22 19:09 fmarotta

Hey, it kind of works. If I put the brackets before and after \textup, nothing else happens with the \refeq command. When I use the \vrefeq command, the parentheses are correctly placed before and after the equation number. Disadvantage here is that the keyword "equation" is set twice. So with \creflabelformat{equation}{#2(\textup{#1})#3} and using \vrefeq comes out in german: Gleichung Gleichung (8.2). And with \refeq it only displays Gleichung 8.2 wihtout the brackets.

luisberndt avatar Sep 17 '22 20:09 luisberndt

\creflabelformat{equation}{#2(\textup{#1})#3} and \newcommand{\refeq}[1]{\cref{eq:#1}} does now work fine for me. It let´s me use the old \refeq command, so that i dont have to change all to \cref{eq:...}. If you´ve got some time, you can have a look at this and find maby a better way. Changing the \creflabelfomat doesn't effect they way a equation in presented through the \ref command in the \newcommand{\refeq}[1]{\hyperref[eq:#1]\eqname\xspace\ref{eq:#1}} part, does it?

luisberndt avatar Sep 18 '22 09:09 luisberndt