저는 숙제 문제를 위한 매우 간단한 사용자 정의 환경을 정의했습니다. 기본적으로는 enumerate
들여쓰기가 없지만 다음과 같습니다.
\newcounter{hwprob}
\newenvironment{hwprob}{\refstepcounter{hwprob} \textbf{\thehwprob.} ~ }{}
enumerate
내부의 실제 환경을 열면 hwprob
다음과 같은 일이 발생합니다.
\begin{hwprob}
\begin{enumerate}
\item Some text.
\item Some other text.
\end{enumerate}
\end{hwprob}
첫 번째 항목 1이 왜 같은 줄에서 시작되지 않는지 잘 모르겠습니다.1.물결표를 제거하려고 시도했지만 소용이 없었습니다. 제가 당황스러운 점은 환경 enumerate
내부에서 사용할 때 proof
첫 번째 항목이 다음과 같은 줄에 있을 것이라는 점입니다.증거., 올바른 들여쓰기와 모든 것.
이 문제를 해결하려면 어떻게 해야 합니까? 이것은 내가 정의한 결과입니까 hwprob
, 아니면 고유한 것입니까 enumerate
?
답변1
"방법" 부분은 다음과 같습니다. hwprob
목록 환경으로 정의하고 \item
의 시작 부분에 자동으로 삽입합니다 hwprob
.
\documentclass{article}
\usepackage{enumitem}
\newlist{hwprob}{enumerate}{1}
\setlist[hwprob]{label=\textbf{\arabic*.}, first*=\item}
\begin{document}
\begin{hwprob}
\begin{enumerate}
\item Some text.
\item Some other text.
\end{enumerate}
\end{hwprob}
\end{document}
"왜" 부분의 경우 목록 및 정리 환경 모두에서 사용되는 공통 기반인 \trivlist
(아마도 )와 관련이 있는 것 같습니다 .\parshape
답변2
달성하려는 형식(목록의 첫 번째 항목이 enumerate
줄 바꿈 이후 시작되지 않고 현재 줄에서 시작되도록 함)은 enumerate
환경이 하나의 LaTeX list
또는 trivlist
환경 내에서 시작되는 경우 발생합니다.
형식 지정 목표를 달성하려면 enumitem 패키지를 로드하고 해당 패키지 \newlist
와 \setlist
매크로를 사용하여 이라는 맞춤형 열거형 목록 환경을 만드는 것이 좋습니다 hwprob
.
\documentclass{article}
\usepackage{enumitem}
\newlist{hwprob}{enumerate}{1}
\setlist[hwprob,1]{label=\bfseries\arabic*.,left=0pt}
\begin{document}
\begin{hwprob}
\item
\begin{enumerate}
\item Some text.
\item Some other text.
\end{enumerate}
\end{hwprob}
\end{document}