Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LaTeX beamer: way to change the bullet indentation?

Tags:

latex

beamer

I've checked the Beamer Class manual (PDF file).

I can't figure out how to change the indentation bullet assigns to \itemize.

[This is kind of important, as I'm using 2 column slides, and I don't want beamer to steal too much horizontal space].

like image 207
anon Avatar asked Apr 09 '10 22:04

anon


People also ask

How do you indent bullet points in LaTeX?

Q4. How Do You Indent a List in LaTeX? You can add additional depth to your list by first using the command \begin{enumerate} and then ending the code with \end{enumerate} for each level. Such LaTeX bullet points show up with different idents to indicate different depths.

How do I decrease indent in LaTeX?

LaTeX will automatically indent the first line of each paragraph that doesn't immediately follow a section heading. If you'd like to get rid of an indent, you can use the \noindent command: \section{Introduction} This is the first paragraph. \noindent This is the second paragraph.

How do you do bullet points in Beamer?

Unordered lists Unordered lists have a marker, such as a bullet, before every list item. To create an unordered list in beamer, we use the itemize environment. Inside this environment, the list entries can be updated using the \item command. A simple unordered list example is presented below.

How do I make a list in LaTeX?

Using lists in LaTeX is pretty straightforward and doesn't require you do add any additional packages. For unordered lists, LaTeX provides the itemize environment and for ordered lists there is the enumerate environment. The elements within both environments have to be declared beginning with the \item command.


1 Answers

Beamer just delegates responsibility for managing layout of itemize environments back to the base LaTeX packages, so there's nothing funky you need to do in Beamer itself to alter the apperaance / layout of your lists.

Since Beamer redefines itemize, item, etc., the fully proper way to manipulate things like indentation is to redefine the Beamer templates. I get the impression that you're not looking to go that far, but if that's not the case, let me know and I'll elaborate.

There are at least three ways of accomplishing your goal from within your document, without mussing about with Beamer templates.

With itemize

In the following code snippet, you can change the value of \itemindent from 0em to whatever you please, including negative values. 0em is the default item indentation.

The advantage of this method is that the list is styled normally. The disadvantage is that Beamer's redefinition of itemize and \item means that the number of paramters that can be manipulated to change the list layout is limited. It can be very hard to get the spacing right with multi-line items.

\begin{itemize}   \setlength{\itemindent}{0em}   \item This is a normally-indented item. \end{itemize} 

With list

In the following code snippet, the second parameter to \list is the bullet to use, and the third parameter is a list of layout parameters to change. The \leftmargin parameter adjusts the indentation of the entire list item and all of its rows; \itemindent alters the indentation of subsequent lines.

The advantage of this method is that you have all of the flexibility of lists in non-Beamer LaTeX. The disadvantage is that you have to setup the bullet style (and other visual elements) manually (or identify the right command for the template you're using). Note that if you leave the second argument empty, no bullet will be displayed and you'll save some horizontal space.

\begin{list}{$\square$}{\leftmargin=1em \itemindent=0em}   \item This item uses the margin and indentation provided above. \end{list} 

Defining a customlist environment

The shortcomings of the list solution can be ameliorated by defining a new customlist environment that basically redefines the itemize environment from Beamer but also incorporates the \leftmargin and \itemindent (etc.) parameters. Put the following in your preamble:

\makeatletter \newenvironment{customlist}[2]{   \ifnum\@itemdepth >2\relax\@toodeep\else       \advance\@itemdepth\@ne%       \beamer@computepref\@itemdepth%       \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%       \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%       \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%       \begin{list}         {             \usebeamertemplate{itemize \beameritemnestingprefix item}         }         { \leftmargin=#1 \itemindent=#2             \def\makelabel##1{%               {%                     \hss\llap{{%                     \usebeamerfont*{itemize \beameritemnestingprefix item}%                         \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%               }%               }%           }   \fi } {   \end{list}   \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}% } \makeatother 

Now, to use an itemized list with custom indentation, you can use the following environment. The first argument is for \leftmargin and the second is for \itemindent. The default values are 2.5em and 0em respectively.

\begin{customlist}{2.5em}{0em}    \item Any normal item can go here. \end{customlist} 

A custom bullet style can be incorporated into the customlist solution using the standard Beamer mechanism of \setbeamertemplate. (See the answers to this question on the TeX Stack Exchange for more information.)

Alternatively, the bullet style can just be modified directly within the environment, by replacing \usebeamertemplate{itemize \beameritemnestingprefix item} with whatever bullet style you'd like to use (e.g. $\square$).

like image 110
RTBarnard Avatar answered Sep 28 '22 09:09

RTBarnard