2

I have the following document:

\documentclass{scrartcl}
\usepackage{underscore}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}

\begin{document}

TLXV\rule{.5em}{.4pt}AAB % this looks better!
TLXV_2 % here the problem is that the underscore is too far downwards

\end{document}

Now in my opinion, the text-underscore looks too small, but maybe that's only due to the letter 'V' at the end. In my code editor, however, the underscore connects the letters much better (that means closer) with each other than in my pdf document generated by latex. Is there any way to improve on this? Possibly for the whole document?

  • You can add \usepackage[T1]{fontenc}, but there will be no kerning against the V anyway. – egreg Apr 29 '17 at 21:26
  • @egreg thanks, I actually just found that one too. It looks better, but the underscore seems to be a bit too far downwards, at least from my perspective. – user3032689 Apr 29 '17 at 21:30
3

You can redefine the \textunderscore character to be .5em in width instead of the default .3em by issuing \DeclareTextCommand{\textunderscore}{OT1}{\leavevmode\vbox{\hrule width.5em}}. Note that this will affect text as well as math mode. So, you can only redefine \_ by issuing \DeclareTextCommand{\_}{OT1}{\leavevmode\vbox{\hrule width.5em}} and leave \textunderscore as is to be used in places of _ as in the second example below. The _ internally calls \textunderscore.

\documentclass{scrartcl}
\usepackage{underscore}
\usepackage{mathptmx}

%\DeclareTextCommand{\_}{OT1}{\leavevmode\vbox{\hrule width.5em}} 
\DeclareTextCommand{\textunderscore}{OT1}{\leavevmode\vbox{\hrule width.5em}}

\begin{document}

TLXV{\_}AAB

TLXV_2

TLXV\_a

\end{document}

enter image description here

  • thanks, this is good, but it doesn't replace the underscore for the whole document (if it used for text as opposed to math mode) – user3032689 Apr 29 '17 at 21:30
  • @user3032689: Please see my updated solution. – AboAmmar Apr 29 '17 at 21:42
  • exactly what I was looking for. Nicely done! – user3032689 Apr 29 '17 at 23:14

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.