
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
ただし、使用方法はパッケージとはまったく異なります...
ソリューションにはいくつかのステップが含まれます。
と を使用して、 KOMA-Script の環境を 環境にラップします
addmargin
。これにより、質問本文が指定されたマージン (以下の例では ) でインデントされます。環境はパッケージによって提供されるため、他のクラスでも使用できます。question
etoolbox
\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}