10

I use the underscore character _ in normal text mode (not typewriter). However, it is quite long. How can I decrease its length so that it is shorter?

I followed the Tex FAQ on how to typeset an underscore character using this:

\documentclass[oneside]{scrbook}

% (1) choose a font that is available as T1
\usepackage{lmodern}

% (2) specify encoding
\usepackage[T1]{fontenc}

% (3) load symbol definitions
\usepackage{textcomp}

\begin{document}
Forscher\_innen, Protagonist\_innen, etc.
\end{document}

However the outcome looks like this then:

enter image description here

If the underscore was a bit shorter, everything would be fine. I would rather not like to solve this by inserting a \rule as I would still be able to search the resulting PDF file for a string like Forscher_innen.

The background is that I use the so called Gender Gap (german wikipedia), i.e. underscores within normal text.

  • 2
    It seems to be specific with the font use. the standard LaTeX fonts (computer modern or the more recent Latin modern) seem to have a very long underscore character. Using other fonts (e.g., \usepackage{times} or \usepackage{palatino}) give completely different results, probably much closer to what you would expect. – ArTourter Aug 18 '13 at 14:16
12

I agree with ArTourter that you are probably better off simply choosing a font that has an appropriately sized underscore character. However, here's a hack using the relsize package that allows you to scale the underscore character to your liking. It would also be possible to use the underscore character only from a different font, but I'm not sure that the result is desirable, given that different fonts have different stroke weights. I've shown examples of both options in the document below:

\documentclass[oneside]{scrbook}

% (1) choose a font that is available as T1
\usepackage{lmodern}
\usepackage{relsize}
% (2) specify encoding
\usepackage[T1]{fontenc}

\renewcommand{\_}{\textscale{.7}{\textunderscore}}
\begin{document}
Forscher\_innen, Protagonist\_innen, etc.

% Original length for comparison
\renewcommand{\_}{\textscale{1}{\textunderscore}}
Forscher\_innen, Protagonist\_innen, etc.

% Underscore from Times
\renewcommand{\_}{{\fontfamily{ptm}\selectfont\textunderscore}}
Forscher\_innen, Protagonist\_innen, etc.

\end{document}

output of code

2

Extending Alan Munn's proposition, I finally came out with this, which does not modify \_, but still makes it right in PDFs (copying and searching work as they should)

\newcommand{\gendergap}{\kern-.5pt\adjustbox{scale={0.5}{1},raise={1.5pt}{\height}}{\textunderscore}\kern-.5pt}

Forscher\gendergap innen, Protagonist\gendergap innen

I also added these for having prettier source code:

\newcommand\g[2]{#1\gendergap #2}
\newcommand\n{"-\gendergap\relax{}in }
\newcommand\innen{"-\gendergap\relax{}in\-nen }
\WithSuffix\newcommand\n*{"-\gendergap\relax{}in} % needs \usepackage{suffix}
\WithSuffix\newcommand\innen*{"-\gendergap\relax{}in\-nen}

\g{Der}{die} Forscher\n und Forscher\innen*, Protagonist\innen und Protagonist\n*, etc

Additionally, they allow hyphenation before the _ (without it there would not be any hyphenation possibility within for example Forscher_in, which is very long). This needs \usepackage{ngerman}.

I named it \n because \in already exists (If you read the \ as an i it does even make sense :) )

Complete document:

\documentclass[oneside]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{ngerman} % for "- support
\usepackage{suffix} % for the star versions

\usepackage[pdftex]{adjustbox}

\newcommand{\gendergap}{\kern-.5pt\adjustbox{scale={0.5}{1},raise={1.5pt}{\height}}{\textunderscore}\kern-.5pt}

\newcommand\n{"-\gendergap\relax{}in }
\newcommand\innen{"-\gendergap\relax{}in\-nen }
\WithSuffix\newcommand\n*{"-\gendergap\relax{}in}
\WithSuffix\newcommand\innen*{"-\gendergap\relax{}in\-nen}

\begin{document}

Forscher\gendergap innen, Protagonist\gendergap innen, etc

Forscher\n und Forscher\innen*, Protagonist\innen und Protagonist\n*, etc

Line break demonstration: Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen Forscher\innen 

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