Use of task environment inside my moquestion environment (as below) changes the item-labelling (1., 2., 3., etc) of the solution. In the mymosolution environment, the item-labelling is replaced by (D) (resumed from the task environment) instead of 1. Please provide me a way to make the correct item-labelling of the solution as 1., 2., 3., etc., provided the hyper-linking (one-one linking) between each question and the corresponding answer is preserved.

\documentclass{article}
\usepackage[paperwidth=6in, paperheight=9in]{geometry}
\usepackage{enumitem}
\usepackage{hyperref}
\settasks{item-indent=8.75mm, column-sep=3mm, after-skip=1mm, label-format=\bfseries, counter-format=(tsk[A]), label-offset=1em, label-width=1.25em}

\Opensolutionfile{mymosolutions}
\Newassociation{mymosolution}{mymoSoln}{mymosolutions}
\newcounter{moquestion}
\newenvironment{moquestion}{%
\refstepcounter{moquestion}%
\hypertarget{moquestion:{\themoquestion}}{}%
\Writetofile{mymosolutions}{\protect\hypertarget{msoln:\themoquestion}{}}%
\item%
}%
{%
\end{enumerate}}

\begin{document}

\section*{Questions}
\begin{moquestion}
a
\begin{mymosolution}
b\end{mymosolution}
\end{moquestion}

\begin{moquestion}
c
\begin{mymosolution}
d
\end{mymosolution}
\end{moquestion}

\Closesolutionfile{mymosolutions}
\renewenvironment{mymoSoln}[1]{%
\item%
}%
{%
\end{enumerate}}

\clearpage
\IfFileExists{mymosolutions.tex}{\input{mymosolutions.tex}}{}
\end{document}


The output is shown below.

I found a solution with your MWE (I'm writing a new answer because it's different from the previous one which could be useful for someone else).

I didn't understand why the task environment messes up the reference even if the moquestion counter is correct (you can display it before/after the answer using \themoquestion), but since you print your answers at the end, you could move the \ begin{mymosolution} ... \end{mymosolution} environment before the task one and it works, with the correct indentation.

\documentclass{article}
\usepackage[paperwidth=6in, paperheight=9in]{geometry}
\usepackage{enumitem}
\usepackage{hyperref}
\settasks{item-indent=8.75mm, column-sep=3mm, after-skip=1mm, label-format=\bfseries, counter-format=(tsk[A]), label-offset=1em, label-width=1.25em}

\Opensolutionfile{mymosolutions}
\Newassociation{mymosolution}{mymoSoln}{mymosolutions}
\newcounter{moquestion}
\newenvironment{moquestion}{%
\refstepcounter{moquestion}%
\hypertarget{moquestion:{\themoquestion}}{}%
\Writetofile{mymosolutions}{\protect\hypertarget{msoln:\themoquestion}{}}%
\item%
}%
{%
\end{enumerate}}

\usepackage{mwe}% for testing purpose only

\begin{document}

\section*{Questions}
\begin{moquestion}
a \blindtext
\begin{mymosolution}
b \blindtext
\end{mymosolution}
\end{moquestion}

\begin{moquestion}
c \blindtext
\begin{mymosolution}
d \blindtext
\end{mymosolution}
\end{moquestion}

\Closesolutionfile{mymosolutions}
\renewenvironment{mymoSoln}[1]{%
\item%
}%
{%
\end{enumerate}}

\clearpage
\IfFileExists{mymosolutions.tex}{\input{mymosolutions.tex}}{}
\end{document}


Maybe a solution with exercise package could be acceptable, even though I can't get your indentation when the question text is longer than one line.

However, it's very simple to get the one-to-one link, using label={\the\value{Exercise}} as exercise option and ref=\ExerciseLabel as answer option.

In the following example, if you click on the exercise number, you'll get the answer and vice-versa.

Please note that, with Adobe Acrobat Reader DC (I don't know if it's the same with other readers), you have to enlarge the document to see the links working (at least at 60%, since the exercises in the example have very few text lines).

\documentclass{article}
\usepackage[paperwidth=6in, paperheight=9in]{geometry}
\usepackage{calc}
\newlength{\mylen}
\setlength{\mylen}{\widthof{9.~}}% if the exercises are more than 9, set 99. If more than 99, set 999, and so on.
label-format=\bfseries, counter-format=(tsk[A]), label-offset=1em, label-width=2.5em}
\usepackage{hyperref}% you must load it before the exercise package
\newcommand{\myexer}{\Exercise[label={\the\value{Exercise}}]\setlength{\parskip}{1em}}

\begin{document}
\section*{Questions}
\begin{ExerciseList}
\myexer a
\myansw b
\myexer c
\myansw d
\myexer Another exercise

• It works in a way. Thanks for the answer. But, I still have a problem, may be because I am not an expert. I tried but I could't find a way to correctly one-one link if there are two or more ExerciseList environments or setcounter Exercise to 0 at some point. Again, it would be great if a customisation of indentation (as you mentioned) when a question or an answer has two or more sentences is found. I tried the \Exeleftmargin command. But, it works only for the task listings. @CarLaTeX – Tammo Dec 19 '17 at 2:11