0

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.

8
  • 1
    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
  • 1
    I’m voting to close this question because it was solved in comments.
    – SebGlav
    Jun 29, 2021 at 4:41
  • 1
    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.
    – jarnosz
    Jun 29, 2021 at 5:12
  • 1
    @WillieWong can you make your comment an answer?
    – Don Hosek
    Jun 29, 2021 at 5:25

1 Answer 1

2

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.

enter image description here

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.