11

I'd like to use LaTeX for lecture notes but I use bullet lists extensively, and the itemize macro in LaTeX is too time consuming for lecture notes. But if I could teach LaTeX how to do it for me things would be beautiful! (Typing equations in OpenOffice is annoying...)

If I'm typing a regular paragraph in LaTeX, every new line would be bulleted. There would be a command to denote an item that exists outside the bulleted paragraph. Finally, commands like \up, \down to promote/demote all lines of text that follow them in the list.

An example:

\title{this would be the title of a slide}
this is a line of text
this is another line of text
\up
this is a subpoint
another
\down
last line

To get:

This would be the title of a slide

  • this is a line of text
  • this is another line of text
    • this is a subpoint
    • another
  • last line

In a comment below, Werner described this more specifically. I want to "avoid using \item for every paragraph, and instead just let the paragraph breaks be "equivalent to" \item, while \up initiates a new itemize environment, and \down closes it." \title would then close all itemize environments (the bolding is something I'd like to automatically have done but not necessarily relevant to the question).

2

2 Answers 2

12

I'm sure there are packages doing this, but probably it's too simple for there to be a dedicated package exactly for this.

Here's a simple solution which probably has to be extended to be really useful.

\documentclass{article}

\makeatletter

\newcommand\startitems
{%
  \begingroup
  \parindent\z@
  \@itemdepth\@ne
  \@totalleftmargin\csname leftmargin\romannumeral\the\@itemdepth\endcsname
  \leftskip\@totalleftmargin
  \everypar
  {%
    \llap{%
      \makebox[\labelsep][l]
      {%
        \csname labelitem\romannumeral\the\@itemdepth\endcsname
      }
    }%
  }%
  \obeylines
}
\newcommand\stopitems
{%
  \bottom
  \par\endgroup
}

\newcommand\up
{%
  \par
  \begingroup
    \advance\@itemdepth\@ne
    \advance\@totalleftmargin\csname leftmargin\romannumeral\the\@itemdepth\endcsname
    \leftskip\@totalleftmargin
}

\newcommand\down{\par\endgroup}

\newcommand\bottom
{%
  \ifnum\@itemdepth>\@ne
    \down\bottom
  \fi
}

\makeatother

\begin{document}

\section*{title}
\startitems
this is a line of text
this is another line of text
\up
this is a subpoint
another
\up
sub-sub  point
\bottom
back to first level
\stopitems

\noindent Normal text
\end{document}

There has to be some way to enclose the itemizing effect, so I added \startitems \stopitems.

example

2
  • Stephan, this is great. I have some ideas on how to improve this. But I'm still brand new to macro writing. Is there a way to have, for instance, a command \first that repeatedly calls \down using a while loop or something such that the text succeeding the \first command will be on the first level of the list?
    – glifchits
    Commented Apr 21, 2012 at 23:28
  • 1
    @glifchits As \down closes a dynamic scoping level (called group), it is easiest to do this recursively. See my edit. Commented Apr 22, 2012 at 2:48
2

You probably need to familiarize yourself with one of lightweight markup languages. My favorite is txt2tags. This is how your MWE would look in txt2tgs.

How to type LaTeX using txt2tgs
Predrag Punosevac
4/20/2012

                   = This would be the title of a slide =

- this is a line of text
- this is another line of text
 - this is subpoint
 - another 
- last line

Now you process your document with the following command

txt2tags -t tex myfilename.txt
pdflatex myfilename.tex

to get the following output

enter image description here

It also appears that you want some kind a text presentation program. I really recommend tpp. It is ideal for computer science presentations. It might sound ironic but I used tpp to give an intro to TeX for absolute beginners.

2
  • 2
    I don't think this is what the OP is after. The OP wants to avoid using \item for every paragraph, and instead just let the paragraph breaks be "equivalent to" \item, while \up initiates a new itemize environment, and \down closes it.
    – Werner
    Commented Apr 21, 2012 at 3:47
  • @Werner that is exactly what I am after. I would love it if the solution could be built into a new documentclass and I can continue to use TeXworks to write my LaTeX lecture notes. That being said, Predrag, this sounds interesting and I will be sure to investigate.
    – glifchits
    Commented Apr 21, 2012 at 5:43

You must log in to answer this question.

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