4

I can draw circle around the some of enumi, but I can not draw circle around the some of enumii.

\documentclass{article} 
\usepackage{refcount}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{calc}
\tikzset{
  every round node/.style={
    draw,
    shape=rounded rectangle,
    rounded rectangle arc length=180,
    inner sep=+.333em,
    text depth=+.1ex},
  light/.style={fill=none, text=black},
  dark/.style={fill=black, text=white}}
\newcommand{\round}[2][]{%
  \tikz[baseline]
    \node[
      every round node,
      anchor=base,
      #1]{$#2$};}
\begin{document}

\begin{enumerate}
\item\label{1} blabla

\pgfmathtruncatemacro{\Result}{\getrefnumber{1}+1}
\item[\round{\Result}] Step one 
\addtocounter{enumi}{1}

\item Step two 
\begin{enumerate}
\item\label{2} blabla
%\pgfmathtruncatemacro{\Result}{\getrefnumber{2}+1}!!!! IT IS NOT WORK HERE.
\item[\round{\Result}] Step one
\item blalblabla
\end{enumerate}
\item Step three
\end{enumerate}

\end{document}

enter image description here

hosein
  • 575
  • 5
  • 12
  • Thanx Mico - @Hosein – hosein Sep 04 '15 at 05:05
  • 1
    Maybe you could explain your question in more detail in the question body. I'm not quite sure if I understand. You seem to be able to label enumis fine, is your trouble related to the format in enumiis? – moewe Sep 04 '15 at 05:12
  • Yes. My trouble related to the how draw circle around a enumii. – hosein Sep 04 '15 at 05:29

2 Answers2

5

Here is a crude way with two commands

\newcommand{\resulti}{\refstepcounter{enumi}\round{\theenumi}}
\newcommand{\resultii}{\refstepcounter{enumii}\round{\theenumii}}

And then use

 \item[\resulti] Step one

for the outer enumeration and

\item[\resultii] Step one

for first inner one.

Code:

\documentclass{article}
\usepackage{refcount}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\usetikzlibrary{calc}
\tikzset{
  every round node/.style={
    draw,
    shape=rounded rectangle,
    rounded rectangle arc length=180,
    inner sep=+.333em,
    text depth=+.1ex},
  light/.style={fill=none, text=black},
  dark/.style={fill=black, text=white}}
\newcommand{\round}[2][]{%
  \tikz[baseline]
    \node[
      every round node,
      anchor=base,
      #1]{#2};}
\newcommand{\resulti}{\refstepcounter{enumi}\round{\theenumi}}
\newcommand{\resultii}{\refstepcounter{enumii}\round{\theenumii}}
\begin{document}

\begin{enumerate}
\item\label{1} blabla

%\pgfmathtruncatemacro{\Result}{\getrefnumber{1}+1}
\item[\resulti] Step one
%\addtocounter{enumi}{1}

\item Step two
\begin{enumerate}
\item\label{2} blabla
%\pgfmathtruncatemacro{\Result}{\getrefnumber{2}+1}!!!! IT IS NOT WORK HERE.
\item[\resultii] Step one
\item blalblabla
\end{enumerate}
\item Step three
\end{enumerate}

\end{document}
4

Here is a very simple solution, just renew \labelenumi or \labelenumii each time you want a circle, then change it back (\circled stole from here, did some minor adjustment).


\documentclass{article} 
\usepackage{refcount}
\usepackage{tikz}

\newcommand*\circled[1]{
    \tikz[baseline=(char.base)]{
        \node[shape=circle,draw,inner sep=0pt] (char) {#1\strut}
    }\kern-3pt
}

\let\oldlabelenumi=\labelenumi
\let\oldlabelenumii=\labelenumii

\begin{document}

\begin{enumerate}
\item\label{1} blabla

\item Step one 
\addtocounter{enumi}{1}

\renewcommand{\labelenumi}{\circled{\oldlabelenumi}}
\item Step two 
\renewcommand{\labelenumi}{\oldlabelenumi}

\begin{enumerate}
\item\label{2} blabla

\renewcommand{\labelenumii}{\circled{\oldlabelenumii}}
\item Step one
\renewcommand{\labelenumii}{\oldlabelenumii}

\item blalblabla
\end{enumerate}
\item Step three
\end{enumerate}

\end{document}

enter image description here

Francis
  • 6,183