colorbox
does not wrap automatically, put the text in a \parbox
for a example and it will work:
Other ways: Use tcolorbox
, for example:
\documentclass[a4paper]{article}
\usepackage{xcolor}
\usepackage{showframe}
\usepackage[skins]{tcolorbox}
\tcbset{commonstyle/.style={boxrule=0pt,sharp corners,enhanced jigsaw,nobeforeafter,boxsep=0pt,left=\fboxsep,right=\fboxsep}}
\newtcolorbox{mycolorbox}[1][]{commonstyle,#1}
\newlength\myboxwidth
\setlength{\myboxwidth}{\dimexpr\textwidth-2\fboxsep}
\begin{document}
\parindent=0em
\colorbox[RGB]{0,209,0}{This block represents a generic three phase back emf, like a power line, as vectors.}
\colorbox[RGB]{232,209,82}{This block converts the vectors to three phase representation.}
\colorbox[RGB]{255,66,209}{The Modulator that can perform sinus, symmetric or minswitch modulation, with fixed or random carrier wave frequency.}
\colorbox[RGB]{97,189,252}{This is an ideal three level inverter.}
\colorbox[RGB]{255,128,0}{This is a model of the grid connection and the load. It also calculates how much current is taken from the DC link.}
\begin{center}
With \verb!\parbox!
\end{center}
\colorbox[RGB]{0,209,0}{\parbox{\myboxwidth}{This block represents a generic three phase back emf, like a power line, as vectors.}}
\colorbox[RGB]{232,209,82}{\parbox{\myboxwidth}{This block converts the vectors to three phase representation.}}
\colorbox[RGB]{255,66,209}{\parbox{\myboxwidth}{The Modulator that can perform sinus, symmetric or minswitch modulation, with fixed or random carrier wave frequency.}}
\colorbox[RGB]{97,189,252}{\parbox{\myboxwidth}{This is an ideal three level inverter.}}
\colorbox[RGB]{255,128,0}{\parbox{\myboxwidth}{This is a model of the grid connection and the load. It also calculates how much current is taken from the DC link.}}
\definecolor{colorone}{RGB}{0,209,0}
\definecolor{colortwo}{RGB}{232,209,82}
\definecolor{colorthree}{RGB}{255,66,209}
\definecolor{colorfour}{RGB}{97,189,252}
\definecolor{colorfive}{RGB}{255,128,0}
\begin{center}
With \texttt{tcolorbox}
\end{center}
\begin{mycolorbox}[colback=colorone]
This block represents a generic three phase back emf, like a power line, as vectors.
\end{mycolorbox}
\begin{mycolorbox}[colback=colortwo]
This block converts the vectors to three phase representation.
\end{mycolorbox}
\begin{mycolorbox}[colback=colorthree]
The Modulator that can perform sinus, symmetric or minswitch modulation, with fixed or random carrier wave frequency.
\end{mycolorbox}
\begin{mycolorbox}[colback=colorfour]
This is an ideal three level inverter.
\end{mycolorbox}
\begin{mycolorbox}[colback=colorfive]
This is a model of the grid connection and the load. It also calculates how much current is taken from the DC link.
\end{mycolorbox}
\begin{center}
With \texttt{tcolorbox} and shadows.
\end{center}
\begin{mycolorbox}[colback=colorone,drop lifted shadow]
This block represents a generic three phase back emf, like a power line, as vectors.
\end{mycolorbox}
\end{document}

\colorbox
does not wrap, unless using a\parbox
, e.g