
Я хотел бы --- используя exercise
пакет --- сделать списки упражнений, используя ExerciseList
среду. Вывод должен выглядеть как в примере ниже.
Упражнения должны быть с отступом, как показано, с номером слева, как в обычной среде списка. Можно ли это сделать в пакете exercise
?
РЕДАКТИРОВАТЬ:Чтобы порадовать @cfr, я публикую свои попытки решения этой проблемы. Код болезненно падает:
\documentclass[openright,book]{memoir}
%Dansk sprog:
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage[T1]{fontenc}
\renewcommand{\danishhyphenmins}{22}
%\OnehalfSpacing %hvis der oenskes halvanden linjeafstand
%Pakker
\usepackage[noDcommand]{kpfonts} % the kpfonts font
\usepackage{%
amsmath,graphicx,enumerate,amstext,geometry,array,xfrac,bm,mathtools,siunitx,
%tikz, pgfplots
etoolbox, xparse, %til subexc
fixltx2e, %fikser et par bugs i LaTeX-kernen
microtype, %smaa fiks, der goer tekst lettere at laese
varioref,
}
\usepackage{exercise}
\renewcommand\ExerciseListName{} % I don't want any word like "exercise" anywhere
\renewcommand\ExerciseHeaderTitle{\Exercisetitle}
\renewcommand{\ExerciseListHeader}{\ExerciseHeaderDifficulty%
\item[\ExerciseHeaderNB]\ExerciseHeaderTitle\ %
\ExerciseHeaderOrigin\ignorespaces}
\renewenvironment{ExerciseList}{\enumerate[1]\beginExerciseListEnv}{\endExerciseListEnv\endenumerate}
\begin{document}
\begin{ExerciseList}
\Exercise What is this?
\Exercise What is that
\Question What in the world?
\subQuestion What is this?
\ExeText We define $x = y$.
\end{ExerciseList}
\end{document}
решение1
Поскольку в комментариях exsheets
приветствовалось решение для такой компоновки, вот оно... exercise
хотя использование довольно сильно отличается от пакета...
Решение состоит из нескольких этапов:
addmargin
Оберните окружение KOMA-Script вокругquestion
окружения с помощьюetoolbox
's\AtBeginEnvironment
и\AtEndEnvironment
. Это сделает отступы в телах вопросов на указанное поле (3em
в примере ниже).addmargin
Окружение предоставляется пакетом,scrextend
поэтому его можно использовать и с другими классами.Объявите новый экземпляр заголовка, вдохновленный
margin-nr
экземпляром, описанным вexsheets
руководстве, который использует те же поля, что установлены средойaddmargin
(3em
в примере ниже), чтобы разместить номер вопроса, выровненный с полем текста.Настройте
exsheets
использование нового экземпляра и добавьте некоторые параметры для нумерации разделов.
Вот как выглядит документ из кода ниже:
\documentclass{article}
\usepackage{scrextend}% not needed with a KOMA-Script class, provides the
% `addmargin' environment
\usepackage[load-headings]{exsheets}
\DeclareInstance{exsheets-heading}{mylist}{default}{
runin = true ,
attach = {
main[l,vc]number[l,vc](-3em,0pt) ; % 3em = indent of question body
main[r,vc]points[l,vc](\linewidth+\marginparsep,0pt)
}
}
\SetupExSheets{
headings = mylist , % use the new headings instance
headings-format = \normalfont ,
counter-format = se.qu ,
counter-within = section
}
\usepackage{etoolbox}
% 3em = indent of question body :
\AtBeginEnvironment{question}{\addmargin[3em]{0em}}
\AtEndEnvironment{question}{\endaddmargin}
\usepackage{lipsum}
\begin{document}
\setcounter{section}{10}
\section*{Exercises}
\subsection*{Exercises to section \thesection}
\begin{question}
\lipsum[4]
\end{question}
\begin{question}
\lipsum[6]
\end{question}
\begin{question}
\lipsum[10]
\end{question}
\end{document}