Can one use exsheets to produce a marks layout after each question?

I'm trying to get an exam layout of the form:

1. Blahblahblahblahblahblahblahblah  [ ]
blahblahblahblahblahblahblahblahbla
hblahblahblahblahblahblahblahblah.


where [ ] should be a fairly large (1 cm x 1 cm) square, that is aligned with the first line of each question. I can use exsheets and changepage to produce a list of questions with a proper right margin, but I do not know if I can either use exsheets to define a new question environment that places such box accordingly (I think this should be possible, given the flexibility of the package) or perhaps use another package to achieve this.

Update. I managed to achieve what I intended with the minipage environment. Is there a better option? I still cannot get the first sentence aligned correctly, however.

\documentclass[a4paper,11  pt]{article}
\usepackage[top=2cm, bottom=3cm, left=4cm, right=4cm]{geometry}

\usepackage[utf8x]{inputenc}
\usepackage[spanish]{babel}
\usepackage{varwidth}

\usepackage{lipsum}

\usepackage{fourier}
\usepackage{tgpagella}
\usepackage[T1]{fontenc}

\usepackage{exsheets}
\usepackage{setspace}
\onehalfspacing
\usepackage{etoolbox}
\usepackage{titling}

\setlength{\parindent}{0pt}
\newcommand{\subtitle}[1]{%
\posttitle{%
\par\end{center}
\begin{center}\large#1\end{center}
\vskip0.5em}%
}

\title{Title goes here}
\subtitle{Subtitle goes here}
\date{\vspace{-15ex}}

\begin{document}

\maketitle

\hrulefill
\vspace{0.5 em}

\hrulefill

\vspace{1cm}

\begin{minipage}[t]{.85\textwidth}
\begin{question} \lipsum[1]
\end{question}
\end{minipage}%
\begin{minipage}{.15\textwidth}
\flushright
\framebox(20,20){}
\end{minipage}

\begin{minipage}[t]{.85\textwidth}
\begin{question} \lipsum[2]
\end{question}
\end{minipage}%
\begin{minipage}{.15\textwidth}
\flushright
\framebox(20,20){}
\end{minipage}

\end{document}


No need for putting the question environment in minipages or defining new environments… This is the exsheets way:

\documentclass[a4paper,11pt]{article}
\usepackage[top=2cm, bottom=3cm, left=4cm, right=4cm]{geometry}

\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{tgpagella}
\usepackage[utf8]{inputenc}

\usepackage{exsheets}

runin = true ,
number-post-code = \space ,
attach = { main[l,t]square[r,t](\textwidth,0pt) } ,
join   = { main[r,vc]number[l,vc](0pt,0pt) }
}

\SetupExSheets{
}

\usepackage{lipsum}

\begin{document}

\noindent\hrulefill

\begin{question}
\lipsum[1]
\end{question}

\begin{question}
\lipsum[2]
\end{question}

\end{document}


Using xsim (GitHub) – the result looks the same:

\documentclass[a4paper,11pt]{article}
\usepackage[top=2cm, bottom=3cm, left=4cm, right=4cm]{geometry}

\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{tgpagella}
\usepackage[utf8]{inputenc}

\xsimsetup{
exercise/the-counter = \arabic{exercise}. ,
exercise/template    = square
}

\DeclareExerciseEnvironmentTemplate{square}
{%
\Needspace*{2\baselineskip}%
\par\noindent
fbox = 1pt 0pt,
lap = {\textwidth},
valign = t,
set vsize = {0pt}{0pt}
}{\rule{0pt}{20pt}\hspace{20pt}}%
\textbf{\GetExerciseProperty{counter}} %
}

\usepackage{lipsum}

\begin{document}

\noindent\hrulefill

\begin{exercise}
\lipsum[1]
\end{exercise}

\begin{exercise}
\lipsum[2]
\end{exercise}

\end{document}


BTW: flushright is an environment (\begin{flushright}...\end{flushright}) and not to be used as command (\flushright). The corresponding command is called \raggedleft!

For the correct alignment you can play with minipage options.

For convenience, I've created a new enviroment (but nesting environments are too much above my level of knowledge, hence you have to use question environment within mine).

\documentclass[a4paper,11  pt]{article}
\usepackage[top=2cm, bottom=3cm, left=4cm, right=4cm]{geometry}
\usepackage[utf8x]{inputenc}
\usepackage[spanish]{babel}
\usepackage{varwidth}

\usepackage{lipsum}

\usepackage{fourier}
\usepackage{tgpagella}
\usepackage[T1]{fontenc}

\usepackage{exsheets}
\usepackage{setspace}
\onehalfspacing
\usepackage{etoolbox}
\usepackage{titling}

\setlength{\parindent}{0pt}
\newcommand{\subtitle}[1]{%
\posttitle{%
\par\end{center}
\begin{center}\large#1\end{center}
\vskip0.5em}%
}

\title{Title goes here}
\subtitle{Subtitle goes here}
\date{\vspace{-15ex}}
\newenvironment{myquest}{%
\begin{minipage}[t][\height][t]{.85\textwidth}
}{%
\end{minipage}%
\begin{minipage}[t][26pt][b]{.15\textwidth}
\raggedleft
\framebox(20,20){}
\end{minipage}
\vspace{\baselineskip}
}

\begin{document}

\maketitle

\hrulefill
\vspace{0.5 em}

\hrulefill
\vspace{1cm}
\begin{myquest}
\begin{question}
\lipsum[1]
\end{question}
\end{myquest}

\begin{myquest}
\begin{question}
\lipsum[2]
\end{question}
\end{myquest}

\end{document}


It's likely there's a better solution using exsheets options, but I don't know that package, maybe I'll edit my answer after reading its documentation (if someone else doesn't answer before me).

Edit: see clemens's answer for an exsheets solution.