# How to customize vertical distance in 'underlying'

This seems to be a dummy one but I haven't found anything that works good for me.

I'm working in an article and I need to get an underlined expression, like this

I mean REALLY CLOSE, but, so far, the available options such as \underlying{x} or \underset{_}{x} haven't worked so good because it left a huge vertical space. I need it to be real close of x. Any ideas?

-

A \underline seems to work great:

If there is still too much space with you can draw your own \rule and tweak the placement as desired:

## Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}

\newcommand{\dd}{\mathrm{d}}
\newcommand{\ux}{\underline{x}}

\newcommand*{\LineWidth}{0.4pt}
\newcommand*{\YShiftContent}{-0.65ex}
\newcommand*{\YShiftRule}{0.5ex}
\newcommand{\ru}[1]{\raisebox{\BaselineAdjust}{\$\substack{\textstyle #1\$\YShiftContent]\rule[\YShiftRule]{\widthof{#1}}{\LineWidth}}}} \begin{document} \[ \int_{R_1} f_x (\ux \mid C_1)\dd \ux$
or using \verb|\ru| macro:
$\int_{R_1} f_x (\ru{x} \mid C_1)\dd \ru{x}$
\end{document}

-

If you need an underline symbol that's shorter than what's produced by \underline, you could turn to the ushort package and its \ushort macro. The first line below uses the \ushort macro, the second the \underline macro.

\documentclass{article}
\usepackage{ushort,amsmath}
\newcommand{\dee}{\operatorname{d\!}{}} % "differential" operator
% see http://tex.stackexchange.com/a/178948/5001
\setlength\textwidth{2in} % just for this example
\begin{document}
$\int_{R_1} f_x (\ushort{x} \mid C_1)\dee \ushort{x}$
vs.
$\int_{R_1} f_x (\underline{x} \mid C_1)\dee \underline{x}$
\end{document}

-