# position symbol horizontally

I would like to place symbol \ding{97} directly at the constant distance from the headword. I made command to place the symbol

% place frequent star
\newcommand{\freqstar}[1]{\hspace*{-1em}{\color{darkgreen}{\ding{97}}}}

in front of the headword. For placing the headwords I use this command

\newcommand\entry[3][]{\hangpara{2em}{1}{\fontfamily{phv}\selectfont{\textbf{{#2}}}}\#3\ifx\relax#1\relax\markboth{#2}{#2}\else\markboth{#1}{#1}\fi\par}\nopagebreak[4]

Problem is that the position is not precise. I would like to achieve that headwords are placed exactly same and the symbol is in front of them.

Follows a picture of incorrect placement:

• You should make a complete example that demonstrates your problem so that people don't have to track down the packages your are using before being able to do some tests. – Ulrike Fischer Dec 19 '12 at 13:44
• Thank you for remark. I will always put the minimum example. – chejnik Dec 19 '12 at 13:59
• Why the argument #1 if you don't use any? – egreg Dec 19 '12 at 14:02
• Thats true. I can delete it. I copy the structure from working command and left the field with no reason. – chejnik Dec 19 '12 at 14:03
• similar topic: How to create hanging bullet? has quite a bit of commentary (although i think the answer here is a better fit for the current question). – barbara beeton Dec 19 '12 at 14:05

## 1 Answer

Macro \llap can be used to print something to the left without changing the current position:

\newcommand{\freqstar}{% without argument
\leavevmode % stars paragraph if necessary, \llap does not do this
\llap{%
\textcolor{darkgreen}{\ding{97}}%
\,% space between symbol and entry
}%
}%

With lowering:

\newcommand{\freqstar}{% without argument
\leavevmode % stars paragraph if necessary, \llap does not do this
\llap{%
\raisebox{-.2ex}{%
\textcolor{darkgreen}{\ding{97}}%
}%
\,% space between symbol and entry
}%
}%

Centered around the math axis:

\documentclass{article}
\usepackage{pifont}
\usepackage{xcolor}
\definecolor{darkgreen}{rgb}{0,.5,0}

\newcommand{\freqstar}{%
\leavevmode % stars paragraph if necessary, \llap does not do this
\llap{%
$% \setlength{\mathsurround}{0pt}% \vcenter{% \hbox{% \textcolor{darkgreen}{\ding{97}}% }% }%$%
\,% space between symbol and entry
}%
}%

\begin{document}
\freqstar \textbf{\ae}
\end{document}

• Thank you. It works as wished - except that I need to lower the position of symbol now. – chejnik Dec 19 '12 at 14:02
• Excellent and beautifull :) !!! Merry Christmas dear community. – chejnik Dec 19 '12 at 16:36
• How is \vcenter defined? If I am not mistaken it is a tex primitive, right? – azetina Dec 19 '12 at 18:37
• @azetina Yes. it is a TeX primitive. – Heiko Oberdiek Dec 19 '12 at 20:46