1

Consider

enter image description here

I would like to present the string of 12 colored bullets a little to the right of the enumerated tcolorbox and vertically centered.

The code which produces the above picture is

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{multicol}

\setlength{\columnsep}{1cm}
\usepackage{scalefnt}
\usepackage{xcolor}
\usepackage{amssymb}


% % The colored box that encloses the item number.
\usepackage{tcolorbox}
\newtcbox{\logo}{nobeforeafter, notitle, %sharpcorners,
    colframe=red,
    colback=red!35,
    top=0pt,
    left=0pt,
    right=0pt,
    bottom=0pt,
    fontupper=\sffamily\bfseries,
    tcbox raise base}


% % FANCY ENUMERATE positioning the enumerated colored box above the text.
\newcounter{cenum}
\newcommand\cenumsep{}  
\newenvironment{cenumerate}{%
  \setcounter{cenum}{0}%
  \setlength\parskip\bigskipamount
%  \begin{center}%
}{%
%  \end{center}%
}
\newcommand\citem{%
  \refstepcounter{cenum}%
  \par\cenumsep\logo{\arabic{cenum}}%
  \par\nobreak\vskip-\parskip\medskip\noindent\ignorespaces% \medskip is the distance between label and text, change as needed
}

% NEW SYMBOLS DEFINITION
\newcommand{\red}{\textcolor{red}{{\scalefont{1.0}{\bullet}}}}
\newcommand{\blue}{\textcolor{blue}{{\scalefont{1.0}{\bullet}}}}
  
\begin{document}
\large

 
$\red\blue\red\blue$ $\blue\red\blue\blue$ $\red\red\red\blue$

\begin{multicols}{2}
\begin{cenumerate}
\citem \lipsum[4] 
\end{cenumerate}
\end{multicols}
\end{document}

I have tried replacing \citem with \citem[$\red\blue\red\blue$ $\blue\red\blue\blue$ $\red\red\red\blue$], and also placing $\red\blue\red\blue$ $\blue\red\blue\blue$ $\red\red\red\blue$ to the right of \citem but neither of these produce what I am looking for.

QUESTION: How may I modify the above code so that I can place a uniquely colored binary string of colored bullets to the right of each enumerated item in a "fancy" listing such as this in the manner described?

Thank you.

3
  • you can use \citem[$... if you define \citem to have an optional argument, so \newcommand\citem{1][]{... #1 Sep 20 '21 at 15:47
  • @David Carlisle Is {1] correct? Also, I am not sure what {... #1 means. Perhaps you will consider posting this as an expanded answer. Thank you. Sep 20 '21 at 19:48
  • [1] not {1] sorry Sep 20 '21 at 19:56
2

A "little" to the right and vertically centered.

Using the new command \citemx{<bullets patttern>}

y

z

\documentclass{article}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{multicol}

\setlength{\columnsep}{1cm}
\usepackage{scalefnt}
\usepackage{xcolor}
\usepackage{amssymb}


% % The colored box that encloses the item number.
\usepackage{tcolorbox}
\newtcbox{\logo}{nobeforeafter, notitle, %sharpcorners,
    colframe=red,
    colback=red!35,
    top=0pt,
    left=0pt,
    right=0pt,
    bottom=0pt,
    fontupper=\sffamily\bfseries,
    tcbox raise base}


% % FANCY ENUMERATE positioning the enumerated colored box above the text.
\newcounter{cenum}
\newcommand\cenumsep{}  
\newenvironment{cenumerate}{%
    \setcounter{cenum}{0}%
    \setlength\parskip\bigskipamount
    %  \begin{center}%
}{%
    %  \end{center}%
}

\newcommand\citemx[1]{% added <<<<<<<<<<<<<<
\refstepcounter{cenum}%
\par\cenumsep\logo{\arabic{cenum}}%
\begin{minipage}{\linewidth} % added <<<<<<<<<<<<<<<<
    \hspace*{20pt}#1  % left/right space
    \vspace*{0.5ex}% vertical adjustment
\end{minipage}
\par\nobreak\vskip-\parskip\medskip\noindent\ignorespaces% \medskip is the distance between label and text, change as needed
}


% NEW SYMBOLS DEFINITION
\newcommand{\red}{\textcolor{red}{{\scalefont{1.0}{\bullet}}}}
\newcommand{\blue}{\textcolor{blue}{{\scalefont{1.0}{\bullet}}}}

\usepackage{showframe}% show the margins <<<<<<<<<<<<<<<<<<<<

\begin{document}
    \large
    
    \begin{multicols}{2}
        \begin{cenumerate}
            \citemx{$\red\blue\red\blue$ $\blue\red\blue\blue$ $\red\red\red\blue$} \lipsum[4] 
            \citemx{$\blue\blue\blue\blue$ $\red\red\red\blue$ $\red\blue\red\red$} \lipsum[1] 
            \citemx{$\blue\red\red\red$ $\blue\blue\red\blue$ $\red\red\red\red$} \lipsum[2] 
            
        \end{cenumerate}
    \end{multicols}
\end{document}
5
  • Thank you for posting your answer. For some reason, the system did not notify me that your answer had been posted. Regarding your answer, how may the header, side-margin, and text boxes be eliminated. I'm not sure why they are there. Sep 21 '21 at 0:48
  • I just figured out why the frames are being displayed. Thanks again. Sep 21 '21 at 0:52
  • Thank you for this most helpful answer. Sep 21 '21 at 1:49
  • @mlchristians Sorry I did not mention showframe Sep 21 '21 at 13:01
  • No problem. It didn't take me long to figure it out once I took a closer look at the code. Thanks again for your answer. Sep 21 '21 at 13:28

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.