I have recently found "cref". Very practical for equations, figures, and tables. But for referring to multiple sections it does not work.
A concrete example:
(Sorry for the long lables by the way)
Chapters \mref{par: Theoretical Background OPF SOPF SOPF in load space,par: Theoretical Background OPF SOPF SOPF in load space in practice}
gives:
Chapters 2.7.5.2, 2.7.5.3
as output, whereas
Chapters \cref{par: Theoretical Background OPF SOPF SOPF in load space,par: Theoretical Background OPF SOPF SOPF in load space in practice}
gives:
Chapters ?? 2.7.5.2?? 2.7.5.3
as output.
Why is it like this? What can I do about it?
Update:
I paste a small .tex example file in the below:
\documentclass[a4paper]{article}
\usepackage[ireport]{KTHEEtitlepage}
% Packages used in the main document for this particular example:
\usepackage{url}
\usepackage{amstext}
\usepackage[english]{babel} % swedish
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{amsfonts} % mathbb
\usepackage{xparse}
\usepackage{dsfont}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfplots}
\usetikzlibrary{plotmarks}
\usepackage{pgfmath}
\usepackage[nocompress]{cite}
\usepackage{hyperref}
\usepackage[capitalize]{cleveref}
\newcommand{\sgn}{\operatorname{sgn}}
\ExplSyntaxOn
\NewDocumentCommand{\mref}{m}{\quinn_mref:n {#1}}
\seq_new:N \l_quinn_mref_seq
\cs_new:Npn \quinn_mref:n #1
{
\seq_set_split:Nnn \l_quinn_mref_seq { , } { #1 }
\seq_pop_right:NN \l_quinn_mref_seq \l_tmpa_tl
% ( % print the left parenthesis
\seq_map_inline:Nn \l_quinn_mref_seq
{ \ref{##1},\nobreakspace } % print the first references
\exp_args:NV \ref \l_tmpa_tl % print the last or only one
% ) % print the right parenthesis
}
\ExplSyntaxOff
\begin{document}
\ititle{This is a report, Revision date 2016-10-21}
\isubtitle{This is the subtitle}
\iauthor{Lars Abrahamsson}
\idate{2016}
\irefnr{Report number 345474574567457}
\iaddress{At research group \\
At department \\
At University }
\makeititle
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
% Everything below is exactly as for a normal document and
% the layout of that document should not be affected in any
% way by the title page.
\title{The title}
\author{The Author}
\tableofcontents
\listoftables
\listoffigures
\maketitle
\section{Test 1}
\label{sec: Test 1}
sdgdffg
\section{Test 2}
\label{sec: Test 2}
xfbgdfhhfd
Please, refer to \cref{sec: Test 1,sec: Test 3}
\section{Test 3}
\label{sec: Test 3}
Please, refer to Chapters \mref{sec: Test 1,sec: Test 2}.
\paragraph{Paragraph with short label}
\label{par: Short Name}
fff
Just cref: \cref{par: Short Name}
\subsubsection{Balle}
\label{subsubs: balle}
Just cref: \cref{subsubs: balle}
\end{document}
The output on page 2 (the relevant one) then becomes like the picture below:
\cref
for multiple references has worked fine for me. What is\mref
?\mref
an alias for\labelcref
?