水平定位符号

水平定位符号

我想将符号\ding{97}直接放置在与词头相距一定距离的位置。我发出命令将符号放置在

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

在词头前面。为了放置词头,我使用这个命令

\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]

问题是位置不精确。我希望实现词头位置完全相同,符号位于词头前面。

以下是错误放置的图片: 符号放置

答案1

可以使用宏\llap在不改变当前位置的情况下在左侧打印一些内容:

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

降低:

\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
  }%
}%

以数学轴为中心:

\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}

结果

相关内容