6

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: symbol placement

chejnik
  • 1,441
  • 2
  • 23
  • 42

1 Answers1

7

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}

Result

Heiko Oberdiek
  • 271,626