# define command to insert a small picture into text

I'd like to define a command that inserts a small sign saved as pdf. It should be fit into a floating text. I've not found a good solution for this yet, so I try to ask you...

Why?

I have a graphic in my documents, where specific peaks are marked with small colored squares. In the caption I'd like to wrie something to this marked peaks and would like to visualize it by using the same square within the text.

simple example using + instead of the colored square:

In my graphic I marked a peak with '+', in the caption I'd like to do this: 'As it can be seen the dimer (+) was determined to be...'

Is this possible?

Thanks to everybody!

• You have not found a good solution yet. What have you tried so far? It sounds to me a normal \includegraphics would do the job. – campa Aug 20 at 9:01
• Can you please show some minimal code? – egreg Aug 20 at 10:03

As @campa said, this can easily be achieved with the \includegraphics command. But if your goal is it to make a shorter command this could be one solution:

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {./images/} } % The path where you store the graphics

\newcommand{\1}{\includegraphics[scale=0.06]{square}}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. \1
Morbi aliquam ligula at nunc consectetur. \1

\end{document}


/images/ is the path where the images are stored

\1 is the name of the new command. You can change it, just dont use existing commands

you can change the scale to allign text and image sizes

square is the name of the image I used

Result: