13

This is how you type set a nested list in LaTeX:

\begin{itemize}
    \item I have a house
    \begin{itemize}
        \item It has 4 walls
        \item a roof,
        \item two windows,
        \item and a door
        \begin{itemize}
            \item with a handle
            \item and a lock
        \end{itemize}
    \end{itemize}
    \item I also have a car
    \begin{itemize}
        \item but I will not talk of it further
    \end{itemize}
\end{itemize}

This is the same list in Markdown:

 - I have a house
    - It has 4 walls,
    - a roof,
    - two windows
    - and a door
         - with a handle
         - and a lock
 - I also have a car
    - But I will not talk of it further

The Latex one is really verbose. I am finding it particularly annoying when writing slides with Beamer. Nesting 3 deep is rarely a good idea, but having a list that contains a few subitems for every item is not bad at all, but will still be uncomfortable verbose.

Is there a package that provides a alternative syntax for writing lists?


Using a few defs can help maybe, but seems hacky

\newcommand{\ol}{\begin{itemize} }
\newcommand{\ole}{\end{itemize} }
\newcommand{\li}{\item }

Parsing markdown lists syntax seems like it could be done with Lua, or maybe even with xargs, but I am not so great at this kinda thing (yet).

4
  • 3
    May be seeing indentation is a bit difficult, but you could, for instance, in a relatively simple way see - for \item and -- for \iitem where both are a little inteligent and start a new \begin{itemize} or end a \end{itemize} when necessary.
    – Manuel
    Sep 3, 2014 at 17:41
  • Have you seen tex.stackexchange.com/q/101717/17423? Sep 3, 2014 at 17:42
  • Isn't it rather a problem of configuring your editor?
    – Bernard
    Sep 3, 2014 at 17:54
  • @Bernard: no because the verbosity is not a just a typing problem (though it is that -- a missed end is annoying to find), it is also a reading problem Sep 4, 2014 at 0:11

2 Answers 2

19

Have a look for example at the easylistpackage. It simplifies the process by defining one active character whose number of occurences defines the level of this specific list item.

\documentclass{article}
\usepackage{easylist}
\begin{document}

\begin{easylist}
§ First level
§§ Second level
§§§ Third level
§§§ Again third level
§§§§ Now fourth level
§ First level again
\end{easylist}
\end{document}

easylist example

2
6

enter image description here

\documentclass{article}

\newcommand{\ol}[1]{\begin{enumerate}#1\end{enumerate}}
\newcommand{\ul}[1]{\begin{itemize}#1\end{itemize}}
\newcommand{\li}[1]{\item{#1}}

\newlength{\shiftwidth}
\setlength{\shiftwidth}{3em}
\newcommand{\info}[1]{\par\hspace*{#1\shiftwidth}$\bullet$\quad}

\begin{document}

Simple ways to make lists less verbosely in \LaTeX:

\ol{%
  \li{Redefine the markup commands to match HTML.}
    \ul{%
       \li{This means turning the list environments into commands.}
       \li{This is actually less verbose than real HTML.}
       \li{You do have to keep track of the end braces and (I think) comment out the newlines.}
    }
   \li{Define commands to insert horizontal space and bullets manually, as shown below.}
}

\info{0} This is level 0.
    \info{1} This is level 1.
        \info{2} And this level 2.

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .