fmarotta / kaobook

A LaTeX class for books, reports or theses based on https://github.com/kenohori/thesis and https://github.com/Tufte-LaTeX/tufte-latex.
https://github.com/fmarotta/kaobook
LaTeX Project Public License v1.3c
858 stars 184 forks source link

parenthesis around equations with \refeq #240

Open luisberndt opened 2 years ago

luisberndt commented 2 years ago

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.

fmarotta commented 2 years ago

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.

luisberndt commented 2 years ago

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 commented 2 years ago

\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?