0

I have the following itemized list:

enter image description here

but I would like the indentation to be generated as this:

enter image description here

I have tried what is in this link as follows

\dirtree{%
.1 Gas ideal (partículas idénticas que no interactúan, i.e. la energía no tiene términos cruzados).
.2 Fermiones.
.3 Límite de gas no degenerado. Corresponde a temperaturas muy altas y densidades muy bajas, el resultado es el gas ideal clásico.
.3 Límite de gas degenerado. Es lo opuesto, temperaturas bajas y densidades altas. Aparece Pauli con su principio de exclusión. 
.4 Enanas blancas. 
.2 Bosones.
.3 Límite de gas no degenerado. Corresponde a temperaturas muy altas y densidades muy bajas, el resultado es el gas ideal clásico.
.4 Gas de fotones.
.4 Gas de fonones.
.3 Límite de gas degenerado. Básicamente es un condensado de Bose-Einstein. 
.4 Superfluidos.
.4 Superconductores.
.1 Otros temas que no sean gas ideal. No vimos nada, creo.
}

with no success. I get an error that says

Use of \next doesn't match its definition.

  • Yes, I get the same error. Sorry I forgot to put it in the question. Now I have added it. – user171780 Mar 17 '18 at 13:34
3

As you yourself have noticed, dirtree is not really the right tool for this purpose. One possibility is to use TikZ's forest, as Alan pointed out in his comment. If you prefer the input structure of LaTeX lists, you could combine enumitem and TikZ to get something like this:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{tikz}

\makeatletter
    \newlist{treelist}{itemize}{5}
    \setlist[treelist]{label=\treelist@label}

    \tikzset{treelist line/.style={thick, line cap=round, rounded corners}}
    \def\treelist@label{%
        \begin{tikzpicture}[remember picture, baseline={([yshift=-.6ex] treelist-bullet-\the\enit@depth.center)}]
            \draw [treelist line] (0, 0) -- node (treelist-bullet-\the\enit@depth) {} ++(.5em, 0);
        \end{tikzpicture}%
        \ifnum\enit@depth>1
            \tikz[remember picture, overlay] \draw [treelist line] (treelist-bullet-\the\numexpr\enit@depth-1\relax.center) |- (treelist-bullet-\the\enit@depth.center);%
        \fi
    }
\makeatother

\begin{document}

\begin{treelist}
    \item
    Gas ideal (partículas idénticas que no interactúan, i.e.~la energía no tiene términos cruzados).
    \begin{treelist}
        \item
        Fermiones.
        \begin{treelist}
            \item
            Límite de gas no degenerado.
            Corresponde a temperaturas muy altas y densidades muy bajas, el resultado es el gas ideal clásico.

            \item
            Límite de gas degenerado.
            Es lo opuesto, temperaturas bajas y densidades altas.
            Aparece Pauli con su principio de exclusión. 
            \begin{treelist}
            \item
            Enanas blancas. 

            \end{treelist}

        \end{treelist}

        \item
        Bosones.
        \begin{treelist}
            \item
            Límite de gas no degenerado.
            Corresponde a temperaturas muy altas y densidades muy bajas, el resultado es el gas ideal clásico.
            \begin{treelist}
                \item
                Gas de fotones.

                \item
                Gas de fonones.

            \end{treelist}

            \item
            Límite de gas degenerado.
            Básicamente es un condensado de Bose-Einstein.
            \begin{treelist}
                \item
                Superfluidos.

                \item
                Superconductores.

            \end{treelist}

        \end{treelist}

    \end{treelist}

    \item
    Otros temas que no sean gas ideal. No vimos nada, creo.

\end{treelist}

\end{document}

output from the code above

The 5 in \newlist{treelist}{itemize}{5} sets the maximum list depth. If you need more than five levels, just increase this number. If you want to further customize the appearance of these lists, you should have a look at the documentations of enumitem and TikZ.

3
  • You forgot the % after \dirtree{ (as pointed out as required in the link you provided).
  • Since you have dots in your list items, you will need to hide them as in
    .3 {Límite de gas degenerado. Básicamente es un condensado de Bose-Einstein}.
    Note that the last dot will not show up in your output, since it marks the end of the item.
  • You Probably want to define \renewcommand*\DTstyle{} in order for the list not to be typeset using \ttfamily.

  • Also, you should replace i.e. la by i.e.~la or one of the other possibilities that tell TeX that there is no end of sentence here. See this question, for example.
  • Thanks for your answer. It solved the problem about the compilation but now I see that dirtree is not the most appropriate way to do what I want. It generates an output as in the image on this URL: image.ibb.co/jv3QXx/imagen.png and not only changes the font style but also fails where I have indicated in red. Do you know any alternatives? Thank you anyway! – user171780 Mar 17 '18 at 14:00
  • @user171780 In addition to @remco's comment, the same question you linked to has an alternative solution using forest, a TikZ based tree drawing package. – Alan Munn Mar 17 '18 at 14:10
  • @user171780: See my second answer for another possibility. – schtandard Mar 17 '18 at 16:01
1

You forgot to put a '%' immediately after the '\dirtree{'. The link you provided has that '%', with a comment saying " This % is required"

  • See the answer below for the problem with the extra '.' you have in your nodes. According to the docs, a node is defined as ".<level><space><note text>.<space", so any '. ' within a node (like end of phrase) will end the current node, but it's not followed by the next node ('.<level>' combination like '.3') => error – remco Mar 17 '18 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.