들여쓰기/텍스트 줄 바꿈

들여쓰기/텍스트 줄 바꿈

itemize/ 환경 대신 사용할 명령을 구현하려고 합니다 enumerate. 아이디어는 \detail환경에 포함되지 않고 항목별 목록을 구성하는 데 사용할 수 있는 명령( )을 갖고 싶다는 것입니다 . 내가 겪고 있는 문제는 줄이 페이지 너비보다 길어서 다음 줄로 넘어갈 때 줄 바꿈된 텍스트의 들여쓰기를 제어할 수 없는 것 같다는 것입니다. 나는 hanging패키지와 를 시도했지만 \hangindent운이 별로 좋지 않았습니다.

아래에는 최소한의 예와 컴파일 시 얻는 출력이 포함되어 있습니다. 이상적으로는 두 번째 줄의 첫 번째 단어가 첫 번째 줄의 첫 번째 단어와 정렬되도록 래핑된 텍스트를 들여쓰고 싶습니다.

\documentclass{article}
\newcommand{\detail}[1]{-- {#1}}

\begin{document}
    \noindent\textbf{This is a header}\\
    \detail{This is a detail.}\\
    \detail{This is a detail that has too many words in it and consequently runs onto the next line of the page, and I want it to have a hanging indent.}
\end{document}

여기에 이미지 설명을 입력하세요

답변1

이미 답변한 내용을 단순화하면 다음과 같습니다.

\documentclass{article}
\def\D{\par\noindent\makebox[1em][l]{-- }\hangindent1em}
\begin{document}
\subsubsection*{This is a header}
\D This is a detail
\D This is a detail that has too many words in it and consequently runs onto The next line of the page, and I want it to have a hanging indent.
\end{document}

MWE

답변2

\documentclass{article}
\newcommand{\detail}[1]{\par\noindent\hangindent=\mylen\hangafter1-- #1}
\newlength{\mylen}
\settowidth{\mylen}{-- }

\begin{document}
    \noindent\textbf{This is a header}
    \detail{This is a detail.}
    \detail{This is a detail that has too many words in it and consequently runs onto the next line of the page, and I want it to have a hanging indent.}
\end{document}

여기에 이미지 설명을 입력하세요

답변3

\documentclass{article}
\newcommand{\detail}[1]{\par\noindent\hangindent=\mylen\hangafter1--\,\,#1}
\newlength{\mylen}
\settowidth{\mylen}{--\,\,}

\begin{document}
    \noindent\textbf{This is a header}
    \detail{This is a detail.}
    \detail{This is a detail that has too many words in it and consequently runs onto the next line of the page, and I want it to have a hanging indent.}
\end{document}

이것을 Harish Kumar의 답변에 대한 의견으로 넣고 싶었지만 그에 대한 담당자가 충분하지 않습니다. 어쨌든 공간은 고무이므로 고정된 길이를 사용하는 것이 좋습니다. \, 좀 좁은 것 같아서 두 번 사용했는데 입맛에 맞게 조절하시면 됩니다.

관련 정보