TransWikia.com

Modifying enumerate items in beamer - insert graphics while generating labels

TeX - LaTeX Asked by Yu-Ho Haeppoelae on January 17, 2021

I’m trying to make myself a beamer template with modified bullets for enumerate and itemize. I have a pdf image of the bullet point that I would like to use. I already have a working solution for itemize, but using the same approach

newcommand{bpebble}[0]{includegraphics[height=1.3 ex]{./k_bluepebble.pdf}}
setbeamertemplate{enumerate items}{bpebble}

the numbering vanishes making the enumerate and itemize environments essentially indistinguishable. I’ve seen a near-satisfactory solution Use ball items in enumerate list with enumitem package in that it modifies the item in front of each enumerate list entry and superimposes a number on top of it, however this uses pgfplots and not an inserted pdf figure.

So, I’m seeking a way to include a pdf graphic into the list bullets and lay a number on top of it.

One Answer

Here's one possibility allowing you to insert an image as background for the counters in enumerate environments; the code illustrates the simple procedure up to level three of nesting (the maximum nesting level for beamer). The main command is bpebble with three mandatory arguments:

bpebble{<optionf for includegraphics>}{<image file>}{<counter to be used over the image>}

The complete code:

documentclass{beamer}
usepackage{tikz}

newcommandbpebble[3]{%
  tikz{
  node[inner sep=0pt] 
    (image) {includegraphics[#1]{#2}};%
  node[inner sep=0pt] 
    at (image.center) {#3};%
  }
}

setbeamertemplate{enumerate item}{bpebble{height=2ex}{papiro}{insertenumlabel}}
setbeamertemplate{enumerate subitem}{bpebble{height=1.8ex}{bricks}{insertsubenumlabel}}
setbeamertemplate{enumerate subsubitem}{bpebble{height=1.6ex}{scroll}{insertsubsubenumlabel}}

setbeamercolor*{enumerate item}{fg=white} 
setbeamercolor*{enumerate subitem}{fg=white} 
setbeamercolor*{enumerate subsubitem}{fg=black} 

begin{document}

begin{frame}
begin{enumerate}
item First.
item Second.
  begin{enumerate}
  item First.
  item Second.
    begin{enumerate}
    item First.
    item Second.
    end{enumerate}
  item Third.
  end{enumerate}
item Third.
item Fourth.
end{enumerate}
end{frame}

end{document}

The result:

enter image description here

Answered by Gonzalo Medina on January 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP