Exsheets: 同じ行に「ソリューション」を印刷するにはどうすればよいですか?

Exsheets: 同じ行に「ソリューション」を印刷するにはどうすればよいですか?

本の最後にある質問の解答を印刷 (ダンプ) したいのですが。 を使用すると、\printsolutionsすべての解答が新しい行 (新しい段落) に表示されます。

これらを同じ行に配置する必要があります (数字のみ、名前なし)。次のようになります。

1)ソルワン。2)ソル2。3)...などなど

これを実現する方法/回避策はありますか?

もしそうなら、セクション/サブセクション名をリストに(同じ行に)自動的に含める方法はありますか?例えば:¨

第1条 第1項 1)ソルワン。2)ソル2。第二項 1)ソルワン。2)ソル2。第2条 第1項 1)ソルワン…

編集:

cgnieder 編集に従って、手動ラベル付けと '\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-nrheadings インスタンスを使用し、\exsheets_par:を に設定することで実現できます\scan_stop:。2 番目のポイントは、exsheetsa)\par環境の後に を挿入すること、および b) の後に垂直スペースを挿入することを防ぎます\par。これは文書化されていない機能ですが、この目的のために組み込まれています。そのための公式ユーザー インターフェイスを追加します。

残念ながら、セクション タイトルが適切な場所に挿入された完全なリストを自動的に取得する方法は現在ありません。ただし、半自動ソリューションとして、exsheets'\exlabelメカニズムを と併用することは可能です。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次のように使用して、同じレイアウトを のみで実現できます。1つの呼び出し\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}

関連情報