I am using latex with rmarkdown package. The following is the YAML heading in which the packages are located and the written text.

- \usepackage{amsmath}
- \usepackage{amsthm}
- \usepackage{bbm}
- \numberwithin{equation}{section}
- \usepackage{makecell}
- \usepackage{indentfirst}
- \usepackage{geometry}
- \usepackage{graphicx}
- \usepackage{tikz}
- \usepackage{verbatim}
- \usepackage{chronosys}
- \usepackage{stackengine}
- \usepackage{booktabs, colortbl, xcolor}
- \usepackage{babel}
- \usetikzlibrary{arrows.meta,calc}
- \usepackage[font=small]{caption}
- \usepackage{adjustbox}
- \usepackage{tabularx}
- \usepackage{pgfplots}
- \pgfplotsset{compat=1.7}
- \usepackage[makeroom]{cancel}
- \usetikzlibrary{arrows,decorations.markings}
- \usetikzlibrary{intersections}
- \usepackage[nottoc]{tocbibind}
- \newtheorem{prop}{Proposition}
- \theoremstyle{definition} 
- \newtheorem{assumption}{Assumption}
- \newtheorem{definition}{Definition}
- \newtheorem{algorithm}{Algorithm}
- \usepackage[T1]{fontenc}
- \usepackage{tabularx,ragged2e,booktabs,caption}
- \newenvironment{rcases}
- \renewcommand{\refname}{References}
- \UseRawInputEncoding
- \usepackage[utf8]{inputenc}
- \usepackage{hyperref}
- \hypersetup{
     citecolor = blue,      
- \usepackage{subcaption}
- \usepackage[font=small,labelfont=bf]{caption}
- \usepackage{float}
- \usepackage{flafter}
- \floatstyle{plaintop}
- \restylefloat{table}
- \setlength{\parindent}{2.5em}
- \setlength{\parskip}{0em}
- \usepackage{adjustbox}
- \usepackage[style=english]{csquotes} 
- \usepackage[colorlinks,allcolors=red]{hyperref}
- \usepackage[nameinlink,noabbrev]{cleveref}
- \creflabelformat{equation}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{assumption}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{proposition}{#2\textup{(\textcolor{red}{#1})}#3}
- \creflabelformat{figure}{#2\textcolor{red}{#1}#3}
- \creflabelformat{table}{#2\textcolor{red}{#1}#3}
- \creflabelformat{section}{#2\textcolor{red}{#1}#3}

    \normalfont The production is assumed to adopt a single technology.

    \cref{assump1} suggests something.

But it prints ?? suggests something..

  • 1
    what happens if you add \crefname{assumption}{assumption}{assumptions} to this...?
    – cmhughes
    Sep 6, 2022 at 15:09
  • @cmhughes, oh it works. Thanks! But the link's color is black and thin font. Could you let me know how to make it red and also bold font?
    – jck21
    Sep 6, 2022 at 15:43
  • Please advise how or where \lccref is defined.
    – Mico
    Sep 6, 2022 at 16:20
  • @Mico, I put it in the text as the following: \medskip \makeatletter \renewcommand\@makefnmark{\hbox{\@textsuperscript{\normalfont\color{red}\@thefnmark}}} \newcommand{\lccref}[1]{\lcnamecref{#1}~\labelcref{#1}} \makeatother \pagebreak \tableofcontents \pagebreak \section{Introduction}. Please see the revised question above.
    – jck21
    Sep 6, 2022 at 18:29

1 Answer 1


If you load amsthm before hyperref and cleveref, you do not need to execute any of the \creflabelformat directives (as they're essentially replicating the respective defaults), and you don't need to run \crefname{assumption}{assumption}{assumptions} either.

enter image description here

\documentclass{article} % or some other suitable document class

\usepackage{amsthm} % for \theoremstyle and \newtheoerem macros

\theoremstyle{definition} % <-- new (to use upright font shape for theorem body)

Production is assumed to adopt a single technology.

According to \cref{assump1}, \dots
  • 1
    @frabjous - I'd say that, from a typographical/aesthetic point of view, it's a simply hideous idea to render a cross-referencing call-out in bold (as well as in red). If the OP truly believes that it's a good idea to render the cross-referencing call-out in bold, he/she can always write \textbf{\cref{assump1}}.
    – Mico
    Sep 6, 2022 at 16:58
  • 2
    You could remove or change the options to the hyperref package and then use something like \creflabelformat{assumption}{#2\textcolor{blue}{#1}#3}. (You may need to add a package like xcolor if hyperref isn't loading it.)
    – frabjous
    Sep 6, 2022 at 18:16
  • 1
    @joe - If you don't want cleveref to capitalize the first letter in the word "assumption", don't specify the option capitalize when you load the package. And if you don't want cleveref to render the word "assumption" (or "Assumption") in a color, don't specify the option nameinlink.
    – Mico
    Sep 6, 2022 at 18:37
  • 2
    @joe - Never load a package twice. Your code loads hyperref twice. Don't do it. Get rid of the instruction \usepackage[colorlinks,allcolors=red]{hyperref}.
    – Mico
    Sep 6, 2022 at 19:16
  • 1
    @joe -- All of the \newtheorem directives must come after, not before, cleveref is loaded -- as is the case in the sample code I provided in my answer, and is noted in the second bullet point item in section 14.1 of the user guide of the cleveref package.
    – Mico
    Sep 6, 2022 at 19:54

You must log in to answer this question.

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