Question is asked after the MWE.
\documentclass[10pt,a4paper]{article}
\usepackage{amsmath,amsfonts}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[colorlinks=true, linktocpage=false]{hyperref}
\hypersetup{
citecolor = {blue}
}
\makeatletter
\newcommand{\manuallabel}[2]{\def\@currentlabel{#2}\label{#1}}
\makeatother
\newenvironment{ProblemSpecBox}[2]
{%
\begin{mdframed}[innerlinewidth=0.5pt,%
innerleftmargin=10pt, innerrightmargin=10pt,%
innertopmargin = 10pt, innerbottommargin=10pt,%
skipabove=\dimexpr\topsep+\ht\strutbox\relax,%
roundcorner=5pt, frametitle={#1},%
frametitlerule=true, frametitlerulewidth=1pt]
{#2}
\end{mdframed}
}
\begin{document}
This is a test example
\begin{ProblemSpecBox} \manuallabel{prob:ProblemO}{Problem O} % I think this is where the problem is.
{
Problem O for $\mathbb{C}$
}
{
\emph{Given} $a, b \in \mathbb{C}$; \emph{Find} $n \in \mathbb{Z}$ such that
[
|a|^{n} = |b|
]
}
\end{ProblemSpecBox}
\ref{prob:ProblemO} % This must display Problem O i.e., the second argument of \manuallabel which will be linked to it's source by hyperref.
\end{document}
Without the command \manuallabel command after ProblemSpecBox environment, everything works fine. However, if I include \manuallabel which is later reference it with \ref{ProblemO} as answered in this question Manually set reference values I get the following errors:
! Argument of \manuallabel has an extra }.
! Paragraph ended before \manuallabel was complete.
I would appreciate it if someone can help me solve this problem.



