Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to make alignment points in a list environment. The following code gives me an error, but it almost compiles to what I want, just missing the bullet points. I must be misunderstanding something about align and/or tabular and how they work with linebreaks. Guidance appreciated!

\documentclass{beamer}

\begin{document}

\begin{frame}
    \frametitle{Title}
    \begin{itemize}
    \begin{tabular}{ll}
        \item Topic Apple: &Something to say about it \\
        \item Topic Watermelons: &Something different
    \end{tabular}
    \end{itemize}
\end{frame}

\end{document}
share|improve this question
    
Oh, I should mention that this isn't beamer-specific...I was hasty there because this arose while I was working on a presentation. If I just use the article class then I still have the same issue. Sorry about that. –  evencoil Nov 16 '10 at 12:26
    
Well, it is sort-of beamer-specific, since beamer's handling of lists is so much different from the usual one that generic LaTeX solutions will possibly not work here. –  Ulrich Schwarz Nov 16 '10 at 12:46
    
That's true--what I meant was just that the place to start might be with a standard class and then see if the solution also works in beamer. –  evencoil Nov 16 '10 at 13:05
add comment

3 Answers 3

up vote 5 down vote accepted

You can't do this particular mixture of itemize and tabular out of the box. But the listliketab package can help. The purpose of that package is to make tables looks like lists.

\documentclass{beamer}
\usepackage{listliketab}
\begin{document}

\begin{frame}
    \frametitle{Title}
    \begin{listliketab} 
    \storestyleof{itemize} 
        \begin{tabular}{Lll}
            \textbullet & Topic Apple: &Something to say about it \\
            \textbullet & Topic Watermelons: &Something different
        \end{tabular} 
    \end{listliketab}
\end{frame}
\end{document}

Works in beamer and other all other classes (that I know of).

share|improve this answer
    
thanks, that works great. Do you know how I can inherit the bullet style from my beamer template when I use \storestyleof ? –  evencoil Nov 16 '10 at 17:07
    
Oh...lets see, so I think the way to go about this is to replace itemize with \usebeamertemplate*{itemize item}. But if I do that I get an error "You can't use `\raise' in internal vertical mode."--looking at the beamer templates they do have \raise commands in them. –  evencoil Nov 16 '10 at 17:23
    
Gee I'm a smart one...replace \textbullet by \usebeamertemplate*{itemize item} and it works. Because, you know, that makes sense, unlike what I just wrote. –  evencoil Nov 16 '10 at 17:25
    
That's right. \usebeamertemplate* is better here than \usebeamertemplate without the star. I had to look it up to find out why, but basically it will surround the item label with a group. –  Matthew Leingang Nov 16 '10 at 19:28
add comment

how about this:

\documentclass{beamer}

\begin{document}

\begin{frame}
    \frametitle{Title}
    \begin{tabular}{@{\textbullet}ll}
        Topic Apple: &Something to say about it \\
        Topic Watermelons: &Something different
    \end{tabular}
\end{frame}

\end{document}

Which results in

alt text

You can also change the \textbullet by, for example adding another column which will hold the item marker (which you can then control using beamer).

share|improve this answer
    
That seems like a good solution; do you happen to know what I need to put in to get beamer to replicate my itemize/enumerate style and the correct spacing after the bullet? –  evencoil Nov 16 '10 at 13:40
    
Nice. But there should be some space after the \textbullet. –  Hendrik Vogt Nov 16 '10 at 13:40
    
I tried to add \usebeamertemplate{itemize item} into the tabular definition, but got errors....my tex-foo isn't good enough to do this properly...anyone else want to take it from here? –  Yossi Farjoun Nov 16 '10 at 15:17
    
Oh, adding the space is easy, just add \hspace*{\labelsep} after the bullet. –  Yossi Farjoun Nov 16 '10 at 15:18
    
Thanks for that - but this doesn't seem to preserve neither line width, nor indentation, in two-column documents... –  sdaau Dec 28 '10 at 7:20
add comment

Since other suggestions here didn't work for my two-column document style, here is my plain-TeX hack to achieve something similar:

\begin{itemize}
\setlength{\itemsep}{0cm}%
\setlength{\parskip}{0cm}%
\item{\ \hbox to 3cm{Topic Apple: \hfill}\texttt{Something} to say about it}
\item{\ \hbox to 3cm{Topic Watermelons: \hfill}\texttt{Something} different}
\end{itemize}

Here is a brief explanation (before I forget it :) ):

  • the \itemsep and \parskip solve a different problem in my document (I include them since I'm not sure if they have an effect on the rest or not)
  • The first space '\' in the \item, is to cheat the \itemize environment - so it thinks it starts with plain text (otherwise, Latex will typeset everything in the first \hbox above the bullet point)
  • The '\hbox to 3cm{}' creates a box 3cm wide, in which the contents will be typeset - however, by default, the text contents (i.e., the 'glues') in this \hbox will be stretched across the entire width of the \hbox
  • To solve this stretching problem, we enter a '\hfill' at the end of the \hbox: thus, the text in the \hbox is typeset first, and then the \hfill inserts a space stretching to the end of the 3cm width - which effectively shows the text as 'raggedright' (i.e., left aligned)
  • (I had a '\texttt{}' word where I wanted the alignment indent to happen in my own case, so I included it here too)

Of course, to have this code usable, one should use a length variable before it:

\newlength{\tmplen}
\setlength{\tmplen}{3cm}

and then use \tmplen in the \items instead, as in:

...
\item{\ \hbox to \tmplen{Topic Apple: \hfill}\texttt{Something} to say about it}
...

... since you'll have to manually set the box width with this approach.

Well, hope this helps someone,

Cheers!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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