我用exsheets
它来生成一些练习纸。布局如下:
- 首先是“EXERCISE”这个词
- 在 EXERCISE 一词下是练习,它们在部分内被编号
我希望练习的编号在单词 EXERCISE 下右对齐。我找到了如何对间距进行硬编码,使其看起来像右对齐。当您有超过 9 个章节时(就像我一样),此解决方法不再有效。
这就是我想要的对齐...
...但如果我对第 10 章以上的间距进行硬编码,那么第 10 章以下的间距就不起作用了
梅威瑟:
\documentclass[12pt, a4paper]{scrbook}
\usepackage{exsheets}
\DeclareInstance{exsheets-heading}{hugeIndent}{default}{
runin = true,
attach = {main[r,vc]number[l,vc](-3.8em,0pt)} % right alignment hardcoded
}
\SetupExSheets{
headings=hugeIndent,
question/pre-hook=\begin{addmargin}[4.6em]{0cm},
question/post-hook=\end{addmargin},
counter-within={section},
counter-format=ch.se.qu[1]
}
\begin{document}
\part{EXCERCISES}
\chapter{Topic 1}
\section{Section}
Exercise
\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\section{Section}
Exercise
\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\setcounter{chapter}{9}
\chapter{Topic 2}
\section{Section}
Exercise
\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\section{Section}
Exercise
\begin{question}
I'm an excercise.
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\end{document}
答案1
这只是一个正确连接和附加构成练习标题的方框的问题。请注意单词锻炼在下面的代码中自动添加。
剩余问题:
- 应该说锻炼出现在每个练习的上方?(这是我现在的解决方案)
- 应该锻炼并且练习编号有不同的格式(就像在 OP 中以及我的解决方案现在所做的那样)?
- 解决方案应该具有相同还是不同的布局?
\documentclass[12pt, a4paper]{scrbook}
\usepackage{exsheets,calc}% the calc package provides \widthof
\newlength\headingsep
\setlength\headingsep{1em}
\newlength\exercisemargin
% use \textbf{Exercise} if you want bold headings, see also below
\setlength\exercisemargin{\widthof{Exercise}+\headingsep}
\DeclareInstance{exsheets-heading}{custom}{default}{
above = \baselineskip ,
runin = true ,
number-pre-code = \bfseries , % only necessary if points should have a
% different formatting than the title
join = { title[r,b]number[r,t](0pt,0pt) } ,
attach = { main[r,t]title[r,t](-\headingsep,\baselineskip) }
}
\SetupExSheets{
headings = custom ,
headings-format = , % important if ``Exercise'' should be printed with \normalfont!
question/pre-hook = \begin{addmargin}[\exercisemargin]{0cm},
question/post-hook = \end{addmargin},
counter-within = section ,
counter-format = ch.se.qu
}
\usepackage{lipsum}
\begin{document}
\setcounter{chapter}{9}
\chapter{Topic 2}
\section{Section}
\begin{question}
I'm an excercise. \lipsum[4]
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\section{Section}
\begin{question}
I'm an excercise. \lipsum[4]
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\end{document}
如果锻炼不应该成为问题标题的一部分:
\documentclass[12pt, a4paper]{scrbook}
\usepackage{exsheets,calc}% the calc package provides \widthof
\newlength\headingsep
\setlength\headingsep{1em}
\newlength\exercisemargin
\setlength\exercisemargin{\widthof{Exercise}+\headingsep}
\DeclareInstance{exsheets-heading}{custom}{default}{
runin = true ,
attach = { main[r,t]number[r,t](-\headingsep,0pt) }
}
\SetupExSheets{
headings = custom ,
question/pre-hook = \begin{addmargin}[\exercisemargin]{0cm},
question/post-hook = \end{addmargin},
counter-within = section ,
counter-format = ch.se.qu
}
\usepackage{lipsum}
\begin{document}
\chapter{Topic 1}
\section{Section}
Exercise
\begin{question}
I'm an excercise. \lipsum[4]
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\begin{question}
I'm an excercise. \lipsum[4]
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\setcounter{chapter}{9}
\chapter{Topic 2}
\section{Section}
Exercise
\begin{question}
I'm an excercise. \lipsum[4]
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\begin{question}
I'm an excercise. \lipsum[4]
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\section{Section}
Exercise
\begin{question}
I'm an excercise. \lipsum[4]
\end{question}
\begin{solution}
I'm a solution.
\end{solution}
\end{document}