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
    Show a complete example. That makes it more easier to test your issue. – Ulrike Fischer Jan 30 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 Jan 30 at 19:24
5

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.