1

I am unable to get this to work, I am trying to use, \creflabelformat{*}{\textcolor{darkred}{#1}} to color all labels or links with the same color however, this does not appear to work.

\documentclass[a4paper,svgnames,11pt]{article}

\textheight = 220mm
\textwidth = 150mm
\topmargin = 10mm
\oddsidemargin = 5.0mm
\evensidemargin = 5.0mm
\unitlength = 1mm


\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\pagenumbering{Roman}
\usepackage[margin=2cm]{geometry}
\usepackage[final]{pdfpages}
\usepackage{longtable}
\usepackage{caption}
\usepackage[labelfont=it, labelsep=period]{caption}
\usepackage{subcaption}
\usepackage{color}
\usepackage{xcolor,colortbl}
\usepackage{adjustbox}
\usepackage{array}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage[nameinlink,noabbrev,capitalise]{cleveref} % Better in-doc refs

\definecolor{darkred}{RGB}{153,0,0}
\newcommand*\rot{\rotatebox{90}}
\creflabelformat{*}{\textcolor{darkred}{#1}}

\begin{document}

\small\begin{longtable}{|p{3cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|}
    \caption{Comparisons}\label{tab1}\\
    \hline\rowcolor{Black}
    Column & Column & Column & Column & 
    Column & Column & Column \\ \hline  
    \raggedright Hello & Hello & Hello & Hello & Hello & Hello & \\ \hline
    \raggedright Hello & Hello & Hello & Hello & Hello & Hello & \\ \hline
    \raggedright Hello & Hello & Hello & Hello & Hello & Hello & \\ \hline
\end{longtable}


\begin{table*}
    \normalsize
    \caption{Static analysis of selected wallets.}\label{tab2}
    \centering
    \begin{tabular}{|l|lllllll|lllllll|}
        \hline
        & \rot{Bitcoin Wallet} & \rot{Bither} & \rot{BRD} & \rot{Dash wallet} & \rot{Electrum} & \rot{Monerujo} & \rot{Simple Bitcoin } & \rot{Bitcoin.com} & \rot{Mycelium} & \rot{Coinomi} & \rot{Jaxx} & \rot{Copay} & \rot{Airbitz} & \rot{Samourai} \\
        \hline
        Leaks (FlowDroid) & 0 & 4 & 3 & 1 & 0 & 2 & 1 & 0 & 6 & 4 & 0 & 0 & 4 & ? \\
        Leak to ext.~storage & - & - & - & - & + & - & + & - & - & - & + & + & + & - \\
        XSS WebView & - & - & + & - & - & - & - & + & - & + & + & + & + & - \\
        Insecure conn. & + & + & - & + & - & - & + & - & - & - & - & - & - & - \\
        Leak into logs & + & + & + & + & + & + & + & + & + & + & + & + & + & + \\
        \hline
    \end{tabular}
    %}
    \label{tab:static-analysis}
\end{table*}

Please refer to \cref{tab1} and \cref{tab2} above. 

\end{document}\newcommand*\rot{\rotatebox{90}}

EDIT: I know that, \creflabelformat{table} with different names, \creflabelformat{figure} etc. But, I want one definition that applies to all, and includes the Figure/Table/Section names.

enter image description here

Ignore the Blue parts. Focus is on the Red parts, meaning, that's what I want with full name and numbers. But, I need one definition that applies to them all.

11
  • Does \creflabelformat{table}{\color{darkred}#1#2#3} do what you want? Jan 19, 2022 at 8:42
  • Off-topic: To maximize the interoperability of the xcolor and colortbl package, they shouldn't be loaded independently. Instead, load them both via \usepackage[table]{xcolor}.
    – Mico
    Jan 19, 2022 at 8:42
  • 1
    you could simply color the links with \hypersetup{colorlinks,linkcolor=darkred} Jan 19, 2022 at 9:03
  • 1
    imho cleveref has no interface, but you could patch an internal command, see tex.stackexchange.com/a/609191/2388 Jan 19, 2022 at 9:29
  • 1
    What you're asking for the cleveref package to provide a new and likely-not-trivial-to-implement feature. Feature requests are off-topic for the TeX.SE site and should, instead, be directed to the package's author and maintainer. Unfortunately, the author of the cleveref package does not appear to respond to emails anymore. You could try to contact him directly, but chances that you'll get a usable response are unfortunately quite slim.
    – Mico
    Jan 19, 2022 at 15:22

1 Answer 1

1

My solution.

Default:

\hypersetup{
  colorlinks=true,breaklinks,
  linktoc=section,
  linkcolor=darkred,
  linkbordercolor=white,
  citecolor=darkred,
  urlcolor=darkred,
  pdfborder = {0 0 1}
}

For TOC, List of Figures, and Tables, a local modification,

{
\hypersetup{linkcolor=black}
\tableofcontents
}

To set all \gls{} links to black,

\renewcommand*{\glstextformat}[1]{\textcolor{black}{#1}}
3
  • The colorlinks=true option makes the linkbordercolor and pdfborder options unnecessary. Rather than specify the option breaklinks, I'd load the xurl package.
    – Mico
    Jan 19, 2022 at 16:13
  • @Mico, what is xurl and why is that better?
    – Albin M
    Jan 19, 2022 at 17:50
  • 1
    xurl is a LaTeX package. It allows line breaks at arbitrary postions in URL strings. It's far more fliexible than hyperref's breakurl option.
    – Mico
    Jan 19, 2022 at 18:09

This site is temporarily in read-only mode and not accepting new answers.

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