
itemize
/環境の代わりに使用するコマンドを実装しようとしていますenumerate
。アイデアとしては\detail
、環境に含まれずに項目別リストを作成するために使用できるコマンド ( ) を用意したいということです。問題は、行がページ幅よりも長く、その結果次の行に折り返される場合、折り返されたテキストのインデントを制御できないように見えることです。パッケージhanging
と を試しました\hangindent
が、あまりうまくいきませんでした。
以下に最小限の例と、コンパイル時に得られる出力を示します。理想的には、折り返されたテキストをインデントして、2 行目の最初の単語が 1 行目の最初の単語と揃うようにします。
\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}
答え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 の回答に対するコメントとしてこれを投稿したかったのですが、十分な担当者がいません。とにかく、スペースはゴムなので、固定長を使用する方が良いでしょう。\ は少し狭いように見えるので、2 回使用しましたが、好みに合わせて調整できます。