インデントの説明

インデントの説明

説明のラベルをインデントする際に問題が発生しています。新しい環境を定義し、leftmargin を任意の値に設定しようとしましたが、ラベルはそのままです。どうすれば目的を達成できますか?

私がやったことはこれです:

\newenvironment{owndesc}
{\begin{description}
\setlength{\leftmargin}{3cm}
\setlength{\labelsep}{5cm}}
{\end{description}}

私は LaTeX の初心者なので、どんな助けでも大歓迎です。よろしくお願いします!

答え1

このような場合、最も簡単なのは列挙項目パッケージを作成し、そのパッケージのコマンド\newlist\setlistコマンドを使用して、(i) 基本リスト タイプ (ここでは ) の 1 つを「複製」しdescription、新しいリスト タイプ (ここではowndesc) を作成し、(ii) 新しいリスト タイプのパラメータを設定します。

次の例では、上部の水平線はテキスト ブロックの幅を示すためだけに使用されています。Lipsum はフィラー テキストとして使用されます。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{enumitem,lipsum} % lipsum for filler text
\newlist{owndesc}{description}{1}  % clone an existing list type
\setlist[owndesc]{leftmargin=3cm,labelsep=4cm} % set parameters of cloned list

\begin{document}
\hrule % demonstrate width of text block 
\begin{owndesc}
\item[firstlabel]  \lipsum*[1]
\item[secondlabel] \lipsum*[2]
\end{owndesc}
\end{document}

答え2

もう一つの解決法は、常に を使用することenumitemで、bodyアイテムの が常に同じ場所から始まるようにすることです。まず、enumitem を使用してパラメータが何を与えるかを示します。

    \documentclass[11pt]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{enumitem}
    \usepackage[showframe, nomarginpar]{geometry}

    \newenvironment{owndesc}%
    {\begin{description}[leftmargin = 3cm, labelsep = 5cm]}
    {\end{description}}

    \newenvironment{mydesc}%
    {\begin{description}[ style =sameline, leftmargin = 3cm,  itemindent = 2cm]}%,
    {\end{description}}

    \begin{document}

    \begin{owndesc}
        \item[Title of the first item] Anything will do. \\New line for this item
        \item[Title of the second  item] Second item. \\ Another line for this one.
    \end{owndesc}
    \vspace{2ex}

    \begin{mydesc}
        \item[Title of the first item] Anything will do. \\New line for this item
        \item[Title of the second  item] Second item. \\ Another line for this one.
        \item[A third item with a longer title] Third item. \\ Another line for this one.
    \end{mydesc}

    \end{document} 

ここに画像の説明を入力してください

関連情報