Exsheets: 같은 줄에 '솔루션'을 어떻게 인쇄합니까?

Exsheets: 같은 줄에 '솔루션'을 어떻게 인쇄합니까?

책 끝부분에 있는 질문에 대한 답을 인쇄(덤프)하고 싶습니다. 그냥 사용하면 \printsolutions새 줄(새 단락)에 모든 솔루션이 표시됩니다.

같은 줄에 있어야 합니다(번호만 있고 이름은 없음). 다음과 같습니다.

1)솔 원.2)솔 투.삼)... 등.

이를 수행할 수 있는 방법/해결 방법이 있습니까?

그렇다면 섹션/하위 섹션 이름을 목록(같은 줄)에 자동으로 포함시키는 방법이 있습니까? 좋다

섹션 1. 하위 섹션 1. 1)솔 원.2)솔 투.하위 섹션 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설정하여 가능합니다 . 두 번째 점은 a) 환경 뒤에 a를 삽입하고 b) 뒤에 수직 공백을 삽입하는 것을 방지합니다 . 이는 문서화되지 않은 기능이지만 이 목적을 위해 추가 기능이 내장되어 있습니다. 이에 대한 공식 사용자 인터페이스를 추가하겠습니다.\exsheets_par:\scan_stop:exsheets\par\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다음과 같은 방법으로 사용할 수 있습니다.하나의 호출 \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}

관련 정보