# Add color to an equation over an image using overpic

I'd like to add a couple of equations over a picture. I'm using the overpic package as explained in overpic_link. However, I'm trying to get the equation in color as shown in color_link

\documentclass{article}
\usepackage[percent]{overpic}
\usepackage{xcolor}

\begin{document}
\begin{overpic}[width=0.5\textwidth,grid,tics=10]{pictures/baum}
\put (20,85) \textcolor{blue}{\huge$\displaystyle\gamma$}
\end{overpic}
\end{document}


but I'm getting the error below: ! Package xcolor Error: Undefined color \hss '. could anyone please provide a feedback on why the error, I'm just starting using Latex, thanks.

• Try \put (20,85) {\color{blue} \huge $\gamma$}? (I don't think the \displaystyle is doing anything here...) Jun 29, 2021 at 2:36
• many thanks that solved the problem
– AGH
Jun 29, 2021 at 3:04
• I’m voting to close this question because it was solved in comments. Jun 29, 2021 at 4:41
• we may keep it, but ask willie wong to put it as an answer so that the new user may upvote it and accept it, and get acquainted with this site's model. Jun 29, 2021 at 5:12
• @WillieWong can you make your comment an answer? Jun 29, 2021 at 5:25

The correct syntax is

\put(<x>,<y>){<material>}


and you're missing the braces around the material you want to \put.

Spaces around the coordinates are ignored.

\documentclass{article}
\usepackage[percent]{overpic}
\usepackage{xcolor}

\begin{document}

\begin{overpic}[width=0.5\textwidth,grid,tics=10]{example-image-9x16}
\put (20,85) {\textcolor{blue}{\huge$\gamma$}}
\end{overpic}

\end{document}


I removed \displaystyle` that does nothing here, but it could make a difference with more complicated formulas.