1

I would like to get the following colored boxes so that they are also slightly inclined. Here is a picture of what it should look like enter image description here

Can someone tell me how to do this with latex? Which packages do you have to use for this? Thank you in advance

2 Answers 2

4

You can use tcolorbox:

enter image description here

\documentclass{article}
\usepackage[most]{tcolorbox}

\newtcbox{mybox}[2]{
    enhanced,
    frame hidden,
    colback=#2,
    arc=2pt,
    tikz={rotate=#1,transform shape},
    fuzzy shadow={0mm}{0pt}{-.5pt}{1pt}{blue!90!white},
    nobeforeafter}

\begin{document}

\mybox{15}{red!40}{$f_1(x) = x^4 - 3x^2 + 1$}
\mybox{-10}{yellow!40}{$f_2(x) = x^2 - 3$}

\end{document}
2

The solution by @user187803 using tcolorbox is probably the right way to do this, especially is you want the fuzzy shadow. For variety, here is a TikZ solution using drop shadow.

enter image description here

\usepackage[dvipsnames]{xcolor} is unnecessary, but allows the use of fun color names.

\documentclass{article}

\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadows}

\newcommand{\colbox}[3]{\tikz{\node[fill=#1,rotate=#2,inner sep=2mm,
    drop shadow]{$#3$}}}

\begin{document}

\colbox{Salmon}{5}{f_1(x)=x^4-3x^2+1}\quad
\colbox{SkyBlue}{-5}{f_2(x)=-x^5-x^3+4x}\quad
\colbox{GreenYellow}{10}{f_3(x)=-x^8-3x^4-1}

\colbox{Dandelion}{10}{f_6(x)=-x^8-3x^4+1}\quad
\colbox{Lavender}{-10}{f_5(x)=-x^5-x^3-4x}\quad
\colbox{Thistle}{-10}{f_4(x)=-x^3-2}

\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.