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
Can someone tell me how to do this with latex? Which packages do you have to use for this? Thank you in advance
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityYou can use tcolorbox
:
\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}
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
.
\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}