2

Problem:

Removing all color related mechanisms from LaTex code to replace enumerate letters with FontAwesome icons. I have managed to show the icons but can't seem to get rid of the colors in the code.

Minimal Working Example (MWE):

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[swedish]{babel}
\usepackage{xcolor}
\usepackage{fontawesome}
\usepackage[shortlabels]{enumitem}


\definecolor{editorWhite}{cmyk}{0, 0, 0, 0}
\definecolor{editorBlack}{cmyk}{1, 1, 1, 1}

\begin{document}

\newcommand{\usageitem}[3][black]{%
  \item[%
    \colorbox{#2}{{\makebox[2em]{\strut #3}}}%
  ]
}

\setlist[enumerate,1]{leftmargin=12mm}

\begin{enumerate}[itemsep=6pt,topsep=6pt]
  \usageitem{editorWhite}{\centering \faBook} \textbf{Dictionary} is ...
  \usageitem{editorWhite}{\centering \large \faYoutubePlay} \textbf{Mobile phones} are cool ...
\end{enumerate}

\end{document}

Desired output:

Get rid of all color related mechanisms (definecolor, colorbox, black) and keep layout intact.

  • This isn't an enumerate list any longer, you should rather use description – user31729 Mar 5 '17 at 10:28
  • @ChristianHupfer Excellent, this worked out well. – kexxcream Mar 5 '17 at 11:30
2

Do you expect something like this:

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{fontspec}
\usepackage[swedish]{babel}
\usepackage{fontawesome}
\usepackage[shortlabels]{enumitem}

\begin{document}

\newcommand{\usageitem}[1]{%
  \item[%
    {\makebox[2em]{\strut #1}}%
  ]
}

\setlist[enumerate,1]{leftmargin=12mm}

\begin{enumerate}[itemsep=6pt,topsep=6pt]
  \usageitem{\centering \faBook} \textbf{Dictionary} is ...
  \usageitem{\centering \large \faYoutubePlay} \textbf{Mobile phones} are cool ...
\end{enumerate}

\end{document}

All I did: removed the xcolor-related commands (note: compiled using lualatex).

1

I followed the recommendation by @Christian and came up with this solution that supports (1) the use of FontAwesome icons in description lists (2) centering icons in labels based on the largest width of the icon used and, (3) indent icons and text through the labelindent option.

Highly appreciate everyone's effort.

Minimal Working Example:

\documentclass{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[swedish]{babel}
\usepackage{xcolor}
\usepackage{fontawesome}
\usepackage[shortlabels]{enumitem}
\usepackage{calc}

\begin{document}

\newlength{\langicons}
\setlength{\langicons}{\widthof{\faEnvelopeO}}
\addtolength{\langicons}{\labelsep}
\SetLabelAlign{CenterWithParen}{\makebox[\langicons]{#1}}

\begin{description}[
            itemsep=1em, 
            topsep=6pt, 
            parsep=0pt, 
            partopsep=0pt, 
            labelwidth=\langicons, 
            itemindent=0cm, 
            leftmargin=!, 
            rightmargin=0cm, 
            align=CenterWithParen, 
            labelindent=0em
]
  \item[\faSearch] \textbf{Search engines} can use ...
  \item[\faLanguage] \textbf{Proofreading} can be ...
  \item[\large \faCommentsO] \textbf{Translation tools} can use ...
\end{description}

\end{document}

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.