4

Good morning. It's my problem, add the bold (*****) asterisk before enumerate items and also colored. Here my code,

\documentclass[a4paper,twoside,openright,11pt]{scrbook}
\usepackage[left=1.5cm,right=1cm,top=3cm,bottom=1.5cm,marginparwidth=6cm,marginparsep=1cm,outer=8cm]{geometry}

\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{enumitem}

\newcommand{\ssitem}{\stepcounter{enumii}\item[${ }*{ }$\theenumii)]}
\newcommand{\sitem}{\stepcounter{enumi}\item[${ }*{ }$\theenumi.]}

\renewcommand\theenumi{\textbf{\arabic{enumi}}}
\renewcommand\theenumii{\textbf{\alph{enumii}}}

\setlist[enumerate,2]{font=\bfseries,before=\bfseries,before=\setupmodenumerate}
\setlist[enumerate,1]{font=\bfseries,before=\setupmodenumerate}

\newif\ifcitem

\newcommand{\setupmodenumerate}{%
\global\citemfalse
\let\origmakelabel\makelabel
\def\citem##1{\global\citemtrue\def\cecolor{##1}\item}%
\def\makelabel##1{%
\origmakelabel{\ifcitem\color{\cecolor}\fi##1}%
\global\citemfalse}}

\begin{document}

\begin{enumerate}
\item Black Question
\begin{enumerate}
\item Case \textbf{*}
\item Case
\ssitem No problem in black color
\end{enumerate}
\end{enumerate}

\textbf{Lorem}

\begin{enumerate}[resume]
\citem{blue} Blue Question
\begin{enumerate}
\citem{red} Case
\citem{blue} Problem, no added asterisk
\end{enumerate}
\end{enumerate}

\begin{enumerate}[resume]
\citem{red} Problem, no added asterisk
\end{enumerate}

\end{document}

enter image description here

Can be solved the problem by adding this codes? So, does anyone know how to fix it.

Related:

Define a colour enumeration

2
  • 3
    Note that “Asterix” is a character in comics, the character in fonts is called “asterisk”. ;-)
    – egreg
    Sep 6 '14 at 10:47
  • @egreg, I made how such a mistake. I don't believe that. I'm laughing still. :)
    – Özgür
    Sep 6 '14 at 19:34
4

Why to complicate life?

\documentclass[a4paper,twoside,openright,11pt]{scrbook}
\usepackage[left=1.5cm,right=1cm,top=3cm,bottom=1.5cm,marginparwidth=6cm,marginparsep=1cm,outer=8cm]{geometry}

\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage{bm}
\usepackage{enumitem}

\newcommand{\ssitem}[1][black]{\stepcounter{enumii}\item[\color{#1}$\bm{*}$\,\textbf{\alph{enumii})}]}
\newcommand{\sitem}[1][black]{\stepcounter{enumi}\item[\color{#1}$\bm{*}$\,\textbf{\theenumi}]}

%\renewcommand\theenumi{\textbf{\arabic{enumi}.}}
%\renewcommand\theenumii{\textbf{\alph{enumii}}}

\setlist[enumerate,1]{label=\textbf{\arabic*.}}
\setlist[enumerate,2]{label=\textbf{\alph*)}}

\begin{document}

\begin{enumerate}
\item Black Question
\begin{enumerate}
\item Case \textbf{*}
\item Case
\ssitem No problem in black color
\end{enumerate}
\end{enumerate}

\textbf{Lorem}

\begin{enumerate}[resume]
\sitem[blue] Blue Question
\begin{enumerate}
\ssitem[red] Case
\ssitem[blue] Problem, no added asterisk
\item Case
\end{enumerate}
\end{enumerate}

\end{document}

enter image description here

5
  • thanks for that you solve my problem again. But I have a one more question, right parenthesis not bold in uncolored and unasterisk. (I did efforted but I can't do it)
    – Özgür
    Sep 6 '14 at 19:45
  • No, always parenthesis and . (dot) are bold. That is, whether asterisk or colored. @Harish Kumar.
    – Özgür
    Sep 7 '14 at 0:30
  • I'm writing your name at the end of sentence because if I wrote at the beginning of sentence your name be visible.
    – Özgür
    Sep 7 '14 at 0:33
  • @Özgür Please see the update.
    – user11232
    Sep 7 '14 at 0:49
  • Perfect working. The question has [CLOSED].
    – Özgür
    Sep 7 '14 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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