# Multiline enumerate item

I am using enumerate environment to create a list of answers on tasks in my book where item label is a number of a task. I want to put a page number where the task is located immediately under label item.

This is what I have now:

\documentclass[a4paper,14pt,oneside]{extbook}

\usepackage{enumitem}
\usepackage[many]{tcolorbox}
\usepackage{hyperref}

% Defining custom tcolorbox environment
title=\thetcbcounter,#1
}

\begin{document}

\begin{enumerate}
\end{enumerate}

\end{document}


And how it looks:

As you can see double backslash \\ symbol and also \newline command do not work here.

How to move p.1 on the next line under task number?

And one more thing. Is there a way to get tcolobox "task" counter by it's label in order not to write task number explicitly?

To start with I changed your labels since it is never a good idea to have the number in them. Then to get the number use \ref{label}. To get the page mumber below the task number you can use \raisebox with appropriate settings. Here I just lowered it 0.8em and set the height and depth both to 0pt. Without suppressing the vertical space there will be a space between the first and the second row of the answer. Finally I set the page number in a \rlap command to not occupy and horizontal space. So actually the page number should not occupy any space at all.

\documentclass[a4paper,14pt,oneside]{extbook}

\usepackage{calc}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}
\usepackage{hyperref}
% Defining custom tcolorbox environment
title=\thetcbcounter,#1
}
\begin{document}
\newcommand\specialitemlabel[1]{\raisebox{-0.8em}[0pt][0pt]{\rlap{\small p.\pageref{#1}}}\textbf{\ref{#1}}}
\begin{enumerate}
\end{enumerate}
\end{document}


To move p.1 onto the next line you can simply use \setlist[description]{style = multiline}.

Code:

\documentclass[a4paper,14pt,oneside]{extbook}
\usepackage{enumitem}

\setlist[description]{style = multiline}

\usepackage[many]{tcolorbox}
\usepackage{hyperref}
% Defining custom tcolorbox environment
title=\thetcbcounter,#1
}

\begin{document}

\begin{description}
\vspace{.5cm}
\vspace{.5cm}
\end{description}

\end{document}


This yields:

You could create a parbox and use \widthof provided by calc in order to achieve that:

\documentclass[a4paper,14pt,oneside]{extbook}

\usepackage{calc}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}
\usepackage{hyperref}

% Defining custom tcolorbox environment
title=\thetcbcounter,#1
}

\newcommand{\myitem}[2]{%
\item[\parbox{\widthof{\textbf{#1}\\{\small p.\pageref{#2}}}}{\textbf{#1}\\{\small p.\pageref{#2}}}]
}

\begin{document}

\begin{enumerate}

• try \newcommand{\myitem}[1]{% \item[ \refstepcounter{enumi} \parbox{\widthof{\textbf{0.\theenumi}\\ {\small p.\pageref{#1}}}}{\textbf{0.\theenumi}\\{\small p.~\pageref{#1}}} ]} and use \myitem{task0.1} . Nov 12 '16 at 15:43