1

So I try to achieve the same output with LaTeX like I get with CSS to have the same formatted boxes for both output formats. It should look like this (created with CSS): enter image description here

With LaTeX I have no idea how to vertically center the Favicon icon on the left side of the box relative to the text length. I really like the tcolorbox package since it provides easy formatting, but I am not sure if I need to use other more flexible packages for this purpose. I got as far as this (LaTeX output): enter image description here

Here is the corresponding minimal reproducable example:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fontawesome}
\usepackage{tcolorbox}
\usepackage{xcolor}
\usepackage[english]{babel}
\usepackage{blindtext}

\definecolor{lightgreen}{RGB}{247,253,251}
\definecolor{newgreen}{RGB}{7,94,70}
\definecolor{bordergreen}{RGB}{101,223,190}

\newtcolorbox{preidea}{
    colback=lightgreen,
    colframe=bordergreen, 
    coltext=newgreen,
    boxrule=0.9pt,
    boxsep=5pt,
    arc=1pt,
    leftrule=0.8mm}

\newenvironment{idea}
{
    \begin{itemize}
        \renewcommand{\labelitemi}{
            \raisebox{-3\height}[0pt][0pt]{
                {\setkeys{Gin}{width=3em,keepaspectratio}\Huge \faLightbulbO}
            }
        }
        \setlength{\fboxsep}{1em}
        \begin{preidea}
            \item
        }
        {
        \end{preidea}
    \end{itemize}
}

\begin{document}
    \begin{idea}
        \blindtext
    \end{idea}
\end{document}

Any suggestions are highly appreciated.

PS: This is the CSS code, which creates this box.

div.idea {
  padding: 1em 1em 1em 4em;
  margin-bottom: 10px;
  background-color: rgb(247, 253, 251);
  border-color: rgb(101, 223, 190);
  color: rgb(7, 94, 70);
  border-top-width: 1px;
  border-left-width: 4px;
  border-right-width: 1px;
  border-bottom-width: 1px;
  position:relative;
  border-style: solid;
  border-radius: 4px;
}

div.idea:before {
  content: "\f0eb";
  font-family: FontAwesome;
  left:4%;
  position: absolute;
  top: 50%;
  -moz-transform: translateX(-50%) translateY(-50%);
  -webkit-transform: translateX(-50%) translateY(-50%);
  transform: translateX(-50%) translateY(-50%);
  font-size: 40px;
  color: rgb(12, 168, 127);
}

1 Answer 1

3

The following might get you started. Sizes, spacing, distances and alignment can of course be adjusted to your needs.

enter image description here

\documentclass{article}

\usepackage{blindtext}
\usepackage{fontawesome}
\usepackage{tcolorbox}

\definecolor{lightgreen}{RGB}{247,253,251}
\definecolor{newgreen}{RGB}{7,94,70}
\definecolor{bordergreen}{RGB}{101,223,190}

\newtcolorbox{myideabox}{sidebyside,
                         colback=lightgreen,
                         colframe=bordergreen, 
                         coltext=newgreen,
                         boxrule=0.9pt,
                         boxsep=5pt,
                         arc=1pt,
                         leftrule=0.8mm, 
                         lefthand width=0.4cm, 
                         lower separated=false, 
                         sidebyside gap=3mm, 
                         left=3pt}
                      
\newenvironment{myidea}{\begin{myideabox}\centering\LARGE\faLightbulbO\tcblower}
                       {\end{myideabox}}

\begin{document}

\begin{myidea}
\blindtext
\end{myidea}

\begin{myidea}
a single line of text
\end{myidea}

\begin{myidea}
\blindtext \blindtext
\end{myidea}


\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .