Exsheets: как распечатать «решения» на одной строке?

Exsheets: как распечатать «решения» на одной строке?

Я хочу напечатать (выгрузить) решения вопросов в конце книги. Если я просто использую, \printsolutionsто каждое решение будет на новой строке (как новый абзац).

Мне нужно, чтобы они были на одной строке (только цифры, без имен), что-то вроде этого:

1)Сол один.2)Сол два.3)... и т. д.

Есть ли способ/обходной путь для достижения этой цели?

Если да, есть ли способ автоматически включить название раздела/подраздела в список (на той же строке)? Например: ¨

Раздел 1. Подраздел первый. 1)Сол один.2)Сол два.Подраздел второй. 1)Сол один.2)Сол два.Раздел 2. Подраздел 1. 1)Соль один...

Редактировать:

Следуя cgnieder Edit, я пытаюсь найти способ избежать ручной маркировки и '\nameref'. Я что-то придумал, но это не работает так, как должно - 'printsolutions' дает одно и то же имя для разделов. Пожалуйста, также смотрите встроенный текст и комментарии. Помогите!

\documentclass{scrartcl}
\usepackage{exsheets}
\setlength{\parindent}{0pt}

\DeclareQuestionProperty{section-title}
\SetupExSheets{counter-within=section ,
         headings=inline-nr ,
         counter-format=qu)}

\newcommand{\lsection}[1]{
\def\secName{#1}
\section{#1}
}
\SetupExSheets{section-hook = \noindent\bfseries
Section \GetQuestionProperty{section-title}{\CurrentQuestionID}
\space}


\begin{document}

\lsection{One}
\begin{question}
\SetQuestionProperties{section-title= \secName } 
foo
\end{question}
\begin{solution}
foo
\end{solution}

\begin{question}
\SetQuestionProperties{section-title= \secName }
bar
\end{question}
\begin{solution}
bar
\end{solution}

Solutions for section "\secName" are: \printsolutions[section]\\ % OK
ALL the solutions until here are: \printsolutions % OK

\lsection{Two}

\begin{question}
\SetQuestionProperties{section-title= \secName }
baz
\end{question}
\begin{solution}
 baz
\end{solution}

\begin{question}
\SetQuestionProperties{section-title= \secName }
foobar
\end{question}
\begin{solution}
foobar
\end{solution}

Solutions for section "\secName" are: \printsolutions[section]\\ % OK
ALL the solutions at this point are wrong, the 1st section name is "Two" instead of "One": \printsolutions % WRONG!!

\lsection{Answers} %changing '\lsection' to '\section' makes all the section names as "Two" 
This is the output of 'printsolutions' wrongly showing the same section name throuhout (the last name used):
\printsolutions

\end{document}

решение1

Список, который вы хотите, возможен с использованием inline-nrэкземпляра заголовков и с настройкой, \exsheets_par:равной \scan_stop:. Второй пункт предотвращает exsheetsa) вставку a \parпосле его окружений и b) вставку вертикального пробела после \par. Это недокументированная функция, но встроенная дополнительная для этой цели. Я добавлю официальный пользовательский интерфейс для нее.

К сожалению, в настоящее время нет возможности автоматически получить полный список с заголовками разделов, вставленными в соответствующие места. Но вы можете использовать механизм exsheets' \exlabelmaybe вместе с namerefдля полуавтоматического решения:

\documentclass{scrartcl}
\usepackage[load-headings]{exsheets}
\SetupExSheets{counter-within=section}

\usepackage{nameref}

% place \label and \exlabel simultaneously:
\newcommand*\mylabel[1]{\label{#1}\exlabel{#1}}

\begin{document}

\section{One}\mylabel{sec:foo}
\begin{question}
  foo
\end{question}
\begin{solution}
  foo
\end{solution}

\begin{question}
  bar
\end{question}
\begin{solution}
  bar
\end{solution}

\section{Two}\mylabel{sec:bar}
\begin{question}
  baz
\end{question}
\begin{solution}
  baz
\end{solution}

\begin{question}
  foobar
\end{question}
\begin{solution}
  foobar
\end{solution}

\section{Solutions}
\ExplSyntaxOn
\cs_set_eq:NN \exsheets_par: \scan_stop:
\ExplSyntaxOff
\SetupExSheets{headings=inline-nr,counter-format=qu)}

\textbf{Section \nameref{sec:foo}} \printsolutions[section={\S{sec:foo}}]
\textbf{Section \nameref{sec:bar}} \printsolutions[section={\S{sec:bar}}]

\end{document}

введите описание изображения здесь


Редактировать

С версии 0.13 (2014/05/11) exsheetsпредоставляется опция section-hook. В сочетании с namerefи свойствами вопроса ее можно использовать следующим образом для достижения того же макета только содинзов \printsolutions:

\documentclass{scrartcl}
\usepackage[load-headings]{exsheets}[2014/05/11]
\SetupExSheets{counter-within=section}
\DeclareQuestionProperty{section-title}
\usepackage{nameref}

\begin{document}

\section{One}\label{sec:foo}
\begin{question}
  \SetQuestionProperties{section-title=\nameref{sec:foo}}
  foo
\end{question}
\begin{solution}
  foo
\end{solution}

\begin{question}
  \SetQuestionProperties{section-title=\nameref{sec:foo}}
  bar
\end{question}
\begin{solution}
  bar
\end{solution}

\section{Two}\label{sec:bar}
\begin{question}
  \SetQuestionProperties{section-title=\nameref{sec:bar}}
  baz
\end{question}
\begin{solution}
  baz
\end{solution}

\begin{question}
  \SetQuestionProperties{section-title=\nameref{sec:bar}}
  foobar
\end{question}
\begin{solution}
  foobar
\end{solution}

\section{Solutions}

\SetupExSheets{
  headings = inline-nr , % numbered and inline
  counter-format = qu) , % numbers 1) 2) ... 
  section-hook =         % code to be added before solutions of a new section
                         % are printed
    % \par begin a new paragraph for a new section
    \noindent\bfseries
    Section \GetQuestionProperty{section-title}{\CurrentQuestionID}%
    \space
}

\printsolutions

\end{document}

Связанный контент