# How can I put text next to an image

I have this:

\begin{figure}[!hb]
\label{curve}
\includegraphics[width=10cm, height=4cm]{images/smoothSinCurve.png}
\end{figure}

\begin{trivlist}
\item \textcolor{orange}{Orange} is overdose
\item \textcolor{green}{Green} is underdose
\item \textcolor{blue}{Blue} is perfect dosage.
\end{trivlist}


And it looks like this:

How can I put them on the same line?

• You can insert the text inside \caption{} inside the figure environment. Not use items. – Sigur Apr 20 '18 at 11:21
• Its still underneath – vonhact Apr 20 '18 at 11:35
• can you add an ECM ? – AndréC Apr 20 '18 at 11:36
• @vonhact, so you don't want on line below? Edit your post to make it clear. – Sigur Apr 20 '18 at 11:41
• @vonhact, for sure I read all the post. It is not my fault if you didn't explain well. same line could be same line as the figure, or all items in same line, but still below figure. Also, what is them? The items? Everything? – Sigur Apr 20 '18 at 14:50

Something like this, perhaps?

\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{graphicx,xcolor}
\begin{document}
\begin{figure}[!hb]
\centering
\label{curve}
\includegraphics[width=10cm, height=4cm]{example-image}
\begin{minipage}[b]{1.4in}
\begin{trivlist}
\item \textcolor{orange}{Orange} is overdose
\item \textcolor{green}{Green} is underdose
\item \textcolor{blue}{Blue} is perfect dosage.
\end{trivlist}
\end{minipage}
\end{figure}

\end{document}


I wrote a command that allows to do this simply. It was corrected by @egreg who wrote it as an environment here: https://tex.stackexchange.com/a/403618/138900

I have since modified it giving the possibility to put or not a vertical separation line:

\newlength\colG\newlength\colD%
\newenvironment{Compo}[1][0.5]
{%
\setlength{\colG}{#1\linewidth}%
\setlength{\colD}{\linewidth}%
\par\noindent%
\begin{minipage}{\colG}%
}%
{%
\end{minipage}%
\par%
}%
\newcommand{\compobreak}{%
\end{minipage}\hfill\vrule\hfill%
\begin{minipage}{\colD}%
}%
\newcommand{\componubreak}{%
\end{minipage}\hfill%
\begin{minipage}{\colD}%
}%


Which gives here:

\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{graphicx,xcolor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% nouvel environnement Compo
\newlength\colG%\newlength\colD%
\newenvironment{Compo}[1][0.5]
{%
\setlength{\colG}{#1\linewidth}%
\setlength{\colD}{\linewidth}%
\par\noindent%
\begin{minipage}{\colG}%
}%
{%
\end{minipage}%
\par%
}%
\newcommand{\compobreak}{%
\end{minipage}\hfill\vrule\hfill%
\begin{minipage}{\colD}%
}%
\newcommand{\componubreak}{%
\end{minipage}\hfill%
\begin{minipage}{\colD}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{Compo} [.5]
\label{curve}
\includegraphics[width=10cm, height=4cm]{example-image}
\compobreak

\begin{trivlist}
\item \textcolor{orange}{Orange} is overdose
\item \textcolor{green}{Green} is underdose
\item \textcolor{blue}{Blue} is perfect dosage.
\end{trivlist}
\end{Compo}
\end{document}


Output: