1

When using the ctex package, it seems that a single underscore (\_) will be rendered the length of two underscores. However in the rendered PDF there's nothing wrong with the text itself (meaning you can search, select, copy and the text has always just one underscore as intended), it's just the rendering.

Here's a MWE:

\documentclass[11pt,a4paper]{article}
\usepackage{ctex}
\begin{document}
邮箱:test\_2018@outlook.com
\end{document}

When rendering with XeLaTeX, it produces:

enter image description here

The problem is bothering me a little because I'm using LaTeX to typeset my Chinese resume, so there's no way to avoid ctex, but the single underscore in my email address would be so easily mistaken as double underscore, and I fear potential employers may send e.g. interview invitation emails to a wrong address.

Is there any way to make the rendering right? Thanks!


Okay, it seems that putting \_ inside \texttt{} solves my problem. Normal text and (at least relatively) normal rendering now.
Vim
  • 197
  • From the proposed duplicate: \makeatletter \let\_\relax \DeclareRobustCommand{\_}{% \leavevmode \kern.06em\vbox{\hrule\@width.3em}} \makeatother – Marijn Sep 20 '19 at 19:57
  • Or alternatively \makeatletter \let\_\relax \DeclareRobustCommand{\_}{% \leavevmode\vbox{% \hrule\@width.5em \@height-.26ex \@depth\dimexpr.26ex+.28pt\relax}} \makeatother for a slightly longer underscore. – Marijn Sep 20 '19 at 19:57

0 Answers0