我想设计一张练习表。以下是我目前所得到的:
\documentclass[DIV=15]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{csquotes}
%\usepackage{dsfont}
\usepackage{lipsum}
\usepackage{enumitem}
\newcommand{\points}[1]{{\small\textbf{(#1)}}}
\newcounter{ExCount}
\newenvironment{exercise}
[2]
{\refstepcounter{ExCount}\par\medskip\noindent\textbf{Exercise \arabic{ExCount}%
\ifstrempty{#1}{}{~\normalfont(#1)}} \hfill{\small (Points: \textbf{#2})}%
\hrule\vspace{\itemsep}\noindent\newline}
{\par\medskip}
\newlist{exlist}{enumerate}{2}
\setlist[exlist,1]{label=\roman*)}
\setlist[exlist,2]{label=\alph*)}
\newcommand*\raiseup[1]{%
\begingroup
\setbox0\hbox{\tiny\strut #1}%
\leavevmode
\raise\dimexpr \ht\strutbox - \ht0\box0
\endgroup
}
\begin{document}
\begin{center}
Some Course (2019) \hfill
Prof. xyz $\cdot$ xyz
\hrule
\vspace{0.2cm}
{\large \textbf{Exercise 01} } \hfill \raiseup{\small Total points: \textbf{4 points + 4 extra points*}}
\vspace{0.1cm}
\small\raggedright (Deadline: 20/04/2019)
\end{center}
%%%%%
%
% Some Topic
%
%%%%%
\begin{exercise}{Some Topic}{10}
\lipsum[1]
\end{exercise}
%%%%%
%
% Some Other Topic
%
%%%%%
\begin{exercise}{Some Other Topic}{8}
\begin{exlist}
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\begin{exlist}
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\end{exlist}
\end{exlist}
\end{exercise}
%%%%%
%
% More Topics
%
%%%%%
\begin{exercise}{More Topics}{8}
Let something be something. Then:
\begin{exlist}
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\begin{exlist}
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\end{exlist}
\end{exlist}
\end{exercise}
\hrule
\vspace{\baselineskip}
\centering
Good luck! :)
\end{document}
但是现在,列表会导致不理想的间距。我希望间距在任何地方都相同(尤其是列表前后,就像没有间距一样)。你知道该如何解决吗?
此外,您还有什么改进建议吗?
答案1
这更符合你的要求吗?
\documentclass[DIV=15]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{csquotes}
%\usepackage{dsfont}
\usepackage{lipsum}
\usepackage{enumitem}
\newcommand{\points}[1]{{\small\textbf{(#1)}}}
\newcounter{ExCount}
\newenvironment{exercise}
[2]
{\refstepcounter{ExCount}\par\medskip\noindent\textbf{Exercise \arabic{ExCount}%
\ifstrempty{#1}{}{~\normalfont(#1)}} \hfill{\small (Points: \textbf{#2})}%
\hrule\vspace{\itemsep}\noindent\newline}
{\par\medskip}
\newlist{exlist}{enumerate}{2}
\setlist[exlist,1]{label=\roman*)}
\setlist[exlist,2]{label=\alph*)}
\newcommand*\raiseup[1]{%
\begingroup
\setbox0\hbox{\tiny\strut #1}%
\leavevmode
\raise\dimexpr \ht\strutbox - \ht0\box0
\endgroup
}
\begin{document}
\begin{center}
Some Course (2019) \hfill
Prof. xyz $\cdot$ xyz
\hrule
\vspace{0.2cm}
{\large \textbf{Exercise 01} } \hfill \raiseup{\small Total points: \textbf{4 points + 4 extra points*}}
\vspace{0.1cm}
\small\raggedright (Deadline: 20/04/2019)
\end{center}
%%%%%
%
% Some Topic
%
%%%%%
\begin{exercise}{Some Topic}{10}
\lipsum[1]
\end{exercise}
%%%%%
%
% Some Other Topic
%
%%%%%
\begin{exercise}{Some Other Topic}{8}
\begin{exlist}[topsep = 0pt, before= \vspace*{-\dimexpr\baselineskip }]
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\begin{exlist}
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\end{exlist}
\end{exlist}
\end{exercise}
%%%%%
%
% More Topics
%
%%%%%
\begin{exercise}{More Topics}{8}
Let something be something. Then:
\begin{exlist}
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\begin{exlist}
\item This is some exercise about weird math stuff.
\item This is another exercise about more weird math stuff.
\end{exlist}
\end{exlist}
\end{exercise}
\hrule
\vspace{\baselineskip}
\centering
Good luck! :)
\end{document}