
나는 두 가지 다른 열거(모든 데모에 대한 열거와 정의에 대한 열거)가 있는 고유한 목록을 만들고 싶습니다. 다음과 같은 것 :
1) 정의. 피포의
2) 정의. 명왕성의
[1] 명왕성이 삐포의 개임을 증명하라
3) 데프. 토폴리노
[2] 토폴리노와 삐포가 친구라는 것을 증명하세요
코드의 아이디어는 다음과 같습니다.
\begin{enumerate}
\item_def Def. of Pippo
\item_def Def. of Pluto
\item_proof Prove that Pluto is the dog of Pippo
\item_def Def. of Topolino
\item_proof Prove that Topolino and Pippo are friends
\end{enumerate}
답변1
대안으로, enumite 패키지*를 피하고 싶다면 이것이 유용할 수 있습니다.
들여쓰기를 원하는지 모르겠습니다. 그렇다면 언제든지 정의에 공백을 넣을 수 있습니다.
\newcounter{enumcounter} % Used to reset counters - if you've only two new itemtypes,
% probably as easy to reset them explicitly, but for more this
% is more efficient
\newcounter{defcount}[enumcounter] % Counts your definition items, resets every time enumcounter increments
\newcounter{proofcount}[enumcounter]
\newenvironment{myenumerate}{\begin{description}\stepcounter{enumcounter}}{\end{description}}
% defined a new environment, which uses description instead of enumerate or itemize, to avoid the pre-existing
% counters. The spacing is not identical, granted.
\newcommand*{\itemdef}{\item\addtocounter{defcount}{1}(\thedefcount) } % increments the counter, describes item look
\newcommand*{\itemproof}{\item\addtocounter{proofcount}{1}[\theproofcount] }
\begin{document}
Here is an example:
\begin{myenumerate}
\itemdef Def. of Pippo
\itemdef Def. of Pluto
\itemproof Prove that Pluto is the dog of Pippo
\itemdef Def. of Topolino
\itemproof Prove that Topolino and Pippo are friends
\end{myenumerate}
And another list of things to check that counters reset:
\begin{myenumerate}
\itemproof Blah
\itemdef Bleep
\itemproof Bloop
\end{myenumerate}
And another line to check that vertical spacing is fine.
*여기 있는 모든 사람들이 그것을 좋아한다는 것을 알고 있습니다. 이는 충분히 공평하지만 설정과의 충돌로 인해 제작 편집 대기열에 도달할 때 제거해야 하는 첫 번째 패키지 중 하나입니다.
답변2
이와 같은 것이 원하는 것을 수행해야 합니다. 패키지 enumitem
를 사용하면 사용자 정의 목록을 쉽게 생성할 수 있으며, 재개하도록 목록을 지정할 수 있습니다. 현재 컨텍스트에서 재개된 목록은 정의 목록 내에 있으므로 해당 카운터는 해당 목록에 대해 로컬입니다. enumitem
간격 매개변수 등에 대해서는 설명서(또는 사이트의 다른 질문)를 참조하세요 .
\documentclass{article}
\usepackage{enumitem}
\newlist{defn}{enumerate}{1}
\newlist{demo}{enumerate}{1}
\setlist[defn]{label={\arabic*)}}
\setlist[demo]{label={[\arabic*]},resume}
\begin{document}
\begin{defn}
\item Def. of Pippo
\item Def. of Pluto
\begin{demo}
\item Prove that Pluto is the dog of Pippo
\end{demo}
\item Def. of Topolino
\begin{demo}
\item Prove that Topolino and Pippo are friends
\end{demo}
\end{defn}
\end{document}