1

I am going to use custom itemize label created by TikZ, however can not align it as other labels:

enter image description here

I tried shift but it is no work. I know that maybe I should change the itemize settings, however it will be move the other labels too.

Which is the optimal method to align custom mark horizontally same as bullets?

\documentclass{article}

\usepackage{enumitem}           
\setlist[itemize,1]{label=$\bullet$,leftmargin=0mm,
itemindent=7mm,labelsep=2mm,topsep=1mm,itemsep=-1mm,parsep=1mm}

\usepackage{tikz}

\newcommand{\clabel}{
    \begin{tikzpicture}[scale=0.5,baseline=(alrt.base)]
    \draw[thick,red,fill=yellow,rounded corners](0,0) --(0.5,1) -- (1,0) -- cycle;
    \node(alrt) at (0.5,0.4) {\textbf{!}};
    \end{tikzpicture}
}

\begin{document}

\begin{itemize}
  \item OK Here
  \item[\clabel] Not OK\dots It must be a little bit right
  \item OK again
\end{itemize}   

\end{document}
1

The problem is that the custom itemize labels grow to the left. You can fix it by adding overlay and a xshift:

Code

\documentclass{article}

\usepackage{enumitem}           
\setlist[itemize,1]{label=$\bullet$,leftmargin=0mm,
itemindent=7mm,labelsep=2mm,topsep=1mm,itemsep=-1mm,parsep=1mm}

\usepackage{tikz}

\newcommand{\clabel}{
    \begin{tikzpicture}[scale=0.5,baseline=(alrt.base), overlay, xshift=-3ex]
    \draw[thick,red,fill=yellow,rounded corners](0,0) --(0.5,1) -- (1,0) -- cycle;
    \node(alrt) at (0.5,0.4) {\textbf{!}};
    \end{tikzpicture}
}

\begin{document}

\begin{itemize}
  \item OK Here
  \item[\clabel] Not OK\dots It must be a little bit right
  \item OK again
\end{itemize}   

\end{document}

Output

enter image description here

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.