1

I am using \usepackage[left]{showlabels} to print labels for my equations.

For example, I have an equation as:

\begin{equation}
x = a + b
\label{eqn:a_b}
\end{equation}

The label is printed as:

enter image description here

Sometimes the label names are long so I wanted to change the font size, I did that using the following line:

\renewcommand{\showlabelfont}{\tiny}

However, the underscore "_" in my label name gets replaced after I change the fontsize.

enter image description here

There is no more "_" in the printed label. What is going on?

2
  • 2
    Show a complete example. That makes it more easier to test your issue. Commented Jan 30, 2019 at 19:18
  • \documentclass{article} \usepackage[left]{showlabels} \renewcommand{\showlabelfont}{\tiny} %COMMENT AND UNCOMMENT \begin{document} \begin{equation} x = a + b \label{eqn:a_b} \end{equation} \end{document}
    – Alex
    Commented Jan 30, 2019 at 19:24

1 Answer 1

7

The default definition uses the typewriter font which with OT1 is slightly differently encoded as the roman font. Either add \ttfamily, or load T1-encoding (recommended anyway) or both.

\documentclass{article} 
\usepackage[left]{showlabels} 
%\usepackage[T1]{fontenc}
\renewcommand{\showlabelfont}{\ttfamily\tiny} 

\begin{document} 
\begin{equation} x = a + b \label{eqn:a_b} \end{equation} 
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .