TransWikia.com

How can I adjust this code for a vertical enumerate in documentclass{book}?

TeX - LaTeX Asked on September 4, 2020

documentclass[border=10pt,tikz,x11names]{standalone}
 usepackage[outline]{contour}
 usetikzlibrary{shadows}

 begin{document}

begin{tikzpicture}[button/.style 2 args={
    circle, 
    minimum size=0.75cm,
    top color=#1!30!white,
    bottom color=#1,
    draw=#1!90!black,
    thick,
    append after command={
        node[circle,draw=#1!90!white,
        minimum size=0.68cm,
        font=sffamily]at(tikzlastnode.center)
        {textcolor{white}{contour{#1}{#2}}}
    },
    general shadow={
        shadow xshift=.2ex, shadow yshift=-.2ex,
        opacity=.5, fill=black!50,
    }
}]

foreach buttoncolor[count=i] in {red, 
 DarkOrange1,Goldenrod1,Green3,blue!50!cyan,DarkOrchid2}
node[button={buttoncolor}{i}] at (i, 0){};

foreach buttoncolor[count=xi,evaluate=xi as i using int(13-xi)] in 
{Azure2,gray!25!white,Snow3,Snow4,black!80!white,black}
node[button={buttoncolor}{i}] at (xi, -1){};

end{tikzpicture}
begin{itemize}
item 54
end{itemize}

end{document}

One Answer

This answer is based on https://tex.stackexchange.com/a/50452/90297 .

The difference from your MWE:

  1. Used the book document class as requested.
  2. Put the circled in a newcommand as in the old answer.

Differences from previous answer:

  1. Notice that unlike the original, here you can take two parameters into your button, enabling you to use different colors in different levels/lists.
  2. Used contour and shading as in MWE.

MWE:

documentclass{book}

usepackage{tikz}
usetikzlibrary{shadows}
usepackage[outline]{contour}

newcommand*circled[2]{
            tikz[
                baseline=(char.base)
            ]{%
            node[shape=circle,
                  minimum size=0.75cm,
                  top color=#1!30!white,
                  bottom color=#1, 
                  draw=#1!90!black,
                  append after command={
                    node[circle,draw=#1!90!white,
                    minimum size=0.68cm,
                    font=sffamily]at(tikzlastnode.center)
                    {textcolor{white}{contour{#1}{#2}}}
                  },
                  thick,
                  general shadow={
                    shadow xshift=.2ex, shadow yshift=-.2ex,
                    opacity=.5, fill=black!50,
                  }
                  ] (char) {#2};}}

usepackage{enumitem}
usepackage{xcolor}

begin{document}

begin{enumerate}[label=protectcircled{red}{arabic*}]
item Step one%
item Step two%
item Step three%
end{enumerate}


end{document}

Correct answer by Elad Den on September 4, 2020

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